[PATCH weston 08/17] desktop-shell: Change switcher to track views

Jonas Ådahl jadahl at gmail.com
Tue Dec 2 05:49:16 PST 2014


Preparation for future refactorings.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 desktop-shell/shell.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 7ce951d..aa9c333 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5775,7 +5775,7 @@ bind_screensaver(struct wl_client *client,
 
 struct switcher {
 	struct desktop_shell *shell;
-	struct weston_surface *current;
+	struct weston_view *current;
 	struct wl_listener listener;
 	struct weston_keyboard_grab grab;
 	struct wl_array minimized_array;
@@ -5785,7 +5785,7 @@ static void
 switcher_next(struct switcher *switcher)
 {
 	struct weston_view *view;
-	struct weston_surface *first = NULL, *prev = NULL, *next = NULL;
+	struct weston_view *first = NULL, *prev = NULL, *next = NULL;
 	struct shell_surface *shsurf;
 	struct workspace *ws = get_current_workspace(switcher->shell);
 
@@ -5805,10 +5805,10 @@ switcher_next(struct switcher *switcher)
 		    shsurf->type == SHELL_SURFACE_TOPLEVEL &&
 		    shsurf->parent == NULL) {
 			if (first == NULL)
-				first = view->surface;
+				first = view;
 			if (prev == switcher->current)
-				next = view->surface;
-			prev = view->surface;
+				next = view;
+			prev = view;
 			view->alpha = 0.25;
 			weston_view_geometry_dirty(view);
 			weston_surface_damage(view->surface);
@@ -5831,10 +5831,10 @@ switcher_next(struct switcher *switcher)
 	wl_signal_add(&next->destroy_signal, &switcher->listener);
 
 	switcher->current = next;
-	wl_list_for_each(view, &next->views, surface_link)
+	wl_list_for_each(view, &next->surface->views, surface_link)
 		view->alpha = 1.0;
 
-	shsurf = get_shell_surface(switcher->current);
+	shsurf = get_shell_surface(switcher->current->surface);
 	if (shsurf && shsurf->state.fullscreen)
 		shsurf->fullscreen.black_view->alpha = 1.0;
 }
@@ -5864,7 +5864,7 @@ switcher_destroy(struct switcher *switcher)
 	}
 
 	if (switcher->current)
-		activate(switcher->shell, switcher->current,
+		activate(switcher->shell, switcher->current->surface,
 			 (struct weston_seat *) keyboard->seat, true);
 	wl_list_remove(&switcher->listener.link);
 	weston_keyboard_end_grab(keyboard);
@@ -5875,7 +5875,7 @@ switcher_destroy(struct switcher *switcher)
 	struct weston_view **minimized;
 	wl_array_for_each(minimized, &switcher->minimized_array) {
 		/* with the exception of the current selected */
-		if ((*minimized)->surface != switcher->current) {
+		if ((*minimized)->surface != switcher->current->surface) {
 			weston_layer_entry_remove(&(*minimized)->layer_link);
 			weston_layer_entry_insert(&switcher->shell->minimized_layer.view_list, &(*minimized)->layer_link);
 			weston_view_damage_below(*minimized);
-- 
1.8.5.1



More information about the wayland-devel mailing list