Commit Graph

104 Commits

Author SHA1 Message Date
Isaac Freund
4cb65f9e2e
DragIcon: set position on creation
Currently if a drag icon is created but the cursor/touch point is not
moved river will render the drag icon at 0,0 instead of the cursor/touch
point location. This fixes that.
2023-10-25 22:01:05 +02:00
Isaac Freund
2e586c7061
build: update to Zig 0.11.0 2023-10-16 16:27:03 +02:00
Isaac Freund
133b88c266
LayerSurface: handle focus when switching outputs
Currently if a layer surface is focused and the user focuses a different
output the layer surface remains focused. However, updating focus on
layer surface unmap only considers seats that have the layer surface's
output focused.

To fix this there are 3 approaches I see:

1. Unfocus all layer surfaces on the old output when switching output
focus, focus any layer surfaces on the new output.

2. Disallow switching output focus while a layer surface is focused.

3. Stop caring about output focus when determining which layer surface
should gain/lose focus.

I've taken the 3rd option here as it is significantly simpler to
implement and maintain but still feels reasonably intuitive.
2023-03-16 11:03:33 +01:00
Isaac Freund
90f240355e
Cursor: fix warp on output change with no views 2023-03-14 12:07:14 +01:00
Isaac Freund
29976e5741
Seat: fix potential assertion failure 2023-03-06 20:17:59 +01:00
Isaac Freund
b7b371cb4f
pointer-constraints: implement protocol
Now with 50% less pointer warping!

The new implementation requires the user to move the cursor into the
constraint region before the constraint is activated in order to keep
behavior more predictable.
2023-03-05 23:11:54 +01:00
Isaac Freund
1602b34f4f
Seat: use the grab aware API to clear focus
This looks to be a typo made way back in the early days of river.
2023-03-05 13:37:57 +01:00
Isaac Freund
83fe764fcd
View: only send configures through transactions
This reduces the number of separate configure events sent to clients
through better batching and is also more correct.
2023-03-01 20:44:13 +01:00
Isaac Freund
6411c71151
Root: centralize focus(null) calls in applyPending() 2023-03-01 10:49:44 +01:00
Isaac Freund
e11d4dc0de
LayerSurface: fix use-after-free on destroy
The scene_layer_surface may be destroyed before handleDestroy is called,
which means we can't rely on it to access the wlr_layer_surface in
destroyPopups().
2023-02-28 18:28:17 +01:00
Isaac Freund
be4330288d
river: rework core data structures & transactions 2023-02-28 18:28:17 +01:00
Isaac Freund
0b2272ec57
DragIcon: render using the scene graph 2023-02-28 14:55:58 +01:00
Isaac Freund
879b880a6a
XdgPopup: reimplement using the scene graph
xdg-shell version 3 is now implemented, supporting popup repositioning.
2023-02-28 14:55:58 +01:00
Isaac Freund
dbcb75dddb
LayerSurface: render using the scene graph
This also brings a lot of code cleanup and proper support for
version 4 of the protocol.
2023-02-28 14:55:58 +01:00
Isaac Freund
b38676f078
session-lock: use the scene graph 2023-02-28 14:55:58 +01:00
Isaac Freund
4f0ce8fceb
render: use wlr_scene to render views 2023-02-28 14:55:58 +01:00
Isaac Freund
b7ac5becfb
pointer-constraints: remove protocol
This implementation as it stands is incomplete/buggy and will make
updating to wlr_scene more complex.

It will be reimplemented after updating to wlr_scene is complete.
2023-02-28 14:55:58 +01:00
Isaac Freund
615beab2e6
Seat: rework Xwayland Override Redirect focus
Instead of stashing the active view and setting Seat.focused to the
Xwayland OR surface when a child OR surface of a currently focused
Xwayland view is given keyboard focus, keep Seat.focused set to the
Xwayland view.

Such Override Redirect surfaces are commonly used for drop down menus
and the like, and river should behave as if the parent Xwayland view
still has focus.

This ensures that the riverctl focus-view next/prev commands continue to
work as expected while a popup is open, the correct focused view title
will be sent over river status, etc.

