Commit graph

311 commits

Author SHA1 Message Date
Ian Douglas Scott
c92c18e09e Use Global coordinate instead of inferring as Logical
Inference behavior can be confusing, and the coordinate here is global,
so use `Global` like the `PointerMotion*` event handlers.
2026-07-21 17:02:58 +02:00
Ian Douglas Scott
2648aea0df image-copy: Move duplicate code to a cursor_capture_constraints()
This ensures we avoid advertising a `0,0` buffer size (which will
protocol error to actually allocate), and avoids defining the supported
formats for cursor capture buffers in a bunch of places.
2026-07-21 17:02:58 +02:00
Ian Douglas Scott
27956e6e00 Make cursor_geometry() return a CursorGeometry struct
A bit better than just a tuple.
2026-07-21 17:02:58 +02:00
RipleyTom
8955024bff Fix: improve edge pointer accuracy 2026-07-21 15:50:19 +02:00
Victoria Brekenfeld
9b5a2a0f83 chore: Fix feature gate for logind 2026-07-20 17:28:15 +02:00
Hojjat
2329cea5c9 fix: input to cropped tiled windows should be bound to the tile 2026-07-15 22:55:05 +02:00
Erik
7ee78d9c13 Forward axis relative direction to Wayland clients.
Libinput reports natural scrolling via AxisRelativeDirection. Qt sets
QWheelEvent::inverted() from wl_pointer.axis_relative_direction. COSMIC
was forwarding axis values but not the direction hint.

Tested on Fedora 44 COSMIC Wayland with Telegram Desktop (native Wayland),
natural scrolling enabled — horizontal touchpad swipes fixed.

Assisted-by: AI (root-cause analysis)

Signed-off-by: Erik <erik-balfe@users.noreply.github.com>
2026-07-13 21:19:27 +02:00
Victoria Brekenfeld
43d6145afd chore: fix warnings with no features 2026-07-09 18:08:01 +02:00
Victoria Brekenfeld
eb41b076ed render: Use NamespaceElements to fix blurred lower layer-shell surfaces 2026-07-09 18:08:01 +02:00
Skygrango
296b6bee23 wayland: reject cursor hint requests that are outside the surface bound 2026-06-16 14:49:28 -06:00
Anthony T. Lannutti
821b431973 feat: separate logind feature from systemd
Move logind-zbus to a dedicated 'logind' feature that is independent
of the 'systemd' feature. This allows non-systemd users (e.g., OpenRC
with elogind) to access lid switch inhibition and lid status detection
without requiring the full systemd stack.

The 'systemd' feature now depends on 'logind' to maintain backward
compatibility, so existing users are unaffected.

Feature configuration:
- default: ["systemd"]
- logind: ["logind-zbus"]
- systemd: ["libsystemd", "logind", "tracing-journald"]

Resolves #2473

Coding-Agent: OpenCode
Model: claude-sonnet-4-5
2026-06-16 14:41:51 -06:00
Ian Douglas Scott
82dcd9a46a image-copy: Don't send 0x0 buffer params for cursor capture
Fixes panics in `xdg-desktop-portal-cosmic` when it tries to use cursor
capture, and an application hides the cursor.
2026-06-09 10:42:48 -07:00
Ian Douglas Scott
4a8931896f image-copy: Subtract output position for pointer position sent to client 2026-06-09 10:42:48 -07:00
Ian Douglas Scott
b6b76e1d4a image-copy: Don't send redundantly pointer changes on fullscreen
The code for sending pointer position changes for toplevels should
handle this adequately; no need to also handle it here.
2026-06-09 10:42:48 -07:00
Ian Douglas Scott
4eaaf4f55c dbus: Refactor to share DBus connections
We should avoid creating more than one session connection or more than
one system connection. We should also ideally avoid blocking the main
thread.

For now this still uses blocking in a couple places, but wrapping async
code (which is how `zbus::blocking` is implemented anyway).

