[mutter] wayland: Force an initial focus in meta_wayland_drag_grab_set_focus()



commit 51e4491a9f3966958a9fe2367936ffa0d00c21d9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 9 16:49:02 2016 +0100

    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

 src/wayland/meta-wayland-data-device.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index da545fe..28b870e 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -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 |


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