Skip to content

Commit

Permalink
Center attached dialogs on the parent window instead of the parents t…
Browse files Browse the repository at this point in the history
…itlebar.
  • Loading branch information
JosephMcc committed Sep 15, 2015
1 parent b344d32 commit 8039c78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/compositor/meta-shadow-factory.c
Expand Up @@ -137,7 +137,7 @@ static MetaShadowClassInfo default_shadow_classes[] = {
{ "popup-menu", { 1, -1, 0, 1, 128 }, { 1, -1, 0, 1, 128 } },

{ "dropdown-menu", { 1, 10, 0, 1, 128 }, { 1, 10, 0, 1, 128 } },
{ "attached", { 2, 50, 0, 1, 255 }, { 1, 50, 0, 1, 128 } }
{ "attached", { 6, -1, 0, 1, 255 }, { 3, -1, 0, 3, 128 } }
};

G_DEFINE_TYPE (MetaShadowFactory, meta_shadow_factory, G_TYPE_OBJECT);
Expand Down
9 changes: 1 addition & 8 deletions src/core/constraints.c
Expand Up @@ -829,21 +829,14 @@ constrain_modal_dialog (MetaWindow *window,
return TRUE;

x = parent->rect.x + (parent->rect.width / 2 - info->current.width / 2);
y = 0;
y = parent->rect.y + (parent->rect.height / 2 - info->current.height / 2);
if (parent->frame)
{
MetaFrameBorders borders;

x += parent->frame->rect.x;
y += parent->frame->rect.y;

meta_frame_calc_borders (parent->frame, &borders);
y += borders.total.top;

y += info->borders->visible.top;
}
else
y = parent->rect.y + info->borders->visible.top;

constraint_already_satisfied = (x == info->current.x) && (y == info->current.y);

Expand Down
9 changes: 6 additions & 3 deletions src/core/window.c
Expand Up @@ -9511,12 +9511,15 @@ update_resize (MetaWindow *window,
dx = x - window->display->grab_anchor_root_x;
dy = y - window->display->grab_anchor_root_y;

/* Attached modal dialogs are special in that horizontal
* size changes apply to both sides, so that the dialog
/* Attached modal dialogs are special in that size
* changes apply to both sides, so that the dialog
* remains centered to the parent.
*/
if (meta_window_is_attached_dialog (window))
dx *= 2;
{
dx *= 2;
dy *= 2;
}

new_w = window->display->grab_anchor_window_pos.width;
new_h = window->display->grab_anchor_window_pos.height;
Expand Down

0 comments on commit 8039c78

Please sign in to comment.