[mutter] display: Fix the logic for moving attached dialogs



commit 12fc394b92178377f936bb58e444e7ac1a7e34a3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jun 11 16:36:17 2014 -0400

    display: Fix the logic for moving attached dialogs
    
    If we have a tree of a window, a non-attached dialog, and then an
    attached dialog, we want to move the second window, not the attached
    dialog or the topmost. In other words, we want to move the first
    non-attached window, or the first "freefloating window".
    
    This happens in Firefox, whose Preferences dialog is freefloating,
    but suboptions of those are modal dialogs.

 src/core/display.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index a7db76e..c185762 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1696,15 +1696,15 @@ meta_display_update_cursor (MetaDisplay *display)
 }
 
 static MetaWindow *
-get_toplevel_transient_for (MetaWindow *window)
+get_first_freefloating_window (MetaWindow *window)
 {
-  while (TRUE)
-    {
-      MetaWindow *parent = meta_window_get_transient_for (window);
-      if (parent == NULL)
-        return window;
-      window = parent;
-    }
+  while (meta_window_is_attached_dialog (window))
+    window = meta_window_get_transient_for (window);
+
+  /* Attached dialogs should always have a non-NULL transient-for */
+  g_assert (window != NULL);
+
+  return window;
 }
 
 gboolean
@@ -1752,11 +1752,11 @@ 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 we're trying to move a window, move the first
+   * non-attached dialog instead.
    */
-  if (meta_window_is_attached_dialog (window) && meta_grab_op_is_moving (op))
-    grab_window = get_toplevel_transient_for (window);
+  if (meta_grab_op_is_moving (op))
+    grab_window = get_first_freefloating_window (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]