gdk/wayland: Use serial of the latest implicit grab available
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 19 Oct 2022 10:46:09 +0000 (12:46 +0200)
committerMat <mail@mathias.is>
Sat, 12 Nov 2022 02:14:47 +0000 (04:14 +0200)
When getting the serial for primary/clipboard selections we used a
function that largely relied on a GdkEvent being passed. We have
another available function that looks up the most recent serial
given the ongoing touch/tablet input as well.

This is the second best, compared to actually knowing the
input/device from the event that was received by the UI an triggered
the clipboard operation, and is already in use in other places
(e.g. window dragging). It is valid for these situations too.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5250
gdk/wayland/gdkdevice-wayland.c
gdk/wayland/gdkprimary-wayland.c

index f00580fa76c8d16d336d1d29c577b710870d65d5..d4e12f0fae0c4662754ea4534a66cd90d96e660d 100644 (file)
@@ -5328,7 +5328,7 @@ gdk_wayland_device_set_selection (GdkDevice             *gdk_device,
   g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device));
 
   seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (gdk_device));
-  serial = _gdk_wayland_seat_get_implicit_grab_serial (GDK_SEAT (seat), NULL);
+  serial = _gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL);
   wl_data_device_set_selection (seat->data_device, source, serial);
 }
 
index 6cef2f3968d05cac04f1951b1516d41694f1d9ea..b501deb66beaaf0f4e05ffac155a49d889d9ad05 100644 (file)
@@ -292,7 +292,8 @@ gdk_wayland_primary_claim (GdkClipboard       *clipboard,
         }
 
       seat = gdk_display_get_default_seat (GDK_DISPLAY (wdisplay));
-      serial = _gdk_wayland_seat_get_implicit_grab_serial (seat, NULL);
+      serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (seat),
+                                                                NULL);
       zwp_primary_selection_device_v1_set_selection (cb->primary_data_device,
                                                      cb->source,
                                                      serial);