This moves the `NameOwners` creation out of `A11yKeyboardMonitorState`,
so it can be shared with other things. We will likely want that for
https://github.com/pop-os/cosmic-comp/pull/465 to define a secured
protocol to pass an fd to the portal, and potentially any other
sensitive DBus protocols implemented by the compositor.
2026-06-08 19:03:50 +02:00
Hojjat Abdollahi
28ef6bdbc8
feat: support multiple fullscreen windows per workspace 2026-06-02 17:48:33 +02:00
Skygrango
203cad8cbd shell: disable WindowUI detection if constraint is active 2026-06-01 07:52:42 -07:00
Skygrango
208c2128cd wayland: implement new_constraint, remove_constraint and cursor_position_hint for PointerConstraintsHandler
new_constraint: check if the surface has pointer focus, keyboard focus, and if the pointer is within toplevel geometry or constraint region. If these conditions are met, then enable the constraint.

remove_constraint: apply last cursor position hint that saved in seat.

cursor_position_hint: save the cursor position hints provided by the client to the seat.
2026-06-01 07:52:42 -07:00
Skygrango
9702aae523 input: when updating pointer in the confined mode, recalibrate to the valid coordinates 2026-06-01 07:52:42 -07:00
Skygrango
a533ac1ec3 input: implement apply_cursor_hint 2026-06-01 07:52:42 -07:00
devpa
22fe419747 input: allow layout switching and brightness/volume control under session lock 2026-05-27 16:43:39 +02:00
Niklas Herder
28258e5a5f cursor: Add idle-hide timeout
Adds a cursor_hide_timeout config key (Option<u32> seconds) to
CosmicCompConfig. When set, the cursor is hidden after the configured
period of pointer inactivity and revealed again by any pointer event.
Touch input does not count as activity (no visible cursor to surface).

Implementation:
- Per-seat hidden flag, calloop timer token, and last-armed Instant on
  CursorStateInner.
- notify_cursor_activity called from each pointer-related input branch
  (motion, button, axis, tablet) resets the flag and reschedules the
  timer; rapid successive calls are coalesced behind a 100ms throttle
  so high-frequency mice don't churn the calloop timer source.
- On timer fire, the hidden flag is set, draw_cursor short-circuits to
  an empty element list, and a render is scheduled. Active pointer
  grabs (drags, resizes) suppress the hide.
- Config reload arms or cancels the timer immediately; None as the
  configured value collapses the cancel path into the same function.

Closes #2231.

Drafted with Claude (Anthropic); reviewed and tested by the committer.
2026-05-22 14:14:17 +02:00
Tom Grushka
657f0aeddf revert self.update_zoom to update with wheel 2026-05-19 16:30:46 -06:00
Tom Grushka
92fcceba54 fix(magnifier): smooth mouse wheel zoom and respect natural scroll direction
- Disable animation for mouse wheel zoom to eliminate the timing race
  that causes lag and sudden jumps. Each wheel tick now zooms instantly.
- Invert zoom direction when natural scrolling is enabled so that
  forward scroll zooms in, matching macOS/Windows behavior.
2026-05-15 15:51:24 -06:00
ZeusCraft10
21679f215a fix: Prevent system hang on double Caps Lock press 2026-04-20 12:10:07 -06:00
olekawaii
4df95190db Add setting to toggle workspace wrapping 2026-04-14 17:42:57 +02:00
Vukašin Vojinović
2ca99c670a chore: clippy 2026-03-18 18:19:03 +01:00
Ilia Malanin
110c11eff9 fix(keyboard): Fix keyboard shortcuts for non-Latin layouts 2026-02-17 12:09:38 +01:00
Ian Douglas Scott
cac7a5aca6 image-copy: Use abstraction that's now provided by Smithay
This doesn't change much, since the Smithay implementation is based on
the `cosmic-comp` version, but made more generic. We provide our own
implementation for our workspace capture protocol, but otherwise Smithay
handles the boilerplate now.