It's also cleaner to centralize this logic in XwaylandOverrideRedirect
and keep it out of Seat.zig.
2023-01-12 14:44:55 +01:00
Zakariyya Von Forslun
63610d9440 Seat: keep parent Xwayland view of a focused OR surface activated
Xwayland OR menus may disappear if their parent view is deactivated. The
heuristic and ICCCM input model implemented prior, used to determine whether an
OR surface may take focus, does not cover all menus, so retaining parent view
activation works as a catch-all solution for handling unwanted OR menu focus.
2023-01-12 06:56:11 +10:00
Isaac Freund
09f3f141ae
deps: update to Zig 0.10 2023-01-08 16:21:42 +01:00
Isaac Freund
a7f00a77ca
touch: support drag and drop 2022-12-30 23:20:18 +01:00
Isaac Freund
6a028639b8
Config: use a single xkb keymap for all keyboards
This is nice simplification and allows us to abort startup if the
default xkb configuration (perhaps influenced by XKB_DEFAULT_*
environment variables) is invalid.
2022-12-30 23:20:02 +01:00
Isaac Freund
8f8d94aa45
session-lock: fix potential race
Currently the session lock client has no 100% safe way to know when it
is safe to suspend after requesting that the session be locked.

For a suspend to be safe the compositor must have either blanked or
rendered a lock surface on all outputs before suspending. This is
because the current framebuffer on suspend appears to be saved and
displayed again after suspend, at least on my Linux system.

If a new "locked" frame for all outputs is not rendered before suspend,
an "unlocked" frame or frames will likely be briefly displayed on resume
before the lock surfaces are rendered or the screen is blanked.

To fix this, wait until a lock surface has been rendered on all outputs,
or if that times out until all outputs have been blanked, before sending
the locked event to the client.

Resolving this race on the compositor side without protocol changes
is the most effective way to avoid this potential information leak,
regardless of which session lock client is used.
2022-12-29 18:25:12 +01:00
Isaac Freund
2be9ac05d6
command/map: use flags.zig, cleanup 2022-12-28 21:56:42 +01:00
Isaac Freund
6ac3928556
idle: support ext-idle-notify-v1, drop KDE protocol
This commit is a breaking change as it drops support for the now
obsolete org_kde_kwin_idle protocol.
2022-12-24 18:18:09 +01:00
Isaac Freund
05c9194eba
build: handle wlroots built without xwayland support 2022-12-24 17:38:02 +01:00
shironeko
8036ae2bd1
Cursor: add on-focus-change option
Warp the cursor to the center of the focused view if the cursor is not
in the bounding box of that view already. This helps the user to keep
track of their cursor when they mostly use the keyboard and the cursor
becomes hidden most of the time, also helps trackpad/trackpoint users.
2022-12-01 14:23:02 +01:00
Isaac Freund
3141940efb
map-pointer: minor fixes and cleanups 2022-11-25 14:06:31 +01:00
Alexander Courtis
cacc986166
map-pointer: allow running arbitrary commands 2022-11-25 14:05:36 +01:00
tiosgz
49efbfe046
session-lock: handle output unplugging better 2022-11-13 16:45:18 +01:00
Isaac Freund
33187e0b09
ext-session-lock: implement protocol 2022-11-13 16:45:18 +01:00
Isaac Freund
78a46c316a
input-inhibit: remove support for protocol
The only valid use-case for this as far as I'm concerned is lockscreens,
which will now be supported through ext-session-lock-v1.
2022-11-13 16:45:18 +01:00
Isaac Freund
489a49735a
river: update to wlroots 0.16 2022-11-13 16:16:07 +01:00
Isaac Freund
e35c147cd5
river: refactor keyboard groups implementation
This reduces the impact of keyboard groups on the Keyboard.zig
implementation and otherwise improves consistency with patterns used
elsewhere in rivers code.

There are also two small changes to the riverctl interface:

