[mutter] wayland: Avoid resending new data offers on intra-client focus changes

commit b18542f2b6e2120b4a7bb4a961beb306c9e809f7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 14 15:35:13 2015 +0200

    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
    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.

 src/wayland/meta-wayland-data-device.c |    6 ++++++
 src/wayland/meta-wayland-data-device.h |    1 +
 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 ae0fcf5..3d60690 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)
diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h
index 33fadf2..483b08b 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;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]