This should not cause any change in behavior.
2026-02-05 02:01:14 +01:00
Vukašin Vojinović
9e143da814 fix(input): pointer clamping
- Reduces the max clamp value by 1, since it previously ended up 1 pixel off screen. Fixes #981.
- Moves clamping to before  `new_under`, since it previously ignored any motion that goes off screen, causing issues in some fullscreen clients. Fixes #1286.
2025-12-22 16:29:22 +01:00
Victoria Brekenfeld
77d3605fb9 Update smithay for DnD updates 2025-12-04 20:17:12 +01:00
Ian Douglas Scott
6025f483d6 input: Clear modifier_queue on a11y grab
This might be needed if a grab included `super`.
2025-11-24 13:53:05 -08:00
Ian Douglas Scott
1c35339076 input: Use suppresssed_keys() for a11y grabs
This mostly seems to behave the same way, but presumably we want a key
release to be treated as grabbed if and only if the press had been.
2025-11-24 13:53:05 -08:00
Ian Douglas Scott
a3904af03c wayland: Remove atspi protocol
If we want to use the `org.freedesktop.a11y.KeyboardMonitor` protocol on
Pop!_OS, there is no need to support the Cosmic-specific protocol that
requires an `at-spi2-core` patch.
2025-11-24 13:53:05 -08:00
Ian Douglas Scott
f065143d3e dbus: Implement org.freedesktop.a11y.Manager protocol
This protocol is now the upstream solution in at-spi2-core/orca for
registering keyboard grabs and watching key events. It should also be a
bit better than the current verious of our custom Wayland protocol for
this purpose.

Like Mutter and Kwin, we currently restrict this to only be called by
the client that holds the name `org.gnome.Orca.KeyboardMonitor` on the
session bus. We also send the `KeyEvent` signal only to registered
watchers, rather than broadcasting, as DBus does by default.
2025-11-24 13:53:05 -08:00
Victoria Brekenfeld
8624928052 gestures: Cycle through workspaces 2025-11-21 09:10:01 -07: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
Vukašin Vojinović
1f7f0c70b7 chore: format for Rust 2024 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
b19f66702f
shortcuts: touchpad toggle keybind 2025-09-19 15:33:10 +02:00
Victoria Brekenfeld
b83e9f1d32 config: Make read_outputs failable
Previously we ignored when we had no output configuration
**and** failed to apply the automatically created one.

This leads to two problems:
- If this happens on startup, we end up with no outputs being added to the shell and we quit.
- If this happens later, we might end up in an inconsistent state, where the shell thinks we have an output, when it didn't light up for similar reasons.

Thus `read_outputs` is failable and handling that very much depends on
the where is was called from, because `read_outputs` doesn't know what
configuration was active before.

Thus make it failable and provide useful mitigations everywhere
possible:
- Try to enable just one output in case we fail on startup.
- Don't enable any additional outputs, when we fail on hotplug.
- Log the error like previously in any other case (and come up with more
  mitigations, once we understand these cases better).
2025-09-15 09:13:00 +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
Victoria Brekenfeld
b28f92a6e1 focus: Don't consider XWaylandGrab exclusive 2025-08-16 01:19:35 +02:00
Victoria Brekenfeld
e63921a1f6 input: Handle sticky windows on super+right-click 2025-08-13 16:03:03 +02:00
Victoria Brekenfeld
74e90f793f state/lid-inhibit: Take current lid state into account 2025-08-11 18:47:57 +02:00
Victoria Brekenfeld
7ccfd7381e input: Handle lid-switch and disable/enable built-in display 2025-07-31 12:59:32 +02:00
Ian Douglas Scott
a74c90f14f input/actions: Clear keyboard focus moving to output with no window
Fixes https://github.com/pop-os/cosmic-comp/issues/1474.
2025-07-14 20:38:16 +02:00
Ian Douglas Scott
4cf319c09c input/actions: Change focus_follows_cursor to cursor_follows_focus
This caused confusing behavior when "focus follows cursor" was enabled,
but "cursor follows focus" was not. `update_focus_state` only updates
the cursor position if `cursor_follows_focus` is set, so this wasn't
actually moving the pointer when expected.

I presume this was a mistake, and `cursor_follows_focus` was intended
here.
2025-07-14 20:38:16 +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