[weston,09/17] desktop-shell: Make activate() take a view instead of surface

Submitted by Jonas Ådahl on Dec. 2, 2014, 1:49 p.m.

Details

Message ID 1417528165-9319-10-git-send-email-jadahl@gmail.com
State Superseded
Delegated to: Daniel Stone
Headers show

Not browsing as part of any series.

Commit Message

Jonas Ådahl Dec. 2, 2014, 1:49 p.m.
In preparation for further refactorings.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
---
 desktop-shell/exposay.c |  6 +++---
 desktop-shell/shell.c   | 22 ++++++++++++----------
 desktop-shell/shell.h   |  2 +-
 3 files changed, 16 insertions(+), 14 deletions(-)

Patch hide | download patch | download mbox

diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index a44c1f7..5073a96 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -160,7 +160,7 @@  exposay_highlight_surface(struct desktop_shell *shell,
 	shell->exposay.column_current = esurface->column;
 	shell->exposay.cur_output = esurface->eoutput;
 
-	activate(shell, view->surface, shell->exposay.seat, false);
+	activate(shell, view, shell->exposay.seat, false);
 	shell->exposay.focus_current = view;
 }
 
@@ -544,10 +544,10 @@  exposay_transition_inactive(struct desktop_shell *shell, int switch_focus)
 	 * animating back the old state and then immediately transitioning
 	 * to the new. */
 	if (switch_focus && shell->exposay.focus_current)
-		activate(shell, shell->exposay.focus_current->surface,
+		activate(shell, shell->exposay.focus_current,
 		         shell->exposay.seat, true);
 	else if (shell->exposay.focus_prev)
-		activate(shell, shell->exposay.focus_prev->surface,
+		activate(shell, shell->exposay.focus_prev,
 		         shell->exposay.seat, true);
 
 	wl_list_for_each(esurface, &shell->exposay.surface_list, link)
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index aa9c333..f8c2185 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -747,7 +747,8 @@  focus_state_surface_destroy(struct wl_listener *listener, void *data)
 						 struct focus_state,
 						 surface_destroy_listener);
 	struct desktop_shell *shell;
-	struct weston_surface *main_surface, *next;
+	struct weston_surface *main_surface;
+	struct weston_view *next;
 	struct weston_view *view;
 
 	main_surface = weston_surface_get_main_surface(state->keyboard_focus);
@@ -760,13 +761,13 @@  focus_state_surface_destroy(struct wl_listener *listener, void *data)
 		if (is_focus_view(view))
 			continue;
 
-		next = view->surface;
+		next = view;
 		break;
 	}
 
 	/* if the focus was a sub-surface, activate its main surface */
 	if (main_surface != state->keyboard_focus)
-		next = main_surface;
+		next = get_default_view(main_surface);
 
 	shell = state->seat->compositor->shell_interface.shell;
 	if (next) {
@@ -2010,10 +2011,10 @@  busy_cursor_grab_button(struct weston_pointer_grab *base,
 	struct weston_seat *seat = grab->grab.pointer->seat;
 
 	if (shsurf && button == BTN_LEFT && state) {
-		activate(shsurf->shell, shsurf->surface, seat, true);
+		activate(shsurf->shell, shsurf->view, seat, true);
 		surface_move(shsurf, seat, 0);
 	} else if (shsurf && button == BTN_RIGHT && state) {
-		activate(shsurf->shell, shsurf->surface, seat, true);
+		activate(shsurf->shell, shsurf->view, seat, true);
 		surface_rotate(shsurf, seat);
 	}
 }
@@ -2645,7 +2646,7 @@  set_minimized(struct weston_surface *surface, bool minimized)
 		wl_list_for_each(seat, &shell->compositor->seat_list, link) {
 			if (!seat->keyboard)
 				continue;
-			activate(shsurf->shell, view->surface, seat, true);
+			activate(shsurf->shell, view, seat, true);
 		}
 	}
 
@@ -4867,9 +4868,10 @@  lower_fullscreen_layer(struct desktop_shell *shell)
 }
 
 void
-activate(struct desktop_shell *shell, struct weston_surface *es,
+activate(struct desktop_shell *shell, struct weston_view *view,
 	 struct weston_seat *seat, bool configure)
 {
+	struct weston_surface *es = view->surface;
 	struct weston_surface *main_surface;
 	struct focus_state *state;
 	struct workspace *ws;
@@ -4944,7 +4946,7 @@  activate_binding(struct weston_seat *seat,
 	if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE)
 		return;
 
-	activate(shell, focus_view->surface, seat, true);
+	activate(shell, focus_view, seat, true);
 }
 
 static void
@@ -5376,7 +5378,7 @@  map(struct desktop_shell *shell, struct shell_surface *shsurf,
 		if (shell->locked)
 			break;
 		wl_list_for_each(seat, &compositor->seat_list, link)
-			activate(shell, shsurf->surface, seat, true);
+			activate(shell, shsurf->view, seat, true);
 		break;
 	case SHELL_SURFACE_POPUP:
 	case SHELL_SURFACE_NONE:
@@ -5864,7 +5866,7 @@  switcher_destroy(struct switcher *switcher)
 	}
 
 	if (switcher->current)
-		activate(switcher->shell, switcher->current->surface,
+		activate(switcher->shell, switcher->current,
 			 (struct weston_seat *) keyboard->seat, true);
 	wl_list_remove(&switcher->listener.link);
 	weston_keyboard_end_grab(keyboard);
diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
index 2cfd1d6..9409f8f 100644
--- a/desktop-shell/shell.h
+++ b/desktop-shell/shell.h
@@ -230,7 +230,7 @@  void
 lower_fullscreen_layer(struct desktop_shell *shell);
 
 void
-activate(struct desktop_shell *shell, struct weston_surface *es,
+activate(struct desktop_shell *shell, struct weston_view *view,
 	 struct weston_seat *seat, bool configure);
 
 void