Commit graph

288 commits

Author SHA1 Message Date
Daniel
2553810621
grabs: Snap Window Edges to Close Output Edges 2025-02-14 11:58:09 +01:00
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
Victoria Brekenfeld
b2ba402e2d wl_compositor: Send initial size for maximized/fullscreen surfaces 2025-02-07 13:02:42 +01:00
Victoria Brekenfeld
b793975689 shell: Don't animate programmatic maximize_requests 2025-02-07 13:02:42 +01:00
Victoria Brekenfeld
156f634944 shell: Handle maximize requests before commit 2025-02-07 13:02:42 +01:00
Ian Douglas Scott
63995c4919 Remove CosmicMapped::stack_ref_mut
The methods of `CosmicStack` take `&self`, so this isn't actually needed
for anything.
2025-01-28 10:13:52 -08:00
Ian Douglas Scott
649547d3cc toplevel-management: Move window, not whole stack
If the window is part of a stack, remove it then map it outside of the
stack, before calling `Shell::move_window.` Somewhat similar to the code
in `Shell::move_request`.

It would be more elegant if `move_window` handled this in some way, but
I can't think of a way to change the API there that would be better than
this.

(Perhaps some of the naming of methods could also be updated, given
"window" in functions like this means a `CosmicMapped`.)

Protocol support for moving workspaces would also be useful, but should
involve a new protocol object representing the stack.

Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/41.
2025-01-28 10:12:38 -08:00
Ian Douglas Scott
9b3a42d450 toplevel-management: Make move_to_workspace work with minimized window
Iterating over `.windows()` for each workspace does not iterate over
`minimized_windows`, so `from_workspace` was not found. Simply changing
this to use `element_for_surface` and `space_for` (like `fullscreen` and
`unfullscreen`) fixes this.

Addresses https://github.com/pop-os/cosmic-workspaces-epoch/issues/89.
Though it does unminimize the window, which we may also want to change.
2025-01-28 10:12:38 -08: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
9dddead15d Add linux-drm-syncobj-v1 protocol 2025-01-15 20:20:53 +01:00
Ian Douglas Scott
1a3494e481 Use get_unconstrained_geometry function for popup position 2025-01-15 00:19:46 +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
Victoria Brekenfeld
ff22b98ec7 output_configuration: Better log errors 2025-01-07 17:48:06 +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
db13eea91c shell: Allow active workspace to be None 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
546966bf15 drm_lease: Disable overlay planes when active 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
8b87d6524e kms: Use new DrmOutput api 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
e356e3c589 xdg_activation: Also consider tiled windows 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
61b0dddf50 chore: Fix a few warnings 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
f12f4db0e1 chore: Update smithay 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
2c01c94477 fix: activation of an element outside the current workspace
If the activated element is outside the current workspace, its workspace should be set to urgent
2024-12-10 17:37:01 +01:00
Ashley Wulber
76863aaf9b fix: filter by active workspace in overlap notify 2024-12-05 18:20:10 +01:00
Victoria Brekenfeld
fc84fa9948 shell: Fix windows global geometry to include ssd 2024-12-05 18:20:10 +01:00
Alyssa Ross
69d251fb74 screencopy: don't force opaque window backgrounds
This meant that, for windows that were not fully opaque, there was no
way to capture their transparency.  No way to put a window with
transparency on top of a background in OBS, for example.
2024-12-02 18:02:48 +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
Victoria Brekenfeld
d72bf54628 deps: Update smithay 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
Ian Douglas Scott
a96394f7a6 Update egui, smithay-egui, smithay 2024-10-02 23:55:10 +02:00
Christian Meissl
afdb656778 dnd: correct handling of cursor buffer offset 2024-09-23 11:13:21 +02:00
Victoria Brekenfeld
bd04d68106 overlap-notify: Initial implementation 2024-09-23 10:55:00 +02:00