Commit graph

254 commits

Author SHA1 Message Date
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
Ian Douglas Scott
96c931a0c3 Split off KeyboardHandle::filter callback to separate method
This saves 7 levels of indentation, which seems like a plus.

The `InputEvent::Keyboard` branch of the `match` now fits clearly in one
screen. The `filter_keyboard_input()` method could probably still be
broken up more.

The method needs a few arguments, but it seems nice to make what it
depends on explicit.
2024-09-19 16:23:25 +02:00
Ian Douglas Scott
d02aecce61 Use .modified_sym() instead of casting keycode to keysym
Not sure if this is actually used, and if so the code may need more
testing, but this definitely is more correct, at least.
2024-09-19 16:23:25 +02:00
Victoria Brekenfeld
4d215755f6 shell: Fix incomplete focus_stack after swapping 2024-09-10 21:10:02 +02:00
Victoria Brekenfeld
03430b76c5 shell: Allow moving groups between outputs 2024-09-10 20:51:08 +02:00
Victoria Brekenfeld
0d048b1a8e input: Fix focus_follows_cursor across outputs 2024-09-09 20:12:10 +02:00
Victoria Brekenfeld
b85b8fc7eb input: Fix passed button events 2024-09-09 20:01:59 +02:00
Victoria Brekenfeld
5006eae60b actions: Fix focus on Output-actions 2024-09-09 20:01:42 +02:00
Victoria Brekenfeld
932c204de4 input: Move actions into own module 2024-09-09 16:39:20 +02:00
skewballfox
7da0bc430a added cursor_follows_focus and focus_follows_cursor 2024-09-04 20:22:40 +02:00
julianbraha
52280e9823 Remove unnecessary casting 2024-09-03 16:08:17 +02:00
Victoria Brekenfeld
c9220a7acc chore: Update smithay 2024-09-02 18:58:13 +02:00
pknepps
09b34bb40e Natural scrolling turned off will now turn off natural scrolling for 4-finger gestures 2024-08-30 17:19:02 +02:00
João Capucho
66695482d0 Don't pass pointer button events to client when moving or resizing 2024-08-23 17:18:39 +02:00