libweston/input: Use WESTON_ACTIVATE_FLAG_FULLSCREEN in activation logic

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 <sergio.g.delreal@gmail.com>
This commit is contained in:
Sergio Gómez 2023-05-02 18:02:09 -05:00 committed by Marius Vlad
parent 7828712684
commit a7f63c1220
2 changed files with 16 additions and 4 deletions

View file

@ -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);

View file

@ -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);