[mutter] display: Make sure to retrieve the toplevel transient for



commit 6e8d1d79d18f584d13b5ddb138dc1fdbadfad9ee
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 28 17:23:20 2014 -0400

    display: Make sure to retrieve the toplevel transient for
    
    If we have multiple modal stacked dialogs, move the top one, not
    the immediate parent, which heavily confuses mutter.

 src/core/display.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 21c444a..8b3297b 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1715,6 +1715,18 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
     display->grab_have_pointer = TRUE;
 }
 
+static MetaWindow *
+get_toplevel_transient_for (MetaWindow *window)
+{
+  while (TRUE)
+    {
+      MetaWindow *parent = meta_window_get_transient_for (window);
+      if (parent == NULL)
+        return window;
+      window = parent;
+    }
+}
+
 gboolean
 meta_display_begin_grab_op (MetaDisplay *display,
                            MetaScreen  *screen,
@@ -1757,15 +1769,13 @@ meta_display_begin_grab_op (MetaDisplay *display,
         }
     }
 
+  grab_window = window;
+
   /* If window is a modal dialog attached to its parent,
    * grab the parent instead for moving.
    */
-  if (window && meta_window_is_attached_dialog (window) &&
-      meta_grab_op_is_moving (op))
-    grab_window = meta_window_get_transient_for (window);
-
-  if (grab_window == NULL)
-    grab_window = window;
+  if (meta_grab_op_is_moving (op))
+    grab_window = get_toplevel_transient_for (window);
 
   g_assert (grab_window != NULL);
   g_assert (op != META_GRAB_OP_NONE);


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