Commit graph

78 commits

Author SHA1 Message Date
Ian Douglas Scott
2728a9ee71 protocol/workspace: Fix behavior with multiple manager instances
Similarly to https://github.com/pop-os/cosmic-comp/pull/1061, track a
weak reference to the manager each workspace/group instance was created
from, instead of just matching by client.
2025-02-13 11:31:38 +01:00
Ian Douglas Scott
723f758439 protocol/workspace: Add support for ext-workspace-v1
To support both `ext-workspace-v1` and `cosmic-workspace-unstable-v1`,
the API exposed by `wayland/protocols/workspace` now uses the ext
workspace `State` and `GroupCapabilties` bitfields, and converts them to
the cosmic types for the cosmic implementation.

`WorkspaceCapabilities` is a custom type that has cosmic-specific and
ext-specific variants, and is mapped on both backends.

The ext protocol adds an `.assign` request on workspaces, which is
added here, though not currently used.

It also adds an `.id` event. Which we'll probably want when we have
persistent workspaces, but it isn't needed currently.

We still need to add an extension protocol of ext-workspaces to replace
a couple cosmic protocol features.
2025-02-13 11:31:38 +01:00
Ian Douglas Scott
aa15c00d12 protocol/workspace: Move cosmic dispatch code to seperate file 2025-02-13 11:31:38 +01:00
Ian Douglas Scott
7822030e0b workspace: Fix race between binding wl_output and output_enter
https://github.com/pop-os/cosmic-comp/pull/668 previously did this for
toplevel events, but missed the fact that the workspaces protocol has
the same issue.

Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/61.
2025-01-27 15:07:59 -08:00
Victoria Brekenfeld
39528878f8 toplevel_info: Don't send geometry updates, while resizing 2025-01-16 19:44:12 +01:00
Ian Douglas Scott
c9f740210f toplevel-info: Send initial state even if empty
This is imported given how
https://github.com/pop-os/cosmic-protocols/pull/39 uses this event.

But the protocol spec also states the event "is emitted on creation" so
this is seemingly incorrect regardless.
2025-01-08 00:49:02 +01:00
Ian Douglas Scott
b685512127 Migrate away from Rectangle::from_loc_and_size
Deprecated in `smithay` by https://github.com/Smithay/smithay/pull/1621.
2025-01-07 12:50:35 +01:00
Victoria Brekenfeld
61b0dddf50 chore: Fix a few warnings 2025-01-06 20:23:05 +01:00
Ian Douglas Scott
1118aa2877 When removing output global, use disable_global, remove with timer
This should fix an issue where output hotplug can sometimes cause
clients (including XWayland) to crash with a protocol error trying to
bind the output.

Using a timer doesn't seem ideal, but seems to be the correct way to do
this at present. Wlroots `wlr_global_destroy_safe` is basically the same
as this.

Adding a `LoopHandle` argument to `OutputConfigurationState::new` seems
awkward, but maybe better than a handler method for removing globals.
(`IdleNotifierState::new` also takes a `LoopHandle`). Perhaps Smithay
could provide some kind of helper for this.
2024-12-19 00:17:38 +01:00
Ian Douglas Scott
6707c92522 toplevel-info: Fix behavior with multiple instances of global
Instead of looking for toplevel handles for the client, look for
toplevel handles for the specific global instance.
2024-12-14 09:32:11 +01:00
Ian Douglas Scott
0d0b89d538 Call data_init.init even if weak references are not alive 2024-12-11 10:58:42 +01:00
Ian Douglas Scott
16a1214207 output_configuration: Use unwrap in calls to Resource::data
Having if conditions for these is unnecessary when they should never be
reached. (This is commonly unwrapped in `smithay`.)

Some of these else conditions fail to call `data_init.init` with a new
id, so they'd result in a crash later anyway.
2024-12-11 10:58:42 +01:00
Ian Douglas Scott
fdfc5cbeb4 Use WeakOutput when accessing data of ZwlrOutputHeadV1
It seems cd9ff0b7bb broke mirroring.
Though it's also a bug that if any of these if conditions is not met,
the data will not be initialized.

Fixes https://github.com/pop-os/cosmic-epoch/issues/1341.
2024-12-11 10:58:42 +01:00
Ashley Wulber
76863aaf9b fix: filter by active workspace in overlap notify 2024-12-05 18:20:10 +01:00
Ashley Wulber
a14d075aa0 refactor: add namespace 2024-11-27 17:23:14 +01:00
Ashley Wulber
60558e18fd overlay-notify: Implement handler 2024-11-27 13:20:18 +01:00
Ashley Wulber
895261c2bf overlap-notify: Implementation fixes 2024-11-27 13:20:18 +01:00
Victoria Brekenfeld
81b9fb179b output-configuration: Support cosmic-ext v2 2024-11-27 09:37:01 +01:00
Victoria Brekenfeld
80965a61b9 kms: Adaptive VRR support 2024-11-27 09:37:01 +01:00
Ian Douglas Scott
cd9ff0b7bb output_configuration: Use WeakOutput as user data instead of Output 2024-11-18 18:24:53 +01:00
Ian Douglas Scott
8d7f491830 Use WeakOutput instead of Option<WeakOutput> 2024-11-18 18:24:53 +01:00
Ian Douglas Scott
61692b21ad Run cargo format 2024-11-18 18:24:53 +01:00
Ian Douglas Scott
4db2e3ec25 Use new primary scanout output if old output is disabled
`Output` in Smithay doesn't track if the output still exists, other than
based on whether or not it has strong references. Which doesn't seem to
be working correctly.

