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
This commit is contained in:
Florian Müllner 2011-03-17 17:28:48 +01:00
parent c5d1d2db62
commit 92e317ec2a

View File

@ -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