Commit graph

827 commits

Author SHA1 Message Date
Ian Douglas Scott
7fd033295f focus-stack: Keep dragged surface in focus stack in move_request()
Replacement for https://github.com/pop-os/cosmic-comp/pull/1687, that
works correctly with multiple outputs.

We don't want another window to show a focus indicator while a window is
being dragged, so keep the window in the focus stack. If a window is
being moved out of a stack, change the focus from the stack to the
window.

`refresh_focus_stack()` doesn't seem to be called here, but for good
measure, make sure that calling that function also won't remove a
`CosmicMapped` from the focus stack if it is currently part of a move
grab for the seat.
2025-11-04 15:41:08 -08:00
Ian Douglas Scott
e09fcec9f3 Use keyboard focus target rather than focus_stack in keybindings
`Action::Close` already used the keyboard focus target, but some other
bindings didn't. Presumably it's most intuitive if all "current window"
key bindings affect the window with keyboard focus.

These used the focus stack on the `focused_output()` (the one with
keyboard focus), so I guess the main impact is when the keyboard target
is a window being dragged? Then the binding will operate on that window,
or have no effect.

This seems related to some of the behaviors discussed in
https://github.com/pop-os/cosmic-comp/issues/453.
2025-11-04 15:41:08 -08:00
Ian Douglas Scott
12857672f6 Use shift_remove() instead of retain() in unmap_element() 2025-11-04 15:41:08 -08:00
Ian Douglas Scott
f230a23bd0 focus-stack: Use IndexSet::shift_remove() for remove
This seems like the correct way to use an `IndexSet`. It shouldn't be
possible to have multiple entries that match, since it's a "set".

We can't define `Borrow<CosmicMapped> for FocusTarget`, so the blanket
impl of `indexmap::Equivalent` won't work, but implementing seems fine.
2025-11-04 15:41:08 -08:00
Ian Douglas Scott
505e36dcda Make CosmicWindowInternal/CosmicStackInternal not Clone
`IcedElement` uses `Arc` internally (and compares with `Arc::ptr_eq`).
So these structs are never cloned, and probably shouldn't be.
2025-11-04 15:41:08 -08:00
Yureka
a74b6e3a9b Add hooks for custom window decorations
This is a first use of the new hooks system, which allows customizing
cosmic-comp at compile-time.
In this case, the view() function of CosmicWindow / CosmicStack is
hooked and the hook can change what is rendered as the header bar.

