Tested on `SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=1 supertux2`, using
XWayland. If the game starts with fullscreen configured, it minimizes
immediately on start. But after this change, this no longer happens.
This hopefully will improve behaviors with various X11/wine fullscreen
clients. It may fix
https://github.com/pop-os/cosmic-comp/issues/1510, though looking at the
video the behavior there may be a bit different.
It seems https://github.com/pop-os/cosmic-comp/pull/1638 caused an issue
in cosmic-workspaces, where if there are multiple toplevels, when
dragging a toplevel, the drag surface would appear in capture for other
toplevels.
For now, omit drag surface in toplevel capture without `draw_cursor`.
Though I guess ultimately we do want it for metadata cursor capture in
the portal, but not in cosmic-workspaces? Maybe the protocol needs some
additional option for this...
`CosmicMapped::cursor_positon` may have worked previously, but doesn't
now.
This is based on the code used for seperate cursor capture sessions.
Maybe this could be consolidated in some way.
But this seems to work. Including for rotated outputs.
Previously we ignored when we had no output configuration
**and** failed to apply the automatically created one.
This leads to two problems:
- If this happens on startup, we end up with no outputs being added to the shell and we quit.
- If this happens later, we might end up in an inconsistent state, where the shell thinks we have an output, when it didn't light up for similar reasons.
Thus `read_outputs` is failable and handling that very much depends on
the where is was called from, because `read_outputs` doesn't know what
configuration was active before.
Thus make it failable and provide useful mitigations everywhere
possible:
- Try to enable just one output in case we fail on startup.
- Don't enable any additional outputs, when we fail on hotplug.
- Log the error like previously in any other case (and come up with more
mitigations, once we understand these cases better).
This fixes two issues:
- The `area` passed to `to_buffer()` should match the dimensions of the
output/etc. being captured, rather than coming from the damage rect
size.
- The transform needs to be inverted.
Previously, rotated outputs could cause a crash
`xdg-desktop-portal-cosmic`, since the compositor was passing negative
coordinates in `damage`, and the client used the same in
`damage_buffer`. This was causing
https://github.com/pop-os/xdg-desktop-portal-cosmic/issues/165.
The portal crash no longer occurs, and logging in
xdg-desktop-portal-cosmic shows damage rects that match expectation
while moving the cursor over different corners of a workspace.