There may be leaked strong references to `Output`s somewhere, and maybe
Smithay should track if an output is still valid, generally when it is
exposed as a Wayland global
(https://github.com/Smithay/smithay/issues/1584). But a check like this
works for now.

Addresses https://github.com/pop-os/cosmic-comp/issues/985.
2024-11-13 23:34:30 +01:00
Ian Douglas Scott
9f354ab45f output_configuration: Set enabled to false in remove_heads
`add_heads` will set it to `true` again, if used on the same `Output`.
It doesn't like like cosmic-comp's usage of this does that currently
though.
2024-11-13 23:34:30 +01:00
Ian Douglas Scott
90883c6ab1 Add cosmic_atspi_v1 protocol
Used to provide a backend for `AtspiDevice` in `at-spi2-core`, so Orca
keybindings can work.
2024-10-31 18:49:56 +01:00
Victoria Brekenfeld
743e5d4360 toplevel_info: Fix racy data creation 2024-10-25 11:05:41 +02:00
Ian Douglas Scott
ea27ec5e28 DPMS with wlr-output-power-management-unstable-v1 protocol 2024-10-25 10:31:24 +02:00
Ian Douglas Scott
540ed3d170 Use to_ne_bytes() instead of unsound Vec::from_raw_parts
`from_raw_parts()` is only sound if the alignment is the same, so it
can't be used to covert to a `Vec<u8>` from a type with a greater
alignment.

This isn't hard to avoid, luckily.
2024-10-21 18:10:53 +02:00
Victoria Brekenfeld
bd04d68106 overlap-notify: Initial implementation 2024-09-23 10:55:00 +02:00
Victoria Brekenfeld
9c7c41c508 toplevel-info/mgmt: Update to v2/v3 2024-09-23 10:55:00 +02:00
julianbraha
52ad30c264 Remove unnecessary lifetimes 2024-08-30 17:53:56 +02:00
Ian Douglas Scott
c1bf410466 toplevel-info: Fix race between binding wl_ouput and output_enter
This fixes an issue with `cosmic-panel` where, when a workspace is moved
back to an output after a monitor is disconnected and reconnected, the
panel doesn't hide because `cosmic-panel` thinks no toplevel is open on
that monitor.

After some testing, it seems `output_enter` isn't being sent here. In
particular, the `output_leave` call happens before the client binds the
`wl_output`, so there is no `wl_output` to send in an event yet.

This is addressed by keeping track of a set of `wl_output`s that we have
sent the event to. So if an output is bound, `refresh` can add it to
this list and send the event.

This is not needed for workspaces (though it could be done similarly)
since the handle objects are created by server events. So no race should
occur as long as the workspaces global is bound before the toplevel info
one.
2024-08-01 16:35:26 +02:00
Victoria Brekenfeld
07d505d68f chore: Cleanup unused imports 2024-06-27 16:42:41 +02:00
Victoria Brekenfeld
76fca0c591 chore: Fix smithay version 2024-06-26 16:18:08 +02:00
Victoria Brekenfeld
954aa6edeb output-management: Handle destroy requests better 2024-05-07 12:25:15 +02:00
Victoria Brekenfeld
45bdffe802 output-management: Correctly advertise enabled-state for mirrored outputs 2024-05-07 12:25:15 +02:00
Victoria Brekenfeld
5f4377bf59 wayland: Add cosmic-output-management 2024-05-07 12:25:15 +02:00
Victoria Brekenfeld
98ec82db77 output-configuration: Add vrr state 2024-05-07 12:25:15 +02:00
Victoria Brekenfeld
4b71674e10 output-configuration: Support release-requests / v3 2024-05-07 12:25:15 +02:00
Ian Douglas Scott
c4fc91d6e9 screencopy: Don't send fail after ready
Cosmic-workspaces was having an issue when the compositor sent `ready`,
`failed`, then `stopped`. This could be worked around client-side, but
presumably the compositor should never send more than one
`failed`/`ready` for a particular frame.

It seems cleaner to have `FrameInner::fail` as the only place that sends
`failed`. So any checks can be there. I believe the logic there should
be appropriate for every call.
2024-05-03 14:21:30 +02:00
Ian Douglas Scott
3697494146 screencopy: Fix reference cycle, that leaks buffer
Before this, `/proc/$(pidof cosmic-comp)/maps` quickly expands in length
when cosmic-workspaces is opened and closed a bunch of time, preventing
the GPU memory from being freed. Which on my Intel system can lead to
OOM eventually.

There may be other leaks to deal with, but `maps` no longer shows this
issue.
2024-04-30 13:05:16 +02:00
Victoria Brekenfeld
5d5a510691 state: Move shell behind RwLock 2024-04-16 18:50:54 +02:00
Victoria Brekenfeld
11a8265145 toplevel-info: Also send workspace info for new windows 2024-04-11 13:28:49 +02:00
Victoria Brekenfeld
b40d153809 cosmic-screencopy-v2 2024-03-25 16:55:31 +01:00
Victoria Brekenfeld
973cfed87b shell: Handle unmapped windows correctly 2024-03-25 12:51:01 +01:00
Victoria Brekenfeld
3eb7e5f82e shell: implement minimize 2024-03-04 19:20:52 +01:00
Victoria Brekenfeld
ef3486f7e0 kms: Track used devices and free resources 2024-02-19 13:09:49 +01:00
Ian Douglas Scott
b8e5dbea8f Advertise version 2 of zcosmic_workspace_manager_v1 global 2024-02-07 21:40:23 +01:00
Victoria Brekenfeld
226bf7f49d workspace: Add tiling_state 2024-02-07 21:40:23 +01:00
Ian Douglas Scott
b2b718dbea Update smithay 2024-01-08 12:43:41 +01:00