[mutter/wip/dnd-actions: 141/144] wayland: Avoid resending new data offers on intra-client focus changes



commit 832c710c813f2712be8fdce5c94d50b3e9f93506
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
    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

 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)
     return;
 
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]