Merge branch 'wip/carlosg/avoid-selection-clear' into 'gtk-3-24'

Avoid clearing selection on wl_data_source.cancelled

See merge request GNOME/gtk!1142
This commit is contained in:
Matthias Clasen
2019-10-22 05:29:10 +00:00

View File

@ -937,7 +937,6 @@ data_source_cancelled (void *data,
gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR); gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
emit_selection_clear (display, atom); emit_selection_clear (display, atom);
gdk_selection_owner_set (NULL, atom, GDK_CURRENT_TIME, TRUE);
gdk_wayland_selection_unset_data_source (display, atom); gdk_wayland_selection_unset_data_source (display, atom);
} }
@ -1048,7 +1047,6 @@ primary_source_cancelled (void *data,
atom = atoms[ATOM_PRIMARY]; atom = atoms[ATOM_PRIMARY];
emit_selection_clear (display, atom); emit_selection_clear (display, atom);
gdk_selection_owner_set (NULL, atom, GDK_CURRENT_TIME, TRUE);
gdk_wayland_selection_unset_data_source (display, atom); gdk_wayland_selection_unset_data_source (display, atom);
} }
@ -1140,10 +1138,6 @@ gdk_wayland_selection_unset_data_source (GdkDisplay *display,
if (selection == atoms[ATOM_CLIPBOARD]) if (selection == atoms[ATOM_CLIPBOARD])
{ {
GdkSeat *seat = gdk_display_get_default_seat (display);
gdk_wayland_seat_set_selection (seat, NULL);
if (wayland_selection->clipboard_source) if (wayland_selection->clipboard_source)
{ {
wl_data_source_destroy (wayland_selection->clipboard_source); wl_data_source_destroy (wayland_selection->clipboard_source);
@ -1152,10 +1146,6 @@ gdk_wayland_selection_unset_data_source (GdkDisplay *display,
} }
else if (selection == atoms[ATOM_PRIMARY]) else if (selection == atoms[ATOM_PRIMARY])
{ {
GdkSeat *seat = gdk_display_get_default_seat (display);
gdk_wayland_seat_set_primary (seat, NULL);
if (wayland_selection->primary_source) if (wayland_selection->primary_source)
{ {
gtk_primary_selection_source_destroy (wayland_selection->primary_source); gtk_primary_selection_source_destroy (wayland_selection->primary_source);
@ -1192,19 +1182,26 @@ _gdk_wayland_display_set_selection_owner (GdkDisplay *display,
gboolean send_event) gboolean send_event)
{ {
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
GdkSeat *seat = gdk_display_get_default_seat (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) if (send_event && !owner)
{
gdk_wayland_seat_set_selection (seat, NULL);
gdk_wayland_selection_unset_data_source (display, selection); 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) if (send_event && !owner)
{
gdk_wayland_seat_set_primary (seat, NULL);
gdk_wayland_selection_unset_data_source (display, selection); gdk_wayland_selection_unset_data_source (display, selection);
}
return TRUE; return TRUE;
} }
else if (selection == atoms[ATOM_DND]) else if (selection == atoms[ATOM_DND])