From 92e317ec2af03723cf840e1a572a83f5fb8e8cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 17 Mar 2011 17:28:48 +0100 Subject: [PATCH] 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 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/constraints.c b/src/core/constraints.c index dbdf840f5..0d4a94fed 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