Layer shell popups were missing a handler for the xdg_popup reposition
event. When a client (e.g. GTK4) creates a popup and then sends a
reposition request, wlroots resets the scheduled geometry back to the
positioner's original value. Without a reposition handler, the
unconstrained geometry computed on the initial commit was lost, causing
popups such as tooltips to render outside the screen viewport.
This was most visible with GTK4 layer shell apps (e.g. taskbars) where
tooltips would appear below the bottom edge of the screen instead of
being flipped/slid into the visible area.
Also switch the destroy listener from wlr_popup->base->events.destroy
to wlr_popup->events.destroy so that cleanup runs before wlroots
asserts that all popup signal listeners have been removed.
Fixes#8518
In general wl_signal isn't well-suited for Sway: Sway doesn't need
any modularity, and signals make it trickier to track down exactly
what happens down the stack.
Replace Sway's output disable signal with a simple list tracking
for the only user.
We tried to synchronize layer shell popups with the parent layer shell
on commits, but this is subtly wrong because we would only update
the position for one layer shell that was committed, but not any other
layer that might be affected. By moving handling to the scene descriptor
we can iterate all popups and ensure they are synchronized.
This allows for layer shell surfaces to receive focus while the surface is explicitly focused, i.e allowing
text fields to receive keyboard input just like a regular surface.
This commit makes sure the extents are kept up-to-date, fixes not
damaging the surface if its layer shell-specific state didn't change,
and adds a check if the layer shell-specific state didn't change but the
surface got mapped/unmapped, which could affect keyboard focus.
When a layer surface shrinks we need to damage the area it previously
occupied, but we don't know the location of all its subsurfaces in the
previous state, so instead damage a rectangle that encloses the entire
previous extent.