This is identical to the wlr protocol, and Smithay has implementations
for both.
New clients should use the `ext` protocol where present. Not sure how
widely used it is yet, but we probably should have both for now.
Some users have complained about not supporting clipboard managers. But
this was possible, but hidden under the `COSMIC_DATA_CONTROL_ENABLED`
env var.
Since the security context protocol exists now to provide a way to not
expose a protocol like this to sandboxed clients, it should be safe to
expose this now.
`privileged` now only indicates if a client is "sandboxed", i.e. it has
a security context, where the sandbox engine isn't cosmic-panel.
So replace the field with a method that's a bit more descriptive.
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.
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.
The `id` is defined to be sent only once, on creation of the handle or
later. And only for workspaces that are "likely to be stable across
multiple sessions".
Set we add an `id` initially for pinned workspaces, and add one when the
workspace is pinned.
The `id` is not supposed to be human readable, so we just use a random
value.
Adding anything else to this tuple is awkward; defining a simple struct
makes this cleaner.
This also adds a `sync` property, which will come in handy later.
Containing simply the same-named argument that was passed to
`submit_buffer`.
It doesn't seem like there's really a need to have `Err(_)` and `Ok(None)`.
`Err(_)` means the set exists for the output, but doesn't have the
appropriate workspace index. It's a bit odd that the set not even
existing becomes `Ok(None)`.
Instead, just return `Err(InvalidWorkspaceIndex)` in either case.
I hoped to split this up into multiple commits, but the api
changes to `shell/workspace.rs` were to invasive to feasibly do this.
Here is a rough list of changes:
- Fullscreen windows aren't mapped to other layers anymore
- This they need their own logic for:
- Sending frames
- Dmabuf Feedback
- Primary outputs
- On commit handlers
- cursor tests
- They get their own unmap/remap logic
- They get a new restore state similar to minimized windows
- Refactored the minimized window state to reuse as much as possible
here
- They need to be part of focus stacks, which means adjusting them
to a new type `FocusTarget` as they previously only handled
`CosmicMapped`.
- Various shell handlers (minimize, move, menu) now have dedicated
logic for fullscreen surfaces
- This was partially necessary due to relying on CosmicSurface now,
partially because they should've had their own logic from the
start. E.g. the context menu is now reflecting the fullscreen
state
- Fullscreen windows may be rendered behind other windows now, when they
loose focus.
- This needed changes to input handling / rendering
Similar to the change in https://github.com/pop-os/cosmic-comp/pull/780,
but also updates it to be a little clearer than just an uncommented `age
= 0` line.
Ideally we want some robust system to re-use the offscreen buffer (but
not allocate more buffers indefinitely if the client doesn't capture
with the same `wl_buffer`).
It seems previously, workspace migration due to output add could result in
a workspace being removed from a group, but not added to the new group
for existing clients, because the workspace group creation didn't happen
until `done`. And `send_workspace_to_client` didn't send
`workspace_enter` except when a workspace instance is newly created.
That logic worked with the old protocol, but now a workspace can be
moved to a different group.
Seems to fix the issue with workspaces disappearing from the workspaces
view in https://github.com/pop-os/cosmic-comp/issues/1470. I don't seem
to be able to reproduce the panel auto-hide issue, but have seen it in
the past. So it may or may not be prevented from happening now.