summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-09-14 15:35:13 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-10-02 12:21:17 +0200
commitb18542f2b6e2120b4a7bb4a961beb306c9e809f7 (patch)
treea902ade46d72e8cf85ca59289a358506fb6c01bd
parentda0aac665f9f18647af894e296586f3ff3fbc3fa (diff)
downloadmutter-b18542f2b6e2120b4a7bb4a961beb306c9e809f7.tar.gz
wayland: Avoid resending new data offers on intra-client focus changes
Each keyboard focus change ends up calling the MetaWaylandDataDevice counterpart, we don't need though to notify the current selection again. In order to fix this, keep track of the current client, and only emit the relevant signals when the focus switches to another client. The situations where wl_data_device.selection were emitted during focus changes between surfaces of the same client was inocuous most of the times, although it's prone to inducing confusing behavior on context menu clipboard actions, as the closing menu triggers a focus change, which triggers a whole new wl_data_offer being created and given on wl_data_device.selection, at a time where there's already ongoing requests on the previous data offer. https://bugzilla.gnome.org/show_bug.cgi?id=754357
-rw-r--r--src/wayland/meta-wayland-data-device.c6
-rw-r--r--src/wayland/meta-wayland-data-device.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index ae0fcf5eb..3d606902b 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -912,6 +912,12 @@ meta_wayland_data_device_set_keyboard_focus (MetaWaylandDataDevice *data_device)
MetaWaylandDataSource *source;
focus_client = meta_wayland_keyboard_get_focus_client (&seat->keyboard);
+
+ if (focus_client == data_device->focus_client)
+ return;
+
+ data_device->focus_client = focus_client;
+
if (!focus_client)
return;
diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h
index 33fadf2e1..483b08b2a 100644
--- a/src/wayland/meta-wayland-data-device.h
+++ b/src/wayland/meta-wayland-data-device.h
@@ -55,6 +55,7 @@ struct _MetaWaylandDataDevice
struct wl_listener selection_data_source_listener;
struct wl_list resource_list;
MetaWaylandDragGrab *current_grab;
+ struct wl_client *focus_client;
struct wl_signal selection_ownership_signal;
struct wl_signal dnd_ownership_signal;