diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2017-05-28 15:56:17 +0200 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-09-25 15:34:10 -0400 |
commit | 420f77a1ba8bfbbf8c06f6dd57e9ee36124b7360 (patch) | |
tree | c02276095a0cffc3284397d0382d0a3233ff860f | |
parent | 40edd409bfc527223dfae89c7f84fea0721dec49 (diff) |
xwayland: Allow pointer warp on root/None window
Of sorts, as we can't honor pointer warping across the whole root window
coordinates, peek the pointer focus in these cases.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit c217fcb4c4640ffd2fefee63c6fcd7ea5e64b942)
-rw-r--r-- | hw/xwayland/xwayland.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 97b5b58d7..33c784fd6 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -175,11 +175,31 @@ xwl_cursor_warped_to(DeviceIntPtr device, struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_seat *xwl_seat = device->public.devicePrivate; struct xwl_window *xwl_window; + WindowPtr focus; if (!xwl_seat) xwl_seat = xwl_screen_get_default_seat(xwl_screen); xwl_window = xwl_window_from_window(window); + if (!xwl_window && xwl_seat->focus_window) { + focus = xwl_seat->focus_window->window; + + /* Warps on non wl_surface backed Windows are only allowed + * as long as the pointer stays within the focus window. + */ + if (x >= focus->drawable.x && + y >= focus->drawable.y && + x < focus->drawable.x + focus->drawable.width && + y < focus->drawable.y + focus->drawable.height) { + if (!window) { + DebugF("Warp relative to pointer, assuming pointer focus\n"); + xwl_window = xwl_seat->focus_window; + } else if (window == screen->root) { + DebugF("Warp on root window, assuming pointer focus\n"); + xwl_window = xwl_seat->focus_window; + } + } + } if (!xwl_window) return; |