[mutter/wayland] Fix dragging on move/resize grabs



commit 1f569bef761f2a8ff30c3308e28f32e706b96f81
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Nov 18 18:36:39 2013 -0500

    Fix dragging on move/resize grabs
    
    We need to use the grab_window for incoming events if we have an active grab.

 src/compositor/meta-window-actor.c |    4 +---
 src/core/display.c                 |   32 ++++++++++++--------------------
 2 files changed, 13 insertions(+), 23 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index ade870d..2a6314c 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -397,9 +397,7 @@ meta_window_actor_constructed (GObject *object)
         priv->actor = meta_shaped_texture_new_with_xwindow (xwindow);
 
       clutter_actor_add_child (CLUTTER_ACTOR (self), priv->actor);
-
-      if (meta_is_wayland_compositor ())
-        clutter_actor_set_reactive (priv->actor, TRUE);
+      clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
 
       /*
        * Since we are holding a pointer to this actor independently of the
diff --git a/src/core/display.c b/src/core/display.c
index 3d07c20..b54fd9d 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1690,27 +1690,17 @@ handle_net_restack_window (MetaDisplay* display,
 #endif
 
 static MetaWindow *
-get_window_for_actor (ClutterActor *actor,
-                      gboolean     *frame_was_receiver)
+get_window_for_event (MetaDisplay        *display,
+                      const ClutterEvent *event)
 {
-  /* Look for any ancestor that is a MetaWindowActor to determine
-     which window the actor's event belongs to */
+  ClutterActor *source;
 
-  *frame_was_receiver = TRUE;
-
-  while (actor)
-    {
-      if (META_IS_WINDOW_ACTOR (actor))
-        return meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor));
+  if (display->grab_window)
+    return display->grab_window;
 
-      /* If the frame is the receiver then the source will directly be
-         the MetaWindowActor, otherwise it will be a child of a
-         MetaWindowActor so if we make it here then the event isn't
-         referring to the frame. */
-      *frame_was_receiver = FALSE;
-
-      actor = clutter_actor_get_parent (actor);
-    }
+  source = clutter_event_get_source (event);
+  if (META_IS_WINDOW_ACTOR (source))
+    return meta_window_actor_get_meta_window (META_WINDOW_ACTOR (source));
 
   return NULL;
 }
@@ -2047,7 +2037,9 @@ meta_display_handle_event (MetaDisplay        *display,
                            const ClutterEvent *event)
 {
   MetaWindow *window;
-  gboolean frame_was_receiver;
+
+  /* XXX -- we need to fill this in properly at some point... */
+  gboolean frame_was_receiver = FALSE;
 #ifdef HAVE_WAYLAND
   MetaWaylandCompositor *compositor;
 
@@ -2058,7 +2050,7 @@ meta_display_handle_event (MetaDisplay        *display,
     }
 #endif  /* HAVE_WAYLAND */
 
-  window = get_window_for_actor (event->any.source, &frame_was_receiver);
+  window = get_window_for_event (display, event);
 
   display->current_time = event->any.time;
 


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