diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2022-07-18 12:46:11 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2022-07-18 13:01:27 +0200 |
commit | 5a34b7ecc6b22c7b1145a77629fd0d6ab6197a8f (patch) | |
tree | 502e72aee451626b63c28a7cfada2804c89679f9 /gdk | |
parent | eb0b98d5f2ac551c847981e893b7f2f0ac8cf612 (diff) | |
download | gtk+-5a34b7ecc6b22c7b1145a77629fd0d6ab6197a8f.tar.gz |
gdk/wayland: Use last press serial for clipboard/primary selections
This serial observes key and button presses, we can use that instead
of relying on the last serial which might come from other
events/devices.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/wayland/gdkdevice-wayland.c | 8 | ||||
-rw-r--r-- | gdk/wayland/gdkprimary-wayland.c | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 2d192f8550..04bf0aa216 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -5305,15 +5305,13 @@ gdk_wayland_device_set_selection (GdkDevice *gdk_device, struct wl_data_source *source) { GdkWaylandSeat *seat; - GdkWaylandDisplay *display_wayland; + guint32 serial; g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device)); seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (gdk_device)); - display_wayland = GDK_WAYLAND_DISPLAY (seat->display); - - wl_data_device_set_selection (seat->data_device, source, - _gdk_wayland_display_get_serial (display_wayland)); + serial = _gdk_wayland_seat_get_implicit_grab_serial (GDK_SEAT (seat), NULL); + wl_data_device_set_selection (seat->data_device, source, serial); } /** diff --git a/gdk/wayland/gdkprimary-wayland.c b/gdk/wayland/gdkprimary-wayland.c index b8e0ff40fd..7aa702bef8 100644 --- a/gdk/wayland/gdkprimary-wayland.c +++ b/gdk/wayland/gdkprimary-wayland.c @@ -263,6 +263,8 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard, GdkWaylandDisplay *wdisplay = GDK_WAYLAND_DISPLAY (gdk_clipboard_get_display (clipboard)); const char * const *mime_types; gsize i, n_mime_types; + GdkSeat *seat; + guint32 serial; gdk_wayland_primary_discard_offer (cb); gdk_wayland_primary_discard_source (cb); @@ -276,9 +278,11 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard, zwp_primary_selection_source_v1_offer (cb->source, mime_types[i]); } + seat = gdk_display_get_default_seat (GDK_DISPLAY (wdisplay)); + serial = _gdk_wayland_seat_get_implicit_grab_serial (seat, NULL); zwp_primary_selection_device_v1_set_selection (cb->primary_data_device, cb->source, - _gdk_wayland_display_get_serial (wdisplay)); + serial); } return GDK_CLIPBOARD_CLASS (gdk_wayland_primary_parent_class)->claim (clipboard, formats, local, content); |