wayland: place window if maximized before placement

If a client changes the state of a surface to issue a set_maximize, this
causes apply_pending_state() to be called before mutter has placed the
window.

If the monitor on which the window is to be shown initially is different
from the one where the pointer is placed, this causes the effect to be
played at the wrong location before the window eventually reaches its
location on another monitor.

Force the window to be placed prior to change its state to maximized in
xdg-shell so that mutter won't relocate the window afterwards.

This also avoids sending an xdg_toplevel.configure with a size of 0x0
which would cause the client to initially draw its surface with some
arbitrary size.

https://bugzilla.gnome.org/show_bug.cgi?id=782183
https://bugzilla.gnome.org/show_bug.cgi?id=781353
This commit is contained in:
Olivier Fourdan 2017-05-10 11:32:29 +02:00
parent 1b4cd1b47d
commit 7801df7ef6

View File

@ -348,6 +348,7 @@ xdg_toplevel_set_maximized (struct wl_client *client,
{ {
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource); MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
meta_window_force_placement (surface->window);
meta_window_maximize (surface->window, META_MAXIMIZE_BOTH); meta_window_maximize (surface->window, META_MAXIMIZE_BOTH);
} }