gdk/wayland: Unset clipboard/primary if giving up selection ownership
If gdk_selection_owner_set() is called with a NULL window, we should unset the related data source for the current selection.
This commit is contained in:
@ -5323,18 +5323,15 @@ gdk_wayland_device_get_data_device (GdkDevice *gdk_device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gdk_wayland_device_set_selection (GdkDevice *gdk_device,
|
gdk_wayland_seat_set_selection (GdkSeat *seat,
|
||||||
struct wl_data_source *source)
|
struct wl_data_source *source)
|
||||||
{
|
{
|
||||||
GdkWaylandSeat *seat;
|
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
|
||||||
GdkWaylandDisplay *display_wayland;
|
GdkWaylandDisplay *display_wayland;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device));
|
display_wayland = GDK_WAYLAND_DISPLAY (wayland_seat->display);
|
||||||
|
|
||||||
seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (gdk_device));
|
wl_data_device_set_selection (wayland_seat->data_device, source,
|
||||||
display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
|
||||||
|
|
||||||
wl_data_device_set_selection (seat->data_device, source,
|
|
||||||
_gdk_wayland_display_get_serial (display_wayland));
|
_gdk_wayland_display_get_serial (display_wayland));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -188,8 +188,8 @@ uint32_t _gdk_wayland_device_get_implicit_grab_serial(GdkWaylandDevice *device,
|
|||||||
uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkSeat *seat,
|
uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkSeat *seat,
|
||||||
GdkEventSequence **seqence);
|
GdkEventSequence **seqence);
|
||||||
struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_device);
|
struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_device);
|
||||||
void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
|
void gdk_wayland_seat_set_selection (GdkSeat *seat,
|
||||||
struct wl_data_source *source);
|
struct wl_data_source *source);
|
||||||
|
|
||||||
void gdk_wayland_seat_set_primary (GdkSeat *seat,
|
void gdk_wayland_seat_set_primary (GdkSeat *seat,
|
||||||
struct gtk_primary_selection_source *source);
|
struct gtk_primary_selection_source *source);
|
||||||
|
|||||||
@ -1140,11 +1140,9 @@ gdk_wayland_selection_unset_data_source (GdkDisplay *display,
|
|||||||
|
|
||||||
if (selection == atoms[ATOM_CLIPBOARD])
|
if (selection == atoms[ATOM_CLIPBOARD])
|
||||||
{
|
{
|
||||||
GdkDevice *device;
|
GdkSeat *seat = gdk_display_get_default_seat (display);
|
||||||
|
|
||||||
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
gdk_wayland_seat_set_selection (seat, NULL);
|
||||||
|
|
||||||
gdk_wayland_device_set_selection (device, NULL);
|
|
||||||
|
|
||||||
if (wayland_selection->clipboard_source)
|
if (wayland_selection->clipboard_source)
|
||||||
{
|
{
|
||||||
@ -1198,11 +1196,15 @@ _gdk_wayland_display_set_selection_owner (GdkDisplay *display,
|
|||||||
if (selection == atoms[ATOM_CLIPBOARD])
|
if (selection == atoms[ATOM_CLIPBOARD])
|
||||||
{
|
{
|
||||||
wayland_selection->clipboard_owner = owner;
|
wayland_selection->clipboard_owner = owner;
|
||||||
|
if (send_event && !owner)
|
||||||
|
gdk_wayland_selection_unset_data_source (display, selection);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (selection == atoms[ATOM_PRIMARY])
|
else if (selection == atoms[ATOM_PRIMARY])
|
||||||
{
|
{
|
||||||
wayland_selection->primary_owner = owner;
|
wayland_selection->primary_owner = owner;
|
||||||
|
if (send_event && !owner)
|
||||||
|
gdk_wayland_selection_unset_data_source (display, selection);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (selection == atoms[ATOM_DND])
|
else if (selection == atoms[ATOM_DND])
|
||||||
@ -1551,12 +1553,10 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
|
|||||||
|
|
||||||
if (selection == atoms[ATOM_CLIPBOARD])
|
if (selection == atoms[ATOM_CLIPBOARD])
|
||||||
{
|
{
|
||||||
GdkDisplay *display;
|
GdkSeat *seat;
|
||||||
GdkDevice *device;
|
|
||||||
|
|
||||||
display = gdk_window_get_display (window);
|
seat = gdk_display_get_default_seat (display);
|
||||||
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
gdk_wayland_seat_set_selection (seat, data_source);
|
||||||
gdk_wayland_device_set_selection (device, data_source);
|
|
||||||
}
|
}
|
||||||
else if (selection == atoms[ATOM_PRIMARY])
|
else if (selection == atoms[ATOM_PRIMARY])
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user