From 4361b4ea3f789c08eb191fe46d176398deb0a86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 18 Oct 2014 18:20:16 +0200 Subject: [PATCH] desktop-shell: Pass a flag bitmask instead of bool to activate() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although it currently only has one available flag, but that'll change. Signed-off-by: Jonas Ã…dahl Reviewed-by: Derek Foreman Acked-by: Peter Hutterer --- desktop-shell/exposay.c | 9 ++++++--- desktop-shell/shell.c | 34 ++++++++++++++++++++++------------ desktop-shell/shell.h | 2 +- libweston/compositor.h | 5 +++++ 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index bff424f9..f05fa4c5 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -162,7 +162,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; } @@ -571,10 +572,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 e81ecdda..4a44f966 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -842,7 +842,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) @@ -2015,10 +2016,12 @@ busy_cursor_grab_button(struct weston_pointer_grab *base, struct weston_seat *seat = 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, pointer, false); } 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, pointer); } } @@ -5163,7 +5166,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; @@ -5189,7 +5192,7 @@ activate(struct desktop_shell *shell, struct weston_view *view, old_es = state->keyboard_focus; focus_state_set_focus(state, es); - if (shsurf->state.fullscreen && configure) + if (shsurf->state.fullscreen && flags & WESTON_ACTIVATE_FLAG_CONFIGURE) shell_configure_fullscreen(shsurf); else restore_output_mode(shsurf->output); @@ -5226,7 +5229,8 @@ is_black_surface_view(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; @@ -5241,7 +5245,7 @@ activate_binding(struct weston_seat *seat, if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE) return; - activate(shell, focus_view, seat, true); + activate(shell, focus_view, seat, flags); } static void @@ -5253,7 +5257,8 @@ click_to_activate_binding(struct weston_pointer *pointer, uint32_t time, if (pointer->focus == NULL) return; - activate_binding(pointer->seat, data, pointer->focus); + activate_binding(pointer->seat, data, pointer->focus, + WESTON_ACTIVATE_FLAG_CONFIGURE); } static void @@ -5265,7 +5270,8 @@ touch_to_activate_binding(struct weston_touch *touch, uint32_t time, if (touch->focus == NULL) return; - activate_binding(touch->seat, data, touch->focus); + activate_binding(touch->seat, data, touch->focus, + WESTON_ACTIVATE_FLAG_CONFIGURE); } static void @@ -5715,7 +5721,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: @@ -6130,9 +6137,12 @@ switcher_destroy(struct switcher *switcher) weston_surface_damage(view->surface); } - if (switcher->current) + if (switcher->current) { activate(switcher->shell, switcher->current, - keyboard->seat, true); + 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 ae4068c9..f8f62d5c 100644 --- a/desktop-shell/shell.h +++ b/desktop-shell/shell.h @@ -236,7 +236,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_keyboard *keyboard, diff --git a/libweston/compositor.h b/libweston/compositor.h index 557d2f5b..0ce79092 100644 --- a/libweston/compositor.h +++ b/libweston/compositor.h @@ -1124,6 +1124,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);