If the saved position for a fullscreen or maximized output view is in an
output that has been unplugged, the coordinates don't make sense
anymore. In that case, invalidate them and use the initial position
algorithm when changing them back to the basic state.
Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
The surface type now no longer changes and we track pending state changes in
next_state. Instead of testing type != next_type to detect changes in
state, we just look at state_changed.
An xwayland surface corresponds to a override-redirect window under X,
which is typically a menu or a popup window. They typically appear
with a keyboard and mouse grab and by nature of being override-redirect
these window can appear anywhere on screen and in the stack.
We need to resort to heuristics to decide where to place the
override-redirect in our surface stack, and for now we'll just put it on
top of everything. That's going to be correct for almost all cases of
clicking to open a menu, but we can revisit and refine if we run into
a case that needs better handling.
Just as for set_maximized() we can move the setting of the fullscreen and
state_changed flags into the common set_fullscreen() function. This
function is also used from the xwayland wm to set fullscreen windows, and
with this change that now works again.
We can set the maximized and state_changed flags in set_maximized(),
which is shared between shell_surface_set_maximized() and
xdg_surface_set_maximized().
Since internally there's no more SHELL_SURFACE_FULLSCREEN and
SHELL_SURFACE_MAXIMIZED, the surface must be set to
SHELL_SURFACE_TOPLEVEL on the respective functions.
This fixes the bug when clients start already in fullscreen mode. In
that case, they aren't set first to toplevel, and then change to
fullscreen. They are set as fullscreen directly, not receiving the
SHELL_SURFACE_TOPLEVEL type on the set_fullscreen function.