Skip to content

Implement unconditional constraint enabling when going fullscreen

Sergio Gómez requested to merge SergioGDR/weston:fullscreen_constraint into main

Currently, when a client requests a constraint on the pointer, the compositor postpones the actual enabling of the constraint until some conditions are met.

Sometimes, however, we would like to bypass the normal conditions for enabling constraints. For example, if a client requests confinement on a surface that it later sets fullscreen through xdg shell, it shouldn't have to wait for a click activation event to enable confinement.

A client requests fullscreen on a surface through xdg_toplevel_set_fullscreen(). After acknowledging the compositor's configure event, it will _commit the surface. The implementation occurs at the _commit boundary, at desktop-shell's desktop_surface_committed().

There are 2 cases relevant: the surface has been mapped, or it hasn't.

  • Surface is not mapped: desktop_surface_committed() calls map(). Here we can see if the surface is starting in fullscreen, and append WESTON_ACTIVATE_FLAG_FULLSCREEN when calling activate().
  • Surface is mapped: In desktop_surface_committed() we see if the commit implies a change from non-fullscreen to fullscreen, in which case we force an activation through activate(..., WESTON_ACTIVATE_FLAG_FULLSCREEN)

The activation logic will then pass the flags to the constraint's surface activate listener, which will handle WESTON_ACTIVATE_FLAG_FULLSCREEN accordingly.

The drawback of this approach is that it is tied to the desktop-shell, while it is nice to be able to reuse and extend an already existing mechanism (activation) instead of introducing a new one.

=====================================================================================================

The first commit in the series needs special consideration: currently weston_seat_set_keyboard_focus() is sending the activation signal to listeners. This seems not to be a problem for the desktop-shell, since there is no code that calls directly into that function, but does so through weston_view_activate_input(), so moving the activation logic out doesn't harm. However, fullscreen-shell does invoke weston_seat_set_keyboard_focus() directly in various parts. There are currently 2 users of the activation signal: the constraints code itself, and xwayland, so I'm not sure how removing the sending of the activation signal from weston_seat_set_keyboard_focus() would affect these in some scenarios using fullscreen-shell.

Merge request reports