summaryrefslogtreecommitdiff
path: root/src/core/display.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2017-08-14 06:31:10 -0400
committerMartin Wimpress <[email protected]>2017-08-14 11:31:10 +0100
commit680dca33ba526ae0d2dc333ac26a1c5872d86120 (patch)
treed03b3776818c3f2c5a6e26b01e36f11087575289 /src/core/display.c
parentd051953c1412ced4a140f7f4253c823bbe358165 (diff)
downloadmarco-680dca33ba526ae0d2dc333ac26a1c5872d86120.tar.bz2
marco-680dca33ba526ae0d2dc333ac26a1c5872d86120.tar.xz
Fix synthetic keybinding/button-grab window (#342)
* Determine focused window when processing synthetic events When a client is passively grabbing keybindings that it does not need, it sends them up for other clients to process. Often in this situation, the event contains the wrong window (either root, for global keybindings, or the original client itself). This means that Marco will attempt to process the event for the wrong window. This is not an issue for global keybindings within Marco, as the focused window does not matter. However, for shortcuts that operate directly on specific windows, the event gets lost. This change addresses this by determining what the currently-focused window is, regardless of which client forwarded the event. * Determine window under pointer when processing synthetic events When a client is passively grabbing mouse clicks that it does not need, it sends them up for other clients to process. Often in this situation, the event contains the wrong window (either root, for global keybindings, or the original client itself). This means that Marco will attempt to process the event for the wrong window. This change addresses this by determining what the current window under the mouse pointer is, regardless of which client forwarded the event. * Remove unused development data
Diffstat (limited to 'src/core/display.c')
-rw-r--r--src/core/display.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/display.c b/src/core/display.c
index 7b3ec502..e247ed33 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1779,6 +1779,20 @@ static gboolean event_callback(XEvent* event, gpointer data)
meta_display_process_key_event (display, window, event);
break;
case ButtonPress:
+ /* Use window under pointer when processing synthetic events from another client */
+ if (window == NULL && event->xbutton.send_event)
+ {
+ int x, y, root_x, root_y;
+ Window root, child;
+ guint mask;
+ XQueryPointer (display->xdisplay,
+ event->xany.window,
+ &root, &child,
+ &root_x, &root_y,
+ &x, &y,
+ &mask);
+ window = meta_display_lookup_x_window (display, child);
+ }
if ((window &&
grab_op_is_mouse (display->grab_op) &&
display->grab_button != (int) event->xbutton.button &&