shell: reset rotation for maximized surface
Surface will preserve its rotation transformation when maximizing, which
will cause inconsistencies (eg. no window shadows drawn)
This patch removes rotation from maximized surface and restore it when
unmaximizing (just like in fullscreen mode)
diff --git a/src/shell.c b/src/shell.c
index d6fc30a..5ff25e6 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1472,6 +1472,27 @@
wl_list_insert(&ws->layer.surface_list, &shsurf->surface->layer_link);
}
+static void
+shell_unset_maximized(struct shell_surface *shsurf)
+{
+ struct workspace *ws;
+ /* undo all maximized things here */
+ shsurf->output = get_default_output(shsurf->surface->compositor);
+ weston_surface_set_position(shsurf->surface,
+ shsurf->saved_x,
+ shsurf->saved_y);
+
+ if (shsurf->saved_rotation_valid) {
+ wl_list_insert(&shsurf->surface->geometry.transformation_list,
+ &shsurf->rotation.transform.link);
+ shsurf->saved_rotation_valid = false;
+ }
+
+ ws = get_current_workspace(shsurf->shell);
+ wl_list_remove(&shsurf->surface->layer_link);
+ wl_list_insert(&ws->layer.surface_list, &shsurf->surface->layer_link);
+}
+
static int
reset_shell_surface_type(struct shell_surface *surface)
{
@@ -1480,10 +1501,7 @@
shell_unset_fullscreen(surface);
break;
case SHELL_SURFACE_MAXIMIZED:
- surface->output = get_default_output(surface->surface->compositor);
- weston_surface_set_position(surface->surface,
- surface->saved_x,
- surface->saved_y);
+ shell_unset_maximized(surface);
break;
case SHELL_SURFACE_NONE:
case SHELL_SURFACE_TOPLEVEL:
@@ -1517,11 +1535,6 @@
break;
case SHELL_SURFACE_MAXIMIZED:
- shsurf->saved_x = surface->geometry.x;
- shsurf->saved_y = surface->geometry.y;
- shsurf->saved_position_valid = true;
- break;
-
case SHELL_SURFACE_FULLSCREEN:
shsurf->saved_x = surface->geometry.x;
shsurf->saved_y = surface->geometry.y;