[PATCH weston 10/17] desktop-shell: Pass a flag bitmask instead of bool to activate()

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


Although it currently only has one available flag, but that'll change.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 desktop-shell/exposay.c |  9 ++++++---
 desktop-shell/shell.c   | 36 ++++++++++++++++++++++++------------
 desktop-shell/shell.h   |  2 +-
 src/compositor.h        |  5 +++++
 4 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index 5073a96..5be92c7 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -160,7 +160,8 @@ exposay_highlight_surface(struct desktop_shell *shell,
 	shell->exposay.column_current = esurface->column;
 	shell->exposay.cur_output = esurface->eoutput;
 
-	activate(shell, view, shell->exposay.seat, false);
+	activate(shell, view, shell->exposay.seat,
+		 WESTON_ACTIVATE_FLAG_NONE);
 	shell->exposay.focus_current = view;
 }
 
@@ -545,10 +546,12 @@ exposay_transition_inactive(struct desktop_shell *shell, int switch_focus)
 	 * to the new. */
 	if (switch_focus && shell->exposay.focus_current)
 		activate(shell, shell->exposay.focus_current,
-		         shell->exposay.seat, true);
+		         shell->exposay.seat,
+			 WESTON_ACTIVATE_FLAG_CONFIGURE);
 	else if (shell->exposay.focus_prev)
 		activate(shell, shell->exposay.focus_prev,
-		         shell->exposay.seat, true);
+		         shell->exposay.seat,
+			 WESTON_ACTIVATE_FLAG_CONFIGURE);
 
 	wl_list_for_each(esurface, &shell->exposay.surface_list, link)
 		exposay_animate_out(esurface);
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index f8c2185..abe64f6 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -772,7 +772,8 @@ focus_state_surface_destroy(struct wl_listener *listener, void *data)
 	shell = state->seat->compositor->shell_interface.shell;
 	if (next) {
 		state->keyboard_focus = NULL;
-		activate(shell, next, state->seat, true);
+		activate(shell, next, state->seat,
+			 WESTON_ACTIVATE_FLAG_CONFIGURE);
 	} else {
 		if (shell->focus_animation_type == ANIMATION_DIM_LAYER) {
 			if (state->ws->focus_animation)
@@ -2011,10 +2012,12 @@ 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->view, seat, true);
+		activate(shsurf->shell, shsurf->view, seat,
+			 WESTON_ACTIVATE_FLAG_CONFIGURE);
 		surface_move(shsurf, seat, 0);
 	} else if (shsurf && button == BTN_RIGHT && state) {
-		activate(shsurf->shell, shsurf->view, seat, true);
+		activate(shsurf->shell, shsurf->view, seat,
+			 WESTON_ACTIVATE_FLAG_CONFIGURE);
 		surface_rotate(shsurf, seat);
 	}
 }
@@ -2646,7 +2649,8 @@ 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, seat, true);
+			activate(shsurf->shell, view, seat,
+				 WESTON_ACTIVATE_FLAG_CONFIGURE);
 		}
 	}
 
@@ -4869,7 +4873,7 @@ lower_fullscreen_layer(struct desktop_shell *shell)
 
 void
 activate(struct desktop_shell *shell, struct weston_view *view,
-	 struct weston_seat *seat, bool configure)
+	 struct weston_seat *seat, uint32_t flags)
 {
 	struct weston_surface *es = view->surface;
 	struct weston_surface *main_surface;
@@ -4894,7 +4898,8 @@ activate(struct desktop_shell *shell, struct weston_view *view,
 	shsurf = get_shell_surface(main_surface);
 	assert(shsurf);
 
-	if (shsurf->state.fullscreen && configure)
+	if (shsurf->state.fullscreen &&
+	    flags & WESTON_ACTIVATE_FLAG_CONFIGURE)
 		shell_configure_fullscreen(shsurf);
 	else
 		restore_all_output_modes(shell->compositor);
@@ -4931,7 +4936,8 @@ is_black_surface(struct weston_view *view, struct weston_view **fs_view)
 static void
 activate_binding(struct weston_seat *seat,
 		 struct desktop_shell *shell,
-		 struct weston_view *focus_view)
+		 struct weston_view *focus_view,
+		 uint32_t flags)
 {
 	struct weston_view *main_view;
 	struct weston_surface *main_surface;
@@ -4959,7 +4965,8 @@ click_to_activate_binding(struct weston_seat *seat,
 	if (seat->pointer->focus == NULL)
 		return;
 
-	activate_binding(seat, data, seat->pointer->focus);
+	activate_binding(seat, data, seat->pointer->focus,
+			 WESTON_ACTIVATE_FLAG_CONFIGURE);
 }
 
 static void
@@ -4970,7 +4977,8 @@ touch_to_activate_binding(struct weston_seat *seat, uint32_t time, void *data)
 	if (seat->touch->focus == NULL)
 		return;
 
-	activate_binding(seat, data, seat->touch->focus);
+	activate_binding(seat, data, seat->touch->focus,
+			 WESTON_ACTIVATE_FLAG_CONFIGURE);
 }
 
 static void
@@ -5378,7 +5386,8 @@ 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->view, seat, true);
+			activate(shell, shsurf->view, seat,
+				 WESTON_ACTIVATE_FLAG_CONFIGURE);
 		break;
 	case SHELL_SURFACE_POPUP:
 	case SHELL_SURFACE_NONE:
@@ -5865,9 +5874,12 @@ switcher_destroy(struct switcher *switcher)
 		weston_surface_damage(view->surface);
 	}
 
-	if (switcher->current)
+	if (switcher->current) {
 		activate(switcher->shell, switcher->current,
-			 (struct weston_seat *) keyboard->seat, true);
+			 (struct weston_seat *) keyboard->seat,
+			 WESTON_ACTIVATE_FLAG_CONFIGURE);
+	}
+
 	wl_list_remove(&switcher->listener.link);
 	weston_keyboard_end_grab(keyboard);
 	if (keyboard->input_method_resource)
diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
index 9409f8f..0be0d30 100644
--- a/desktop-shell/shell.h
+++ b/desktop-shell/shell.h
@@ -231,7 +231,7 @@ lower_fullscreen_layer(struct desktop_shell *shell);
 
 void
 activate(struct desktop_shell *shell, struct weston_view *view,
-	 struct weston_seat *seat, bool configure);
+	 struct weston_seat *seat, uint32_t flags);
 
 void
 exposay_binding(struct weston_seat *seat,
diff --git a/src/compositor.h b/src/compositor.h
index e8fc8a7..4982187 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -970,6 +970,11 @@ enum weston_key_state_update {
 	STATE_UPDATE_NONE,
 };
 
+enum weston_activate_flag {
+	WESTON_ACTIVATE_FLAG_NONE = 0,
+	WESTON_ACTIVATE_FLAG_CONFIGURE = 1 << 0,
+};
+
 void
 weston_version(int *major, int *minor, int *micro);
 
-- 
1.8.5.1



More information about the wayland-devel mailing list