wayland: Force an initial focus in meta_wayland_drag_grab_set_focus()

We want some initial processing, even if the current focus didn't change.
This could be for example the case of starting DnD too close to the window
edge and out of it. At the point start_drag() is called, the current
pointer focus is already NULL, so set_focus() would simply bail out here.

https://bugzilla.gnome.org/show_bug.cgi?id=762104
This commit is contained in:
Carlos Garnacho 2016-03-09 16:49:02 +01:00
parent 82153ff23f
commit 51e4491a9f

View File

@ -696,6 +696,8 @@ struct _MetaWaylandDragGrab {
int drag_start_x, drag_start_y;
ClutterModifierType buttons;
guint need_initial_focus : 1;
};
static void
@ -733,9 +735,12 @@ meta_wayland_drag_grab_set_focus (MetaWaylandDragGrab *drag_grab,
struct wl_client *client;
struct wl_resource *data_device_resource, *offer = NULL;
if (drag_grab->drag_focus == surface)
if (!drag_grab->need_initial_focus &&
drag_grab->drag_focus == surface)
return;
drag_grab->need_initial_focus = FALSE;
if (drag_grab->drag_focus)
{
meta_wayland_surface_drag_dest_focus_out (drag_grab->drag_focus);
@ -1005,6 +1010,8 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
drag_grab->drag_start_x = surface_pos.x;
drag_grab->drag_start_y = surface_pos.y;
drag_grab->need_initial_focus = TRUE;
modifiers = clutter_input_device_get_modifier_state (seat->pointer.device);
drag_grab->buttons = modifiers &
(CLUTTER_BUTTON1_MASK | CLUTTER_BUTTON2_MASK | CLUTTER_BUTTON3_MASK |