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



commit 28698a5344ce71eac28ee29d6c198bd67a4fd3a2
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 |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index b11cecc..94b469d 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -3259,15 +3259,15 @@ meta_display_set_grab_op_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
@@ -3322,12 +3322,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 (window && 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);
 
   /* FIXME:
    *   If we have no MetaWindow we do our best


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