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>
This commit is contained in:
Manuel Bachmann 2014-02-26 15:53:11 +01:00 committed by Kristian Høgsberg
parent 50c87dbd95
commit c1ae2e817e

View file

@ -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);