[metacity] Adjust the position of attached dialogs to fit on-screen



commit 447d38ec8150d643d7bd4dfa6d6ebb136ec37695
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Mar 17 17:28:48 2011 +0100

    Adjust the position of attached dialogs to fit on-screen
    
    As the position of attached modal dialogs is determined entirely
    by the position of the parent window, the dialog may end up
    partially off-screen (especially if the dialog is wider than the
    parent). In this case, diverge from the calculated position and
    try to fit the dialog on-screen.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=631308

 src/core/constraints.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/core/constraints.c b/src/core/constraints.c
index f5bb0e3..0e8aba4 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -142,6 +142,11 @@ typedef struct
   GList  *usable_xinerama_region;
 } ConstraintInfo;
 
+static gboolean do_screen_and_xinerama_relative_constraints (MetaWindow     *window,
+                                                             GList          *region_spanning_rectangles,
+                                                             ConstraintInfo *info,
+                                                             gboolean        check_only);
+
 static gboolean constrain_modal_dialog       (MetaWindow         *window,
                                               ConstraintInfo     *info,
                                               ConstraintPriority  priority,
@@ -848,7 +853,13 @@ constrain_modal_dialog (MetaWindow         *window,
 
   info->current.y = y;
   info->current.x = x;
-  return TRUE;
+
+  /* The calculated position above may need adjustment to make sure the
+   * dialog does not end up partially off-screen */
+  return do_screen_and_xinerama_relative_constraints (window,
+                                                      info->usable_screen_region,
+                                                      info,
+                                                      check_only);
 }
 
 static gboolean


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