From 1e47390edc2258a2aa1e7deccc3144dc5bf1370b Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 21 Jul 2021 22:53:15 +0200 Subject: [PATCH] Also listen for ConfigureNotify on the wrapper This is needed for Tracktion Waveform because they shift our wrapper window a bit downwards. Otherwise opening the window while your mouse cursor is already inside of it would trip up Wine's coordinates. --- src/wine-host/editor.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index a944b8db..8131578f 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -65,6 +65,17 @@ constexpr uint32_t parent_event_mask = host_event_mask | XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW; +/** + * The X11 event mask for our wrapper window. + * + * NOTE: The only reason we need this structure notify mask is because Tracktion + * Waveform offsets our window a bit vertically, so we need to catch that + * `ConfigureNotify` event or else the mouse clicks would be offset + * slightly when the mouse is already inside of the editor window when + * opening it. + */ +constexpr uint32_t wrapper_event_mask = XCB_EVENT_MASK_STRUCTURE_NOTIFY; + /** * The name of the X11 property on the root window used to denote the active * window in EWMH compliant window managers. @@ -381,6 +392,8 @@ Editor::Editor(MainContext& main_context, XCB_CW_EVENT_MASK, &host_event_mask); xcb_change_window_attributes(x11_connection.get(), parent_window, XCB_CW_EVENT_MASK, &parent_event_mask); + xcb_change_window_attributes(x11_connection.get(), wrapper_window.window, + XCB_CW_EVENT_MASK, &wrapper_event_mask); xcb_flush(x11_connection.get()); // First reparent our dumb wrapper window to the host's window, and then @@ -491,7 +504,8 @@ void Editor::handle_x11_events() noexcept { }); if (event->window == host_window || - event->window == parent_window) { + event->window == parent_window || + event->window == wrapper_window.window) { if (!use_xembed) { fix_local_coordinates(); }