From c1ae2e817eed32c3582f452bd1fb7ef4617ff586 Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Wed, 26 Feb 2014 15:53:11 +0100 Subject: [PATCH] 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 --- desktop-shell/shell.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 1f8e4ec8..97e8b1ea 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -5211,6 +5211,7 @@ struct switcher { struct weston_surface *current; struct wl_listener listener; struct weston_keyboard_grab grab; + struct wl_array minimized_array; }; static void @@ -5221,6 +5222,16 @@ switcher_next(struct switcher *switcher) 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 @@ switcher_destroy(struct switcher *switcher) 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_binding(struct weston_seat *seat, uint32_t time, uint32_t key, 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);