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
This commit is contained in:
Carlos Garnacho 2015-09-14 15:35:13 +02:00
parent da0aac665f
commit b18542f2b6
2 changed files with 7 additions and 0 deletions

View File

@ -912,6 +912,12 @@ meta_wayland_data_device_set_keyboard_focus (MetaWaylandDataDevice *data_device)
MetaWaylandDataSource *source; MetaWaylandDataSource *source;
focus_client = meta_wayland_keyboard_get_focus_client (&seat->keyboard); 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) if (!focus_client)
return; return;

View File

@ -55,6 +55,7 @@ struct _MetaWaylandDataDevice
struct wl_listener selection_data_source_listener; struct wl_listener selection_data_source_listener;
struct wl_list resource_list; struct wl_list resource_list;
MetaWaylandDragGrab *current_grab; MetaWaylandDragGrab *current_grab;
struct wl_client *focus_client;
struct wl_signal selection_ownership_signal; struct wl_signal selection_ownership_signal;
struct wl_signal dnd_ownership_signal; struct wl_signal dnd_ownership_signal;