Monitoring window coordinates is a poor man's way to figure if the application lose focus
bicobus opened this issue · comments
The eventFilter
method calls on_window_activate
and on_window_deactivate
if the window doesn't change coordinates, the idea being to trigger whether the application loose then regain main focus. Moving the window around would also deactivate the window, at least on Xorg based desktops, triggering the filter if there was none of those checks.
A better way around that behavior is to call on_window_deactivate
as callback using a QTimer
. If the application regain focus before the timer runs out, then the QTimer
must be cancelled. on_window_activate
would then only be called if the timer triggers the callback.
This method of tracking applications loss of focus should be a lot more obvious and clean.
Lines 874 to 904 in e3440af