compositor: use Mod-Tab to show/raise minimized surfaces
Temporarily show minimized surfaces when switching between
surfaces with the keyboard. If the final selected one was
minimized, it will be restored.
Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 1f8e4ec..97e8b1e 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5211,6 +5211,7 @@
struct weston_surface *current;
struct wl_listener listener;
struct weston_keyboard_grab grab;
+ struct wl_array minimized_array;
};
static void
@@ -5221,6 +5222,16 @@
struct shell_surface *shsurf;
struct workspace *ws = get_current_workspace(switcher->shell);
+ /* temporary re-display minimized surfaces */
+ struct weston_view *tmp;
+ struct weston_view **minimized;
+ wl_list_for_each_safe(view, tmp, &switcher->shell->minimized_layer.view_list, layer_link) {
+ wl_list_remove(&view->layer_link);
+ wl_list_insert(&ws->layer.view_list, &view->layer_link);
+ minimized = wl_array_add(&switcher->minimized_array, sizeof *minimized);
+ *minimized = view;
+ }
+
wl_list_for_each(view, &ws->layer.view_list, layer_link) {
shsurf = get_shell_surface(view->surface);
if (shsurf &&
@@ -5292,6 +5303,19 @@
weston_keyboard_end_grab(keyboard);
if (keyboard->input_method_resource)
keyboard->grab = &keyboard->input_method_grab;
+
+ /* re-hide surfaces that were temporary shown during the switch */
+ struct weston_view **minimized;
+ wl_array_for_each(minimized, &switcher->minimized_array) {
+ /* with the exception of the current selected */
+ if ((*minimized)->surface != switcher->current) {
+ wl_list_remove(&(*minimized)->layer_link);
+ wl_list_insert(&switcher->shell->minimized_layer.view_list, &(*minimized)->layer_link);
+ weston_view_damage_below(*minimized);
+ }
+ }
+ wl_array_release(&switcher->minimized_array);
+
free(switcher);
}
@@ -5344,6 +5368,7 @@
switcher->current = NULL;
switcher->listener.notify = switcher_handle_surface_destroy;
wl_list_init(&switcher->listener.link);
+ wl_array_init(&switcher->minimized_array);
restore_all_output_modes(shell->compositor);
lower_fullscreen_layer(switcher->shell);