View Issue Details

IDProjectCategoryView StatusLast Update
0002019FreeCADBugpublic2015-03-26 18:46
ReporterDougl Assigned Towmayer  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version14.04
Product Version0.15 
Fixed in Version0.15 
Summary0002019: SpaceNav control active without application focus
DescriptionThe model moves when any other application has focus and user is moving the SpaceNav pointer. The other application does not have to have SpaceNav support, just moving the SpaceNav controller at any time causes FreeCAD to move the model no matter if it has application focus or not.
Steps To Reproduceopen FreeCAD, load a model and verify SpaceNav can move the model. Notice the model orientation and position. Open another application or just switch to another application and then move the SpaceNav while this app has focus. Go back to FreeCAD and notice the model has moved.

I first saw this when I also had Blender open and manipulated a model in it and then could no longer see my model in FreeCAD.
Additional InformationI am currently using 0.15 PPA version of FreeCAD. I could not originally get 0.14 working with my SpaceNav and so I tried 0.15 and then realized I needed to follow these steps before it would work( sudo host +; sudo /etc/init.d/spacenavd restart; freecad ). I suspect 0.14 would work too but since the latest is showing this bug I'm posting as 0.15.

Log: Time = Sun Mar 22 01:12:02 2015
Log: AppDataSkipVendor = true
Log: AppHomePath = /usr/lib/freecad/
Log: AppIcon = freecad
Log: BinPath = /usr/lib/freecad/bin/
Log: BuildRepositoryURL = git://git.code.sf.net/p/free-cad/code master
Log: BuildRevision = 4664 (Git)
Log: BuildRevisionBranch = master
Log: BuildRevisionDate = 2015/03/16 22:40:27
Log: BuildRevisionHash = 4e41e535ff01d39b650add123f42629e1a8d6b05
Log: BuildVersionMajor = 0
Log: BuildVersionMinor = 15
Log: CopyrightInfo = © Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2015
TagsNo tags attached.
FreeCAD Information

Relationships

related to 0001659 closed 3dconnexion space navigator moves view even when FreeCAD is not the active application 
related to 0001970 closedwmayer Spaceball 5000 USB no longer works in Windows 7 in 0.15 dev versions 

Activities

normandc

2015-03-22 17:13

manager   ~0005914

Doug, are you aware that Ubuntu 13.04 has reached end of life more than one year ago? Since you mention using FreeCAD 0.15.4664 it's probably a typo because the Daily Builds PPA stopped updating for Ubuntu 13.04 in January 2014.

It is best to post your FreeCAD info according to this forum post: http://forum.freecadweb.org/viewtopic.php?f=3&t=2264

Dougl

2015-03-22 17:59

reporter   ~0005918

Right, that should have been Ubuntu 14.04 and I will use the GUI About box info the next time. As you probably know, I got the posted info from $HOME/.FreeCAD/FreeCAD.log and the thinking was more verbose coming from the log. Comments noted. thanks.

Dougl

2015-03-22 18:02

reporter   ~0005919

should this be closed and another issue opened with the correct OS version and product version( 0.15 )? I could also unload 0.15 and reload 0.14 from the Canonical repository and verify it occurs there too. Anything I can do to help.

tanderson69

2015-03-23 00:06

developer   ~0005921

I am not seeing that behavior here. I am about 3 months back from current master.

OS: Ubuntu 14.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4427 +31 (Git)
Branch: surfaceTrim
Hash: a5bf4d8e9ec369f6f912131c1ce66f78e659bbf8
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17-dev

Dougl

2015-03-23 00:17

reporter   ~0005923

Just to provide the system/app details using the About info and having noticed the latest build is not 0.16 and it occurs there:

OS: Ubuntu 14.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.4694 (Git)
Branch: master
Hash: f87fbe7e2a22a911a831f9e6db7c02d7c9391e06
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1

FWIW, spacenavd version is 0.6

Dougl

2015-03-23 03:53

reporter   ~0005924

Looks to me if all events need to be propagated, the original code(commented out) testing and exiting on !activeWindow() should instead be a test for activeWindow() wrapping just the 2 Spaceball events(motion & buttons). Just a guess but maybe the issue in 0001970 was that the device registration was happening before the the main window was activated and therefore never getting handled/propagated. Not knowing Qt, this seems like it should handle both cases:


bool Gui::GUIApplicationNativeEventAware::processSpaceballEvent(QObject *object, QEvent *event)
{
    QApplication::notify(object, event);
    if (activeWindow())
    {
        if (event->type() == Spaceball::MotionEvent::MotionEventType)
        {
            Spaceball::MotionEvent *motionEvent = dynamic_cast<Spaceball::MotionEvent*>(event);
            if (!motionEvent)
                return true;
            if (!motionEvent->isHandled())
            {
                //make a new event and post to parent.
                Spaceball::MotionEvent *newEvent = new Spaceball::MotionEvent(*motionEvent);
                postEvent(object->parent(), newEvent);
            }
        }

        if (event->type() == Spaceball::ButtonEvent::ButtonEventType)
        {
            Spaceball::ButtonEvent *buttonEvent = dynamic_cast<Spaceball::ButtonEvent*>(event);
            if (!buttonEvent)
                return true;
            if (!buttonEvent->isHandled())
            {
                //make a new event and post to parent.
                Spaceball::ButtonEvent *newEvent = new Spaceball::ButtonEvent(*buttonEvent);
                postEvent(object->parent(), newEvent);
            }
        }
    } // if activeWindow()
    return true;
}

tanderson69

2015-03-23 05:04

developer   ~0005925

Shouldn't matter. Only spaceball events go through this code. All other events are handled elsewhere.

http://sourceforge.net/p/free-cad/code/ci/master/tree/src/Gui/Application.cpp#l1536

Dougl

2015-03-23 06:00

reporter   ~0005926

Strange, if that's the only place processSpaceballEvent(obj,event) is called I don't see why the "if(!activeWindow())" was commented out as it shouldn't have effected Windows 7 spaceball initialization since it deals with only movement and button events.

So why not have the activeWindow() test ANDed with the movement || button event test(line 1535 of Application.cpp)?

tanderson69

2015-03-23 14:15

developer   ~0005929

Last edited: 2015-03-23 14:38

Ok, I finally got up to date on my master branch and commit f2d8fc9 commented out the activeWindow check. The comment* makes me wonder if the change was necessary or just a test that made it's way into the commit. It would be nice if we could get confirmation on this from the windows guys. We might be having a platform "war" here.


*// Maybe this causes the regression reported in 0001970. So to test it it will be commented out for now


On a related note: When I first implemented the event handler for x11, I was getting situations where there was no focusWidget during normal GUI interaction. This was extremely annoying so I added the following code to the x11 event handler to work around this. Maybe this behavior has changed and we can remove it.

QWidget *currentWidget = this->focusWidget();
if (!currentWidget)
  currentWidget = mainWindow;

Edit: No the behavior hasn't changed. Everytime you dismiss a task dialog the focusWidget becomes null. Save that discussion for another time.

wmayer

2015-03-23 18:45

administrator   ~0005934

In version 0.15 the space mouse stopped working under Windows while 0.14 worked properly and there was a change added after the release of 0.14 -- the check of the active window.

Since it was unclear if this was a regression I commented out this check but it appeared the problem was somewhere else. The problem was that the new Quarter based viewer overwrote the callback function to get raw input events.

I then simply forgot the activate the above check again... git show 70a1124

tanderson69

2015-03-23 18:49

developer   ~0005935

I thought maybe that was the case. Thanks

Dougl

2015-03-24 14:53

reporter   ~0005939

I do not see the issue in this mornings build:

OS: Ubuntu 14.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.4699 (Git)
Branch: master
Hash: eba335c6158eb2ffeff1654d29db5ad99af524cd
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a

Related Changesets

FreeCAD: master 70a1124a

2015-03-23 19:44:04

wmayer

Details Diff
+ re-enable check for active window for spaceball events Affected Issues
0002019
mod - src/Gui/GuiApplicationNativeEventAware.cpp Diff File

Issue History

Date Modified Username Field Change
2015-03-22 08:54 Dougl New Issue
2015-03-22 17:13 normandc Note Added: 0005914
2015-03-22 17:59 Dougl Note Added: 0005918
2015-03-22 18:02 Dougl Note Added: 0005919
2015-03-22 19:07 shoogen OS Version 13.04 => 14.04
2015-03-22 19:07 shoogen Product Version 0.14 => 0.15
2015-03-23 00:06 tanderson69 Note Added: 0005921
2015-03-23 00:17 Dougl Note Added: 0005923
2015-03-23 01:12 tanderson69 Relationship added related to 0001659
2015-03-23 03:53 Dougl Note Added: 0005924
2015-03-23 05:04 tanderson69 Note Added: 0005925
2015-03-23 06:00 Dougl Note Added: 0005926
2015-03-23 13:53 tanderson69 Relationship added related to 0001970
2015-03-23 14:15 tanderson69 Note Added: 0005929
2015-03-23 14:38 tanderson69 Note Edited: 0005929
2015-03-23 18:45 wmayer Note Added: 0005934
2015-03-23 18:49 tanderson69 Note Added: 0005935
2015-03-24 14:53 Dougl Note Added: 0005939
2015-03-26 18:45 wmayer Changeset attached => FreeCAD Master master 70a1124a
2015-03-26 18:46 wmayer Status new => closed
2015-03-26 18:46 wmayer Assigned To => wmayer
2015-03-26 18:46 wmayer Resolution open => fixed
2015-03-26 18:46 wmayer Fixed in Version => 0.15