Ticket #4372 - SpaceBall rotation stops when focus leaves main display panel in v0.18/0.19

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Ticket #4372 - SpaceBall rotation stops when focus leaves main display panel in v0.18/0.19

Post by PrzemoF »

Anyone tried git bisect to find out when exactly the problems started? Any links with Qt/python version?

I just got my 3D mouse connected, maybe I can find what's the problem.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Ticket #4372 - SpaceBall rotation stops when focus leaves main display panel in v0.18/0.19

Post by PrzemoF »

I guess it's something with events filtering. I'm gone searching for the offending commit...
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Ticket #4372 - SpaceBall rotation stops when focus leaves main display panel in v0.18/0.19

Post by PrzemoF »

Problem confirmed on:
OS: Fedora 32 (Workstation Edition) (GNOME/gnome-xorg)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.pre_21832 (Git)
Build type: Unknown
Python version: 3.8.3
Qt version: 5.14.2
Coin version: 4.0.0a
OCC version: 7.4.0.beta
Locale: Polish/Poland (pl_PL)
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: SpaceBall rotation stops when focus leaves main display panel in v0.18

Post by PrzemoF »

DeepSOIC wrote: Mon May 13, 2019 1:02 pm Does it depend on what navigation style you pick?
No, doesn't. Also docking/undocking main view window doesn't make any difference.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Ticket #4372 - SpaceBall rotation stops when focus leaves main display panel in v0.18/0.19

Post by PrzemoF »

Timeline (git tags):
0.17 - Apr 6 2018 - spacenave works according to user reports
[1,2,3] - Oct 17-20 2018 - significant rework of spacenav handling, commits below
0.18 - Mar 11 2019 - spacenav only works with focus in the main view window

[1] commit 48b305cd75f320a8a9da82887c834b65840355eb
Date: Sat Oct 20 17:13:45 2018 +0200
The platform dependant stuff is in different files chosen by the build system. Building on Linux/Qt5 works without libspacenav, with the X11 interface and the polling interface. All run. Spacemouse works with the polling interface and should work with the X11 interface under a real X system.

[2] commit 2acb6996b807a1150672d403ed8f29a54d1ed25d
Date: Fri Oct 19 00:19:07 2018 +0200
Spacemouse platform dependent code is moved to different classes. Compiles and works for Linux

[3] commit b7fbbd97be290a790954ac9ba1fa6e18f6f6f71b
Date: Wed Oct 17 23:11:13 2018 +0200
X11 independant implementation for USB SpaceNavigator, works with Wayland

@tsadowski, can you check if spaceball works when focus is away from the main window? I use gnome/xorg right now, so maybe with wayland it works OK?
tsadowski
Posts: 36
Joined: Tue Jan 20, 2015 10:50 pm

Re: Ticket #4372 - SpaceBall rotation stops when focus leaves main display panel in v0.18/0.19

Post by tsadowski »

Hi,

I thought it would be easy but I must admit I am puzzled by the Qt event system. The function

Code: Select all

Gui::GUIApplicationNativeEventAware::postMotionEvent

is called on any Spaceball motion but only if the 3d view has focus the event is handled correctly.

This is a bit puzzling as the logic of passing the event up and down through the program was not (intentionally) changed but it might be different because there is no XCB event involved anymore, only Qt events. I will investigate this.

The easiest solution might be to set the receiver to the visible 3d view (if any).

Cheers,
Torsten
User avatar
tanderson69
Veteran
Posts: 1626
Joined: Thu Feb 18, 2010 1:07 am

Re: Ticket #4372 - SpaceBall rotation stops when focus leaves main display panel in v0.18/0.19

Post by tanderson69 »

tsadowski wrote: Mon Jul 06, 2020 8:05 pm The easiest solution might be to set the receiver to the visible 3d view (if any).
That already happens when the spaceball event 'climbs' the QWidget parent tree and ends up at the main window.
https://github.com/FreeCAD/FreeCAD/blob ... w.cpp#L801

Maybe there is an improperly parented qwidget and the event propagation is broken before the event can make it to the main window event handler? Maybe the mainwindow event handler fails in finding the widget to target?
tsadowski
Posts: 36
Joined: Tue Jan 20, 2015 10:50 pm

Re: Ticket #4372 - SpaceBall rotation stops when focus leaves main display panel in v0.18/0.19

Post by tsadowski »

Thank you, this was the right hint. The event ends up here and is sent to the wrong receiver:
https://github.com/FreeCAD/FreeCAD/blob ... w.cpp#L818

It works when the event is sent to "view" and not to "viewWidget". I will try to make a clean pull request.

Cheers,
Torsten
User avatar
M4x
Veteran
Posts: 1480
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: Ticket #4372 - SpaceBall rotation stops when focus leaves main display panel in v0.18/0.19

Post by M4x »

Awesome, I'm looking forward to it!
Post Reply