Signed-off-by: Yureka <yuka@yuka.dev>
2025-10-29 11:27:14 +01:00
Vukašin Vojinović
1f7f0c70b7 chore: format for Rust 2024 2025-10-22 23:55:11 +02:00
Vukašin Vojinović
b6c5d00bec cargo fmt 2025-10-22 23:55:11 +02:00
Vukašin Vojinović
5e9ea93819 chore: manual clippy 2025-10-22 23:55:11 +02:00
Vukašin Vojinović
0847247c33 chore: clippy 2025-10-22 23:55:11 +02:00
Ashley Wulber
3465ce7602 feat: corner radius for CosmicMapped 2025-10-03 20:11:16 +02:00
Ashley Wulber
242e465d42 fix(corner-radius): use cached state 2025-10-03 20:11:16 +02:00
Ashley Wulber
e476153086 fix(outline): pass the radii in the correct order for the shader 2025-10-03 20:11:16 +02:00
Ashley Wulber
2873d6b27e fix(corner-radius): properly handle no value, and use geometry 2025-10-03 20:11:16 +02:00
Ashley Wulber
6f93b8774d cleanup use statements 2025-10-03 20:11:16 +02:00
Ashley Wulber
2d9d83d3bd fix(corner-radius): guard against corner radius being too large 2025-10-03 20:11:16 +02:00
Ashley Wulber
f01ebf2f6f refactor(corner-radius): corner_radius method for CosmicSurface 2025-10-03 20:11:16 +02:00
Ashley Wulber
8ddd14a54f cleanup: remove TODOs 2025-10-03 20:11:16 +02:00
Ashley Wulber
c6320eec0c fix: support per-corner radius
also adjusts the radius by half of the outline thickness. I believe this is the radius at the center of the outline.
2025-10-03 20:11:16 +02:00
Ashley Wulber
b3aa10436a feat: corner-radius protocol support 2025-10-03 20:11:16 +02:00
Ian Douglas Scott
346f055fdc focus: Check if X11 surface matches in KeyboardFocus::replace()
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.
2025-10-02 16:27:29 +02:00
Ian Douglas Scott
9e66bed9d6 focus: Split off an x11_surface() method from is_xwm() 2025-10-02 16:27:29 +02:00
Victoria Brekenfeld
f339e21479 floating: Keep elements positioned relatively on recalculate 2025-09-22 18:07:10 +02:00
Ashley Wulber
b19f66702f
shortcuts: touchpad toggle keybind 2025-09-19 15:33:10 +02:00
Ian Douglas Scott
b75be5b305 Remove last_cursor_position from CosmicMapped
Since 5459f52d, this is no longer ever set.
2025-09-18 23:36:30 +02:00
Ian Douglas Scott
d8281ed51b shell: Handle WorkspaceMode::Global in move_workspace()
If workspaces span across outputs, the `Workspace` at a particular
index should be moved on every `WorkspaceSet`.
2025-09-18 23:35:22 +02:00
Ian Douglas Scott
b8ffc89948 shell: Make migrate_workspace() a no-op on global workspace mode
Doing nothing may be a bit confusing, but `MigrateWorkspaceToOutput`
isn't bound by default anyway.
2025-09-18 23:35:22 +02:00
Victoria Brekenfeld
7684cd1b2c render: Fix shader obj leak 2025-09-08 14:47:06 +02:00
19MisterX98
c9e64acad2 fix: don't assume previous workspace still exists #1588 2025-09-04 12:17:12 +02:00
Ian Douglas Scott
e54f4b4963 protocols/workspace: Set ext workspace id for pinned 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.
2025-08-22 11:58:07 +02:00
Vukašin Vojinović
7f7ab8bcbe chore: Rust 2024 edition
Set the formatting style to 2021 edition to avoid disrupting existing work.
Remove when possible.
2025-08-21 13:10:11 +02:00
Vukašin Vojinović
fec7c94605 chore: use std::sync::LazyLock 2025-08-21 13:10:11 +02:00
Victoria Brekenfeld
b28f92a6e1 focus: Don't consider XWaylandGrab exclusive 2025-08-16 01:19:35 +02:00
Victoria Brekenfeld
73ff0e2c1c floating/resize: Don't panic if something else cancelled the resize 2025-08-15 16:25:44 +02:00
Victoria Brekenfeld
0095b6d505 order: Newer override-redirect windows are higher in the stack 2025-08-13 16:27:44 +02:00
Victoria Brekenfeld
fce9691947 shell: Correctly handle maximized stacks on move requests 2025-08-13 16:03:03 +02:00
Ian Douglas Scott
2fbf0081ea Fix compile warnings on nightly
Should fix CI test.
2025-08-12 18:03:27 -04:00
Victoria Brekenfeld
c3d2b5f0b7 element: Allow overriding default scanout behaviour 2025-08-07 19:40:23 +02:00
Victoria Brekenfeld
be1424f1ca render/wayland: filter scanout candidates by frametime estimation 2025-08-07 19:40:23 +02:00
Victoria Brekenfeld
9f4db0b28b floating: Properly scale positions on migration (fixes #1167) 2025-08-04 17:11:46 +02:00
Michael Aaron Murphy
86493b7898 improv(stack): use system theme colors 2025-07-31 17:19:49 +02:00
Victoria Brekenfeld
8648d4450e utils: Abstract built-in output check 2025-07-31 12:59:32 +02:00
Ian Douglas Scott
d6c1ca8c33 Use &dyn to simplify pointer/keyboard/touch target dispatch
Requires https://github.com/Smithay/smithay/pull/1334.
2025-07-30 19:01:32 +02:00
Ashley Wulber
f2d6f70e13 fix: only activate the active window of the stack on activation 2025-07-22 13:31:24 +02:00
Daniel
7f814a445c
fix: Apply window snapping properly on multiple-output configurations (#1529) 2025-07-18 13:02:09 +02:00
Ian Douglas Scott
3debae2495 input/actions: Change active workspace / output when migrated
Without this, a workspace moved with the key binding seems to disappear.
This seems more consistent with the behavior of other key bindings.
2025-07-14 20:38:16 +02:00
Ian Douglas Scott
8aa501c0e0 shell: Make activate/end_workspace_swipe return Err if no set
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.
2025-07-14 20:38:16 +02:00
Ian Douglas Scott
6f5a14e95c shell: Make activate return Some on Global workspace mode
This seems to have been returning `Ok(None)` erroneously. Fixing this
corrects output changing keybindings on global workspace mode.
2025-07-14 20:38:16 +02:00
Victoria Brekenfeld
505d9c4039 tiling: fix missing output_enter/set_bounds on remap 2025-07-14 17:38:35 +02:00
Victoria Brekenfeld
7a52eff61e workspace: Animation and geometry fixes around maximized windows 2025-07-04 19:45:54 +02:00