diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2019-10-21 20:19:06 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2019-10-21 20:41:09 +0200 |
commit | 299902b008c3b453596679f249eec28bfc6c026a (patch) | |
tree | 5818b9d69a408e9b971fb93b8a2baf4bc1cc7d91 | |
parent | da90d37b42e1c5f2ca5a7a010cdd2a791c39b303 (diff) | |
download | gtk+-299902b008c3b453596679f249eec28bfc6c026a.tar.gz |
gdk: Shuffle the situations where a selection is unset
This should only be explicitly unset (face to the windowing) on
gdk_selection_owner_set() with a NULL window. Other circumstances
(eg. selection being taken over by another client) should just
trigger the SelectionClear event in GDK internally.
Related: https://gitlab.gnome.org/GNOME/mutter/issues/878
-rw-r--r-- | gdk/wayland/gdkselection-wayland.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c index cb799e53e0..9494489d69 100644 --- a/gdk/wayland/gdkselection-wayland.c +++ b/gdk/wayland/gdkselection-wayland.c @@ -1140,10 +1140,6 @@ gdk_wayland_selection_unset_data_source (GdkDisplay *display, 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) { wl_data_source_destroy (wayland_selection->clipboard_source); @@ -1152,10 +1148,6 @@ gdk_wayland_selection_unset_data_source (GdkDisplay *display, } 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) { gtk_primary_selection_source_destroy (wayland_selection->primary_source); @@ -1192,19 +1184,26 @@ _gdk_wayland_display_set_selection_owner (GdkDisplay *display, gboolean send_event) { GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); + GdkSeat *seat = gdk_display_get_default_seat (display); if (selection == atoms[ATOM_CLIPBOARD]) { wayland_selection->clipboard_owner = owner; if (send_event && !owner) - gdk_wayland_selection_unset_data_source (display, selection); + { + gdk_wayland_seat_set_selection (seat, NULL); + gdk_wayland_selection_unset_data_source (display, selection); + } return TRUE; } else if (selection == atoms[ATOM_PRIMARY]) { wayland_selection->primary_owner = owner; if (send_event && !owner) - gdk_wayland_selection_unset_data_source (display, selection); + { + gdk_wayland_seat_set_primary (seat, NULL); + gdk_wayland_selection_unset_data_source (display, selection); + } return TRUE; } else if (selection == atoms[ATOM_DND]) |