From d4be1717c23db7845d3344243cf3918cecb7b7ac Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 21 Jan 2022 17:18:18 +0100 Subject: [PATCH] Fixed window check Ignore mouse events not originating in session window --- client/X11/xf_input.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/client/X11/xf_input.c b/client/X11/xf_input.c index 9d310ede1..931df4467 100644 --- a/client/X11/xf_input.c +++ b/client/X11/xf_input.c @@ -50,7 +50,7 @@ #define MIN_FINGER_DIST 5 -static int xf_input_event(xfContext* xfc, XIDeviceEvent* event, int evtype); +static int xf_input_event(xfContext* xfc, const XEvent* xevent, XIDeviceEvent* event, int evtype); static const char* xf_input_get_class_string(int class) { @@ -429,7 +429,7 @@ static int xf_input_handle_event_local(xfContext* xfc, const XEvent* event) break; default: - xf_input_event(xfc, cookie.cc->data, cookie.cc->evtype); + xf_input_event(xfc, event, cookie.cc->data, cookie.cc->evtype); break; } } @@ -545,8 +545,21 @@ static int xf_input_touch_remote(xfContext* xfc, XIDeviceEvent* event, int evtyp return 0; } -int xf_input_event(xfContext* xfc, XIDeviceEvent* event, int evtype) +int xf_input_event(xfContext* xfc, const XEvent* xevent, XIDeviceEvent* event, int evtype) { + Window w; + + WINPR_ASSERT(xfc); + WINPR_ASSERT(xevent); + WINPR_ASSERT(event); + + w = xevent->xany.window; + if (w != xfc->window) + { + if (!xfc->remote_app) + return 0; + } + xf_input_show_cursor(xfc); switch (evtype) @@ -613,7 +626,7 @@ static int xf_input_handle_event_remote(xfContext* xfc, const XEvent* event) break; default: - xf_input_event(xfc, cookie.cc->data, cookie.cc->evtype); + xf_input_event(xfc, event, cookie.cc->data, cookie.cc->evtype); break; } }