[gtk/wip/carlosg/use-press-serial: 2/3] gdk/wayland: Use last press serial for clipboard/primary selections
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/carlosg/use-press-serial: 2/3] gdk/wayland: Use last press serial for clipboard/primary selections
- Date: Mon, 18 Jul 2022 11:03:38 +0000 (UTC)
commit 5a34b7ecc6b22c7b1145a77629fd0d6ab6197a8f
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jul 18 12:46:11 2022 +0200
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.
gdk/wayland/gdkdevice-wayland.c | 8 +++-----
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]