Filter LeaveNotify based on window under pointer

Instead of ignoring all `NonlinearVirtual` events. This lets us release
focus when instantly moving the mouse from a plugin GUI to something
else. This generates `NonlinearVirtual` event, and previously we ignored
those because that also happens when opening a dropdown menu in a TDR
plugin (which uses popup windows instead of actual dropdowns).
This commit is contained in:
Robbert van der Helm
2021-07-27 18:05:47 +02:00
parent e42448f758
commit d053eab35a
3 changed files with 107 additions and 13 deletions
+12
View File
@@ -262,6 +262,18 @@ class Editor {
const bool use_xembed;
private:
/**
* Get the current cursor position, in Win32 screen coordinates. This is
* needed for our `LeaveNotify` handling because `GetCursorPos()` only
* updates once every 100 ms. This takes the X11 mouse cursor position, and
* then adds to that the difference between `wine_window`'s X11 coordinates
* and its Win32 coordinates. This is kind of a workaround for Wine's
* X11drv's `root_to_virtual_screen()` function not being exposed.
*
* If we cannot obtain the X11 cursor position, then this returns a nullopt.
*/
std::optional<POINT> get_current_pointer_position() const;
/**
* Returns `true` if the currently active window (as per
* `_NET_ACTIVE_WINDOW`) contains `wine_window`. If the window manager does