[PATCH 2/2] compositor: use Mod-Tab to show/raise minimized surfaces

Manuel Bachmann manuel.bachmann at open.eurogiciel.org
Wed Feb 26 06:53:11 PST 2014


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 at open.eurogiciel.org>
---
 desktop-shell/shell.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 8ad528e..fb87587 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5179,6 +5179,7 @@ struct switcher {
 	struct weston_surface *current;
 	struct wl_listener listener;
 	struct weston_keyboard_grab grab;
+	struct wl_array minimized_array;
 };
 
 static void
@@ -5189,6 +5190,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 &&
@@ -5260,6 +5271,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);
 }
 
@@ -5312,6 +5336,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);
-- 
1.7.10.4



More information about the wayland-devel mailing list