Commit graph

267 commits

Author SHA1 Message Date
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
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
Victoria Brekenfeld
adedb705e7 shell: handle fullscreen windows on a dedicated layer
I hoped to split this up into multiple commits, but the api
changes to `shell/workspace.rs` were to invasive to feasibly do this.

Here is a rough list of changes:

- Fullscreen windows aren't mapped to other layers anymore
  - This they need their own logic for:
    - Sending frames
    - Dmabuf Feedback
    - Primary outputs
    - On commit handlers
    - cursor tests
  - They get their own unmap/remap logic
  - They get a new restore state similar to minimized windows
    - Refactored the minimized window state to reuse as much as possible
      here
  - They need to be part of focus stacks, which means adjusting them
    to a new type `FocusTarget` as they previously only handled
    `CosmicMapped`.
  - Various shell handlers (minimize, move, menu) now have dedicated
    logic for fullscreen surfaces
    - This was partially necessary due to relying on CosmicSurface now,
      partially because they should've had their own logic from the
      start. E.g. the context menu is now reflecting the fullscreen
      state
- Fullscreen windows may be rendered behind other windows now, when they
  loose focus.
  - This needed changes to input handling / rendering
2025-07-04 19:45:54 +02:00
Ian Douglas Scott
1564b9d1a3 Inhibit keyboard shortcuts if XWayland grab is active
This matches behavior in X11 sessions (Gnome and i3). It presumably is
reasonable to have the same behavior here as with Wayland-native
keyboard shortcut inhibition.
2025-07-02 11:16:53 +02:00
Ashley Wulber
8a3436edb2 Revert "feat: power button handling"
This reverts commit 534584b9e48fcae406094367bdcb911f8957a523.
2025-06-13 19:19:32 +02:00
Ashley Wulber
8e3590fb4d feat: power button handling 2025-06-13 18:40:30 +02:00
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
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
Victoria Brekenfeld
cbc4ad6fc2 xwayland: Allow eavesdropping on certain keyboard/pointer events 2025-04-02 17:26:09 +02:00
Victoria Brekenfeld
a0648a3a53 input: Don't trigger modifier shortcuts, when zooming 2025-03-28 18:35:06 +01:00
Victoria Brekenfeld
0ba0a0cdaa a11y/zoom: zoom level per output 2025-03-28 18:35:06 +01:00
Victoria Brekenfeld
83a7926748 a11y/zoom: Allow disabling scroll-shortcuts 2025-03-28 18:35:06 +01:00
Ian Douglas Scott
7340e2beff Improve handling of XDG activation tokens in shell
Requires https://github.com/Smithay/smithay/pull/1676.

This changes two things:
* `Workspace::is_empty` no longer checks if there are activation tokens,
  but a separate `Workspace::can_auto_remove` checks if the workspace is
  empty and has no activation tokens.
  - When we add workspace pinning, that can also be checked there.
* `Workspace` no longer contains a `pending_tokens` list that is updated
  on `refresh`. Instead, `can_auto_remove` takes the xdg activation
  state as an argument.

Since `Workspace::refresh` normally is run for focused workspaces, this
fixes allowing non-focused workspaces to be removed when an activation
token expires. It seems generally good to avoid tracking the activation
tokens in two places, and this is probably more efficient than needing
to refresh in more places.

By splitting this, we still don't remove an empty workspace if it has a
pending activation token, but we also don't add an empty workspace for
an activation token.

This mitigates the confusing behavior with activation tokens that aren't
used, but having to wait a few seconds in some cases before a workspace
is removed is still a little confusing. (We probably want `cosmic-term`
and `cosmic-workspace` to either consume the activation tokens they are
passed, or not be passed tokens when started by keybinding?)

Fixes https://github.com/pop-os/cosmic-comp/issues/1099.
2025-03-14 17:53:34 +01:00
Victoria Brekenfeld
ea1800f157 input: Fix events for subsurfaces of lock surface 2025-03-12 16:55:22 +01:00
Victoria Brekenfeld
d76f372c29 actions: Shortcut handling changes for #1005 2025-03-05 18:24:28 +01:00
Victoria Brekenfeld
e116f20396 stack: Remember previous position during focus navigation 2025-03-05 18:24:28 +01:00
Victoria Brekenfeld
f72d2b91f3 shell: Add zoom UI 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
e0530d2723 input: Refactor common logic into update_zoom 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
b7d4a66c22 input: Zoom on Super+Scroll 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
531a1c951f zoom: Handle multiple outputs 2025-02-20 23:51:55 +01:00
Victoria Brekenfeld
61d44b3a9d utils: Move NextDown 2025-02-20 23:51:55 +01:00
Daniel
2553810621
grabs: Snap Window Edges to Close Output Edges 2025-02-14 11:58:09 +01:00
Paul Daniel Faria
f1f9d205be
Make numlock state on boot configurable
Make numlock state on boot configurable

This will expose 3 settings for numlock behavior:
1. Numlock is off on boot (this is the current default behavior)
2. Numlock is on on boot
3. Numlock will restore the state from the last boot

Fixes #369

* Address comments:

Get keyboard after create_seat called rather than returning from
create_seat.
Use constants rather than magic numbers for keypress.
Only save updated modifier state after keypresses are handled/skipped.

* Remove unused import, fold other into existing use block.
2025-02-12 14:35:22 +01:00
Joe Neeman
38366700de Only cancel the keyboard grabs that we initiate 2025-01-17 15:49:13 +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
Paul Daniel Faria
e5263bbad8 Update leds when devices are added
This fixes #1104

LEDs on keyboard will now update to match the
compositor state when they're plugged in.
2025-01-06 12:13:51 +01:00
Ian Douglas Scott
e3b41c5c55 input: Apply output transform to touch/tablet events 2024-12-02 19:50:05 +01:00
Ian Douglas Scott
eaeca9a244 input: Define function for transforming touch/tablet event position 2024-12-02 19:50:05 +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
Ian Douglas Scott
ea27ec5e28 DPMS with wlr-output-power-management-unstable-v1 protocol 2024-10-25 10:31:24 +02:00
Victoria Brekenfeld
0092dac08c input: Use render_input_order 2024-10-22 19:43:47 +02:00
Victoria Brekenfeld
07bd8bedef input: Treat pointer-shortcuts as potentially inhibited 2024-10-07 20:50:32 +02:00
Ian Douglas Scott
d7ca0324c5 Remove needs_key_repetition argument
Not supressing key repetition in backends seems like it was a bug, and
should be fixed as of https://github.com/Smithay/smithay/pull/1535.

So an argument for this should be unnecessary now.
2024-09-19 16:23:25 +02:00
Ian Douglas Scott
6d017225e4 Move handling of keyboard swap action to a seperate function 2024-09-19 16:23:25 +02:00