forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
eb0b98d5f2
commit
5a34b7ecc6
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user