Commit graph

1500 commits

Author SHA1 Message Date
Victoria Brekenfeld
a65e1d6b5f debug: More profiling annotations 2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
465813c1c5 shell: Using parking_lot's RwLock for fairness guarantees 2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
8194be30c6 kms: Allow updating the primary node
Add more sophisticated code to handle the primary node disappearing.

Also overhaul the selection logic to respect our allow/deny-list and
prefer devices with built-in connectors before using the boot gpu.

This will also allow triggering a primary node switch at runtime
for debugging purposes in the future.
2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
4c0c61e94b chore: Update smithay 2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
913ed90b04 kms: Add allow/deny-listing of drm devices 2025-05-27 20:00:21 +02:00
Ian Douglas Scott
b5d5479b86 Update to zbus 5.x
Depends on https://github.com/pop-os/libcosmic/pull/682.
2025-05-23 19:24:52 +02:00
Ian Douglas Scott
7ee48e5444 Don't change focus on click of layer with KeyboardInteractivity::None
Previously, a click on a client like squeekboard would give keyboard
focus to the window behind it, if any.

If we are in the input region of the layer surface, we shouldn't give
keyboard focus to the surface behind it on click. And should just leave
the focus unchanged. Returning `None` here seems to be correct.
2025-05-21 12:16:39 -06:00
Ian Douglas Scott
194d5c8967 protocols/screencopy: Make frame/session send stopped/fail on drop
Previously, `Frame` was stored in KMS frame udata, but in some cases the
udata was dropped without a capture happening, and `Frame` did not
implement `Drop`, so `fail` was never sent.

Instead, rename `DropableFrame` to `Frame` and `Frame` to `FrameRef`, so
we can have a single instance of `Frame`, that will send `fail` on drop.
This guarantees either `.success` or `.fail` are send, as long as its
not leaked.

This seems to fix https://github.com/pop-os/cosmic-comp/issues/1305.
xdg-desktop-portal-cosmic prints an error, buy retries (as it should for
an `Unknown` error; though maybe there should be a retry limit) and the
session continues working.

(Not sure if it should be sending `failed`, or queing it with the next
frame so it can send `success` to the client, but this works and is
desirable as a failsafe anyway.)

`Session` and `CursorSession` are similiarly updated.

`.fail()`, `.success()`, and `.stop()` now consume
`Frame`/`Session`/`CursorSession`. So to stop a session, it is now
necessary to call `.remove_session()`, but then simply dropping with
send `.stop()`.

Factoring out some `Request::Capture` handling into a `capture_frame`
function seems to clean up error handling and such a bit.
2025-05-19 16:53:46 -07:00
Ian Douglas Scott
b4db2498de Remove deprecated call to time's set_soundness function
No longer required.
2025-05-19 21:29:51 +02:00
Ian Douglas Scott
42c6a3729a Fix compiler warnings 2025-05-19 21:29:51 +02:00
Ian Douglas Scott
77a639624c ssd: Set is_ssd(true) on header_bar, and don't set .start 2025-05-19 21:29:51 +02:00
Ian Douglas Scott
e1a817bc06 kms/surface: Fix thread crash on error return of redraw
If `redraw()` returned early, before updating `self.state`, but after
calling `queue_frame`, `on_vblank` would later be called, and reach
`unreachable` since state isn't set to `WaitinfForVBlank`.

In particular, this was happening when the dmabuf from the image copy
frame failed to `bind`.

To avoid this, make sure to update `self.state` immediately after
calling `queue_frame`, before any early return from an error.
2025-05-19 19:58:36 +02:00
Victoria Brekenfeld
d8fd4b241b shell: Remove null-bytes from X11 title/app_id 2025-04-30 12:50:33 +02:00
Ian Douglas Scott
d7b37cfde5 Update smithay
Updates to use `GbmFramebufferExporter`.
2025-04-29 14:42:07 +02:00
Ian Douglas Scott
982af8ff10 Update smithay with ContextId changes
The new type bounds seem to be addressable using `AsGlowRenderer`.

Though things like this will need a different solution when we want to
support Pixman rendering.
2025-04-29 14:42:07 +02:00
Victoria Brekenfeld
74c7a216f5 kms: Skip overlay tests on fullscreen 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
0be83fe930 iced: Optimize updates 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
7c222ae6d1 debug: Fix crashes and deadlocks 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
4e6713291d kms/timing: Faster cleanup 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
8aaaa12d5c kms: Fix VRR check having already missed the deadline 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
db25cc4b0b kms/timings: Base next_render_time on time to submit 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
d1e0e28d3c kms: Add tracy profiling 2025-04-28 18:03:09 +02:00
Ian Douglas Scott
96e9bf3b81 Initial support for workspace pinning and moving
Adds support for cosmic-workspace-v2 pin, unpin, move_after, and
move_before requests.

Both features need some work with workspaces span displays mode, so that
will need more fixes later.

We also want to generate a unique id for pinned workspaces to send in
the ext-workspace-v1 protocol. But that isn't a strict requirement for
anything. So I haven't yet fully implemented that. We'll also want to
persist other things, like workspace naming when that's added.

Overall, though, with separate workspaces per display, this is working
pretty well.
2025-04-24 12:45:50 +02:00
Ian Douglas Scott
d1f4e7b12d protocols/workspace: Make move_workspace_to_group move existing handle
The older protocol didn't have a way to do this, but ext-workspace-v1
supports it. And it should be the correct way to do things.
2025-04-22 07:48:23 -07:00
Ian Douglas Scott
e944ee9b2f protocols/workspace: Store request queue in workspace manager udata
This is slightly simpler, if there's not some reason I'm missing to do
this as it was previously done. And in particular provides a cleaner
API (if we wanted to move this to Smithay; perhaps without the Cosmic
extension).

