desktop-shell: Branch out the set_maxime/unset_full

And move it back to its place, as we can't differentiante between two
different states: coming back from unmaxized (which makes it so we send
out a widthXheight size matching that of maximized whereas we should send
out 0, 0) and that we're no longer fullscreen. We land basically in the
same spot in both cases, and trying one issue, creates a new one.

Moving the corner case in set_fullscreen makes it so we don't reach both
cases in the same time and avoid introducing other issues.

Fixes: #801

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2023-08-25 11:53:17 +03:00
parent b7fb70630a
commit b0b24ab375

View file

@ -263,22 +263,6 @@ set_shsurf_size_maximized_or_fullscreen(struct shell_surface *shsurf,
width = shsurf->output->width;
height = shsurf->output->height;
}
} else {
/* this is a corner case where we set up the surface as
* maximized, then fullscreen, and back to maximized.
*
* we land here here when we're back from fullscreen and we
* were previously maximized: rather than sending (0, 0) send
* the area of the output minus the panels */
if (shsurf->state.fullscreen) {
struct weston_desktop_surface *dsurface =
shsurf->desktop_surface;
if (weston_desktop_surface_get_maximized(dsurface) ||
weston_desktop_surface_get_pending_maximized(dsurface)) {
get_maximized_size(shsurf, &width, &height);
}
}
}
/* take the panels into considerations */
@ -2474,6 +2458,7 @@ set_fullscreen(struct shell_surface *shsurf, bool fullscreen,
struct weston_surface *surface =
weston_desktop_surface_get_surface(shsurf->desktop_surface);
weston_desktop_surface_set_fullscreen(desktop_surface, fullscreen);
if (fullscreen) {
/* handle clients launching in fullscreen */
if (output == NULL && !weston_surface_is_mapped(surface)) {
@ -2486,10 +2471,30 @@ set_fullscreen(struct shell_surface *shsurf, bool fullscreen,
weston_desktop_surface_set_orientation(shsurf->desktop_surface,
WESTON_TOP_LEVEL_TILED_ORIENTATION_NONE);
set_shsurf_size_maximized_or_fullscreen(shsurf, false, fullscreen);
} else {
int width;
int height;
width = 0;
height = 0;
/* this is a corner case where we set up the surface as
* maximized, then fullscreen, and back to maximized.
*
* we land here here when we're back from fullscreen and we
* were previously maximized: rather than sending (0, 0) send
* the area of the output minus the panels */
struct weston_desktop_surface *dsurface =
shsurf->desktop_surface;
if (weston_desktop_surface_get_maximized(dsurface) ||
weston_desktop_surface_get_pending_maximized(dsurface)) {
get_maximized_size(shsurf, &width, &height);
}
weston_desktop_surface_set_size(shsurf->desktop_surface, width, height);
}
weston_desktop_surface_set_fullscreen(desktop_surface, fullscreen);
set_shsurf_size_maximized_or_fullscreen(shsurf, false, fullscreen);
}
static void