wayland: update location prior to maximize

When maximizing a window, the previous location is saved so that
un-maximize would restore the same original window location.

However, if a Wayland client starts with a window maximized, the
previous location will be 0x0, so if we have to force placement in
xdg_toplevel_set_maximized(), we should update the location as well so
that the window is placed on the right monitor when un-maximizing.

For that purpose, add a new flag to force the update of the window
location, and use that flag from xdg_toplevel_set_maximized().

https://bugzilla.gnome.org/show_bug.cgi?id=783901
This commit is contained in:
Olivier Fourdan
2017-06-21 13:30:22 +02:00
parent 6cf7d2d47f
commit 5f05112b9a
4 changed files with 27 additions and 9 deletions

View File

@@ -1713,7 +1713,7 @@ implement_showing (MetaWindow *window,
* see #751887
*/
if (!window->placed && client_window_should_be_mapped (window))
meta_window_force_placement (window);
meta_window_force_placement (window, FALSE);
meta_window_hide (window);
}
@@ -2294,8 +2294,11 @@ window_would_be_covered (const MetaWindow *newbie)
}
void
meta_window_force_placement (MetaWindow *window)
meta_window_force_placement (MetaWindow *window,
gboolean force_move)
{
MetaMoveResizeFlags flags;
if (window->placed)
return;
@@ -2308,7 +2311,15 @@ meta_window_force_placement (MetaWindow *window)
* show the window.
*/
window->calc_placement = TRUE;
meta_window_move_resize_now (window);
flags = META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION;
if (force_move)
flags |= META_MOVE_RESIZE_FORCE_MOVE;
meta_window_move_resize_internal (window,
flags,
NorthWestGravity,
window->unconstrained_rect);
window->calc_placement = FALSE;
/* don't ever do the initial position constraint thing again.
@@ -2387,7 +2398,7 @@ meta_window_show (MetaWindow *window)
window->maximize_vertically_after_placement = TRUE;
}
}
meta_window_force_placement (window);
meta_window_force_placement (window, FALSE);
}
if (needs_stacking_adjustment)