From a7f63c1220792b68e2cb47770961aa3d56bb7047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20G=C3=B3mez?= Date: Tue, 2 May 2023 18:02:09 -0500 Subject: [PATCH] libweston/input: Use WESTON_ACTIVATE_FLAG_FULLSCREEN in activation logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The addition in a former commit of the flags field in the activation data will let us pass the reason for activation to the constraint logic. We use that reason here to unconditionally enable constraints in the recently 'fullscreened' surface. Signed-off-by: Sergio Gómez --- desktop-shell/shell.c | 7 +++++-- libweston/input.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index b49fa27ee..ff3a3513a 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2362,7 +2362,9 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf) if (!shell->locked) { wl_list_for_each(seat, &compositor->seat_list, link) activate(shell, shsurf->view, seat, - WESTON_ACTIVATE_FLAG_CONFIGURE); + WESTON_ACTIVATE_FLAG_CONFIGURE | + (shsurf->state.fullscreen ? + WESTON_ACTIVATE_FLAG_FULLSCREEN : 0)); } if (!shsurf->state.fullscreen && !shsurf->state.maximized) { @@ -2458,7 +2460,8 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface, wl_list_for_each(seat, &surface->compositor->seat_list,link) { activate(shell, shsurf->view, seat, - WESTON_ACTIVATE_FLAG_CONFIGURE); + WESTON_ACTIVATE_FLAG_CONFIGURE | + WESTON_ACTIVATE_FLAG_FULLSCREEN); } } else if (shsurf->state.maximized) { set_maximized_position(shell, shsurf); diff --git a/libweston/input.c b/libweston/input.c index 610d481c3..164dbf366 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -4838,8 +4838,17 @@ pointer_constraint_surface_activate(struct wl_listener *listener, void *data) get_pointer_constraint_for_pointer(focus, pointer) == constraint; if (is_constraint_surface && - !is_pointer_constraint_enabled(constraint)) - maybe_enable_pointer_constraint(constraint); + !is_pointer_constraint_enabled(constraint)) { + if (activation->flags & WESTON_ACTIVATE_FLAG_FULLSCREEN) { + weston_view_update_transform(activation->view); + weston_pointer_set_focus(pointer, activation->view); + enable_pointer_constraint(constraint, activation->view); + maybe_warp_confined_pointer(constraint); + } + else { + maybe_enable_pointer_constraint(constraint); + } + } else if (!is_constraint_surface && is_pointer_constraint_enabled(constraint)) disable_pointer_constraint(constraint);