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



commit 92e317ec2af03723cf840e1a572a83f5fb8e8cf0
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 |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/core/constraints.c b/src/core/constraints.c
index dbdf840..0d4a94f 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -142,6 +142,11 @@ typedef struct
   GList  *usable_screen_region;
   GList  *usable_monitor_region;
 } ConstraintInfo;
+
+static gboolean do_screen_and_monitor_relative_constraints (MetaWindow     *window,
+                                                            GList          *region_spanning_rectangles,
+                                                            ConstraintInfo *info,
+                                                            gboolean        check_only);
 static gboolean constrain_modal_dialog       (MetaWindow         *window,
                                               ConstraintInfo     *info,
                                               ConstraintPriority  priority,
@@ -776,7 +781,12 @@ 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_monitor_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]