- keyboard-group-add-keyboard is renamed to keyboard-group-add
- keyboard-group-remove is added to support removing keyboards from a
group.
2022-09-18 15:53:45 +02:00
Leon Henrik Plickat
01f49bbbc1 river: add keyboard groups 2022-09-12 04:12:21 +02:00
Isaac Freund
d4b2f2b0fc
Seat: send enter event on keyboard device creation
Currently we don't send an enter event when a new keyboard device is
created which causes issues when switching ttys. On switching away the
keyboard device is destroyed and leave is sent. Currently on switching
back the keyboard device is re-created but no enter event is sent before
we start sending key events, which is a violation of the protocol.
2022-07-26 16:25:04 +02:00
Isaac Freund
2eb013e214
Cursor: implement initial touch support
Still TODO are:
- Touch support for drags
- Mapping input devices to outputs (necessary for good multi-monitor
touch support)

Co-authored-by: Daan Vanoverloop <daan@vanoverloop.xyz>
2022-06-22 11:06:35 +02:00
Isaac Freund
5cce49095a
Seat: refactor InputDevice handling
- The lifetimes of the Keyboard and Switch structs are now directly
tied to the corresponding InputDevice, which has become a field of
those structs.

- Seat capabilities are now properly updated on removing a keyboard.

These changes align with input device refactoring in upstream wlroots
which will make updating to easier 0.16.0.
2022-06-21 16:25:37 +02:00
Isaac Freund
2df2151afa
river-status: only send mode event if client bound version 3 2022-06-02 12:21:57 +02:00
Isaac Freund
d657dc791b
river-status: add mode event to seat status
This allows clients such as a status bar to display the currently active
mode.
2022-06-01 00:15:09 +02:00
Isaac Freund
03e8da669c
Xwayland: Rename XwaylandUnmanaged to XwaylandOverrideRedirect 2022-05-30 01:08:09 +02:00
tiosgz
1e3b8ed161 Seat: avoid leaking eaten keys to client on focus
Until now, Seat.setFocusRaw sent all pressed keys to the client,
including ones that should be eaten. (Try e.g. changing focus to a
nested wlroots compositor with a terminal open to easily see it.)

However, only filtering out the eaten keys is not enough; they were
eaten only once all mappings had been executed. Therefore, the original
function had to be split into one looking up mappings and another
executing them.
2022-05-29 23:12:21 +02:00
Zakariyya Von Forslun
7b554bde68 xwayland-unmanaged: handle focus on map/cursor button
This implements keyboard focus on map for unmanaged Xwayland views
using wlroot's heuristic approach as well as keyboard focus on cursor
button click.
2022-05-29 16:26:16 +02:00
Peter Kaplan
44aaee3a51 command/map: layout-pinned mappings
e.g. `riverctl map -layout 0 normal Super Y spawn foot`

When this mapping is checked against a pressed key, layout 0 will be used to translate the pressed key instead of the currently active layout.

The number denotes to an index of the layouts set with
`XKB_DEFAULT_LAYOUT`.
2022-04-27 18:31:08 +02:00
Peter Kaplan
60fdefc3fd
input: add map-switch/unmap-switch commands
This allows running a command on a laptop's lid being opened/closed
or a tablet's button/switch being pressed/toggled.
2022-04-14 12:49:47 +02:00
Hugo Machet
89433073d6 command: Remove allocator arg 2022-02-08 13:53:52 +01:00
Hugo Machet
da59632cea code: Cleanup use of std library for consistancy 2022-02-08 12:02:05 +01:00
Isaac Freund
79d7775a3d
code: relicense to GPL-3.0-only
I don't need anyone's permission to make this change since
GPL-3.0-or-later is one-way compatible with GPL-3.0-only.
2022-01-31 19:33:22 +01:00
Isaac Freund
1c515759b4
Seat: do a better job of cleaning up listeners
I thought this should be fine as river won't yield to the event loop
when Seat.deinit() is called before the wlroots seat is destroyed, but
a segfault on exit has been reported with a stack trace mentioning
wlr_seat_destroy(). Let's hope this clears that up.
2022-01-02 19:46:18 +00:00
Isaac Freund
c1d985ac29
build: update to zig version 0.9.0 2021-12-24 05:28:14 +00:00