But it also should be more correct. Presumably if a client (unusually)
had multiple components with their own `ext_workspace_manager_v1`
instance, they should have their own queues, and
`ext_workspace_manager_v1::commit` should be independent.

Inevitably, there's a racy element to multiple components trying to
update the workspace state like this, but it should behave the same as
two clients with separate connections.

(This is different from `CompositorClientState`, since the commit queue
there is fundamentally tied to the client, and different components with
their own compositor instance way have related surfaces.)
2025-04-22 07:48:23 -07:00
Ian Douglas Scott
2f6d600502 protocol/workspace: Store manager as part of workspace/group udata 2025-04-22 07:48:23 -07:00
Ian Douglas Scott
2d4912bd20 protocol/workspace: Move WorkspaceGroupData to ext.rs
More consistent to have this here next to `WorkspaceData`, now it isn't
shared with cosmic workspace v1.
2025-04-22 07:48:23 -07:00
Ian Douglas Scott
dc67db9a5d protocol/workspace: Remove type bounds that aren't required
It seems at least with Rust 1.82 (the version in `rust-toolchain.toml`)
these bounds are inferred from the `D: WorkspaceHandler` bound, so they
can be specified only there.
2025-04-22 07:48:23 -07:00
Ian Douglas Scott
85254b47d6 protocol/workspace: Drop support for cosmic v1 protocol
Clients have been updated to use ext-workspace-v1 and
cosmic-workspace-v2.

Removing this should save some duplication of having to update both
cosmic workspace v1 and ext workspace code, and should help with things
like using the same workspace handle when a workspace moves to a
different group (which is something that was changed before the final
version of the ext-workspace-v1 protocol.)
2025-04-22 07:48:23 -07:00
Victoria Brekenfeld
2cbe89d89d xwayland: Set scaled cursor size via xsettings 2025-04-16 21:06:51 +02:00
Victoria Brekenfeld
de1e528ba7 render/cursor: Don't round cursor coordinates early 2025-04-16 21:06:51 +02:00
Victoria Brekenfeld
e6a3f5373c render/cursor: Correctly convert hotspot coordinates 2025-04-16 21:06:51 +02:00
Victoria Brekenfeld
b53eb508a8 shell: Don't engage new MoveGrabs while in Overview 2025-04-15 16:15:24 +02:00
Victoria Brekenfeld
67d3225ef5 chore: use cosmic-text shape cache 2025-04-15 13:32:51 +02:00
Victoria Brekenfeld
155f8d20d0 xwayland: Honor primary output for fractional scale 2025-04-14 18:15:28 +02:00
Victoria Brekenfeld
2a3bd84e22 output_configuration: Allow setting xwayland primary output 2025-04-14 18:15:28 +02:00
Victoria Brekenfeld
aeed8f256f xwayland: store and restore primary output 2025-04-14 18:15:28 +02:00
Victoria Brekenfeld
7472351de0 feat: Allow fractional xwayland client scale 2025-04-14 18:15:28 +02:00
Victoria Brekenfeld
0159bce9db chore: update smithay 2025-04-14 18:15:28 +02:00
Victoria Brekenfeld
a8d12f3172 shell/element: Attach a resize border to tiled undecorated windows 2025-04-03 18:30:47 +02:00
Victoria Brekenfeld
793bb17d47 state: Use WeakOutput for frame trottling 2025-04-03 18:08:44 +02:00
Victoria Brekenfeld
cbc4ad6fc2 xwayland: Allow eavesdropping on certain keyboard/pointer events 2025-04-02 17:26:09 +02:00
Victoria Brekenfeld
8d733a1245 xwayland: Always allow writing into clipboard
Overriding contents is no security issue and this is necessary for a
bunch of apps to work correctly.
2025-04-02 17:26:09 +02:00
Victoria Brekenfeld
2e2ca3eda0 xwayland: Allow pasting into fullscreen surfaces 2025-04-02 17:26:09 +02:00
Ian Douglas Scott
0c95871bd0 shell/workspace: Disambiguate output with edid match by connector name
If two displays have the same edid (which shouldn't happen, since edid
includes a serial number, but is somewhat common in practice with
identical monitors), match output stack by comparing both edid and
connector name.

If we get the same edid but a different connector, `set_output`
truncates but also adds the new one. (Before adding edid matching, this
would have just added to the output stack.)

`prefers_output()` will requrire a connector name match if the edid of
the current output is the same as that of the output being compared.
2025-04-02 13:40:56 +02:00
Ian Douglas Scott
70ed075e80 shell/workspace: Store edid in output stack
Matches by edid where present, or by connector name if there is no edid
information.
2025-04-02 13:40:56 +02:00
Ian Douglas Scott
75aab6e282 shell/workspace: Clear output stack when moved user moves workspace
If the user explicitly moves a workspace to an output, assume that is
where the user wants it, so it shouldn't be moved back to a different
output in the future.

For persistent workspaces, the explicitly set workspace is the one that
will be stored, instead of trying to track an unbounded list of outputs
persistently.
2025-04-02 13:40:56 +02:00
Ian Douglas Scott
e74eafce2c Add EdidProduct, as user data for kms Outputs
This is the same as `libdisplay_info::edid::VendorProduct`, but with
implementations for `Serialize`, `Eq`, etc.
2025-04-02 13:40:56 +02:00
Ian Douglas Scott
2fe5897db0 Replace screencopy with ext-image-copy-capture-v1 2025-04-01 18:22:42 +02:00
Hugo
2b8a3f7894 Argument support with clap_lex 2025-03-31 18:16:31 +02:00