GNOME Bugzilla – Bug 760213
wayland: gdk_seat_grab() set cursor not resilient
Last modified: 2016-01-08 21:03:47 UTC
Created attachment 318319 [details] [review] Test to demonstrate the issue Summary: When one sets a cursor in gdk_seat_grab() and maps a popup window underneath the cursor, the cursor is shows for a very short time and reverted back to the default value. Steps to reproduce: 1. Apply attachment 318247 [details] [review] from bug 759738 2. Apply attachment to add the test with a grab tests/testpopupgrab.c 3. Build 4. run tests/testpopupgrab in Wayland 5. Click in the window Actual result: The pointer changes to a crosshair for a very short time and then revert to the default cursor Expected result: The cursor specified in the gdk_seat_grab() remains See also: bug 759738
Created attachment 318320 [details] [review] [PATCH] wayland: gdk_seat_grab() set a resilient cursor When a cursor is specified in gdk_seat_grab(), the cursor is reverted as soon as the pointer enter or leaves another window. To avoid this issue, keep the cursor unchanged when the wayland device has a pointer grab window.
Review of attachment 318320 [details] [review]: ::: gdk/wayland/gdkdevice-wayland.c @@ +2561,2 @@ wayland_seat->pointer_grab_window = NULL; + _gdk_display_set_window_under_pointer (display, wayland_seat->master_pointer, window); Calling set_window_under_pointer here seems wrong - the window may not be under the pointer at all at this point. And as Carlos points out, this should already be happening in switch_to_pointer_grab.
Created attachment 318485 [details] [review] [PATCH v2] wayland: Update parent of dialogs without transient (In reply to Matthias Clasen from comment #2) > Review of attachment 318320 [details] [review] [review]: > > ::: gdk/wayland/gdkdevice-wayland.c > @@ +2561,2 @@ > wayland_seat->pointer_grab_window = NULL; > + _gdk_display_set_window_under_pointer (display, > wayland_seat->master_pointer, window); > > Calling set_window_under_pointer here seems wrong - the window may not be > under the pointer at all at this point. Right, what we want is to update toe cursor to whatever is relevant for the window under the cursor. > And as Carlos points out, Not sure I followed here, where did Carlos pointed that out, was it on irc? > this should already be happening in switch_to_pointer_grab. Thing is, we "block" the cursor change while we have a grab, so we need to update the cursor again after the grab is released. Is it better to use gdk_wayland_device_update_window_cursor() for this purpose instead of _gdk_display_set_window_under_pointer() here? (updated patch)
Pushed the fix we agreed on on IRC. The following fix has been pushed: ad0fc8a wayland: Force the grab cursor while a grab is active
Created attachment 318548 [details] [review] wayland: Force the grab cursor while a grab is active When a cursor is specified in gdk_seat_grab(), the cursor is reverted as soon as the pointer enters or leaves another window. To avoid this issue, store the grab cursor separately, so we force-apply it in ::set_window_cursor(). Also, unset early the seat info from the window on gdk_seat_ungrab(), so the next time switch_to_pointer_grab() happens we end up picking the cursor set for the window underneath the pointer window. Based on a patch by Olivier Fourdan <ofourdan@redhat.com>.