Commit Graph

1273 Commits

Author SHA1 Message Date
Leon Henrik Plickat
4e48d68485
View: restore to previous output on reconnect 2024-03-14 11:07:15 +01:00
Isaac Freund
fecfa89a9a
View: fix SSD desync on consecutive timeouts
If multiple consecutive transaction timeouts occur it is possible for
the SSD borders to become temporarily desynchronized with the size of
the rendered surface.

This is especially noticeable during interactive resize of mpv.

For details on cause/fix, see the new comment in the code.
2024-03-13 15:57:01 +01:00
Isaac Freund
b0dc5f7294
View: improve transaction timeout handling
This fixes a possible assertion failure in Cursor.updateState() when
trying to start move/resize of a xdg toplevel with the timed_out or
timed_out_acked configure_state.

This also generally improves the UX of transaction timeouts as all
state except for the size change is now applied immediately.
2024-03-13 12:28:08 +01:00
Isaac Freund
46dbbe9799
deps: switch to codeberg upstreams, update 2024-03-12 14:12:54 +01:00
Isaac Freund
c474be1537
build: require wlroots version 0.17.2
This fixes a crash that users have hit fairly often in the wild using
Xwayland and allows us to remove an ugly workaround for another issue.
2024-03-11 19:14:37 +01:00
Isaac Freund
49a779b24d
tablet-v2: implement tablet tool support
There is not any pointer emulation for tablet tool input. This means
that only clients implementing the tablet-v2 protocol will be able to
process tablet tool input.

Tablet pad support is TODO
2024-03-11 15:05:42 +01:00
Isaac Freund
ac655593f3
View: remove faulty assertion
This assertion does not consider that a view may be visible on an output
despite no view on that output having focus due to a differnt output
currently having focus.

I don't see any clean way to fix the assert, so just remove it.
2024-03-09 13:47:36 +01:00
Isaac Freund
4a65af667e
Root: reduce transaction timeout to 50ms
The current value of 200ms is too long and makes river feel very slow
when it it hit due to an application being very slow/frozen.

The new timeout of 50ms seems to be rarely hit in practice even on
slower hardware such as my old Thinkpad x220. When it is hit the system
feels much more responsive than when the 200ms timeout is hitdespite the
guilty application window potentially being visible in the wrong
location/size a bit longer.
2024-03-08 12:21:02 +01:00
Isaac Freund
f803ca6274
View: clean up attach-mode code, add assert 2024-03-08 11:56:34 +01:00
Peter Kaplan
26210b2be5
View: Add attachRelative function
This is used for the above/below attach-modes introduced in d71bebc.

Also remove redundant focusedIndex function in Output.PendingState.
2024-03-08 11:56:34 +01:00
Isaac Freund
50d4f25eee
build: enable frame pointers in release safe
These are by default only enabled for debug builds but give a higher
chance of getting a usable stack trace out of bug reports as Zig's
builtin stack trace dumping code doesn't handle their absence well in
all cases yet. The cost should be negligible as river is not CPU-bound.
2024-03-07 16:46:42 +01:00
Peter Kaplan
726ee2e7ca
completions/zsh: Update attach-modes 2024-03-05 17:53:16 +01:00
Peter Kaplan
d71bebc032
command/attach-modes: above and below options 2024-03-05 17:53:16 +01:00
Hugo Machet
f6cc4de884
example/init: Replace light with brightnessctl
Change screen backlight brightness command to brightnessctl(1) as
light(1) repo has been deleted.
2024-03-05 12:05:55 +01:00
Isaac Freund
c4d6fab902
mailmap: map Isaac's old email to the new one
I assume that I'm not the only one who has changed/will change their
email over the years of river development, so this seems like a
reasonable thing to have.
2024-03-04 14:06:53 +01:00
Isaac Freund
60f4cafad0
river: only expose xwayland_shell_v1 to Xwayland
This is a private protocol only intended for the Xwayland client.
2024-03-02 17:37:04 +01:00
Isaac Freund
0eacde7d01
deps: update to latest zig-wayland and zig-wlroots 2024-03-02 17:36:47 +01:00
Isaac Freund
12e6833f31
linux-dmabuf: disable per-surface feedback
It seems like the wlr_scene implementation of sending per-surface
feedback is a bit too spammy and can lead to resource exhaustion in
clients in at least some reported cases.
2024-02-27 17:10:27 +01:00
Isaac Freund
0605ce507e
Root: fix auto-layout output coordinates
Outputs using the wlr_output_layout auto-layout feature may have their
coordinates update any time an output is added/removed to the layout or
the position of another output in the layout is set.

River currently doesn't keep the scene node coordinates of such outputs
in sync with their position in the output layout, which leads to bugs
with e.g. the cursor not working properly for such outputs.
2024-02-25 14:37:34 +01:00
Isaac Freund
60b06a6741
output-management: fix output destroy handling
Currently we update output-management clients based on changes in the
wlr_output_layout struct. However, this is obviously wrong on closer
inspection due to the fact that not all outputs are tracked by the
wlr_output_layout at all times. I think this aproach was originally
cargo-culted from some other output-management implementation and it
needs to go.

Luckily, the solution is quite simple since the only way to configure
outputs using river is through the wlr-output-management protocol. This
means we need to send a new configuration to the output-management
client in 3 cases:

1. An output is created
2. An output is destroyed
3. A wlr-output-management config from a client is applied
2024-02-25 13:42:58 +01:00
Isaac Freund
f2b6893b00
InputConfig: code style cleanups 2024-02-23 12:22:42 +01:00
LordMZTE
0cb7c49cc3
command/input: add map-to-output 2024-02-23 12:22:42 +01:00
Isaac Freund
95da9b5875
XdgToplevel: work around buggy clients
Unfortunately, clients in the wild sometimes get the
configure/ack_configure/commit sequence wrong, committing the configured
surface with a size different than the one they ack'd only to later in
separate commit adpat the surface size to that requested by the
compositor.

Improve river's handling of such buggy clients to keep river's ssd
borders and internal state consistent with whatever the clients actually
commit regardless of the correctness of the clients. Log a shame message
for such clients to make me feel better about working around their bugs.
2024-02-22 10:24:36 +01:00
Isaac Freund
9b2d99fa79
rules: fix assertion failure
If a view that is currently being destroyed is matched by a newly added
rule river crashes due to an assertion failure.

Fix this and add another assertion to make this precondition more
visible to the users of RuleList.match().
2024-02-21 13:37:39 +01:00
Isaac Freund
53c09be846
Root: fix crash on deinit() 2024-02-20 23:14:12 +01:00
Isaac Freund
a04c18819b
Root: fix crash on output disable
If there is a transaction inflight when an output is disabled then we
must call View.commitTransaction() for any views evacuated from the
disabled output to ensure transaction state remains consistent.

Root.commitTransaction() will not call View.commitTransaction()
for these evacuated views as their output is no longer around.
2024-02-20 23:14:12 +01:00
Isaac Freund
fa5a1e5da0
XdgToplevel: handle timed out state in configure()
If a new transaction is started that calls configure() on an xdg
toplevel with a timed_out/timed_out_acked configure_state we currently
leave the configure_state untouched if no new configure is needed.

This can cause an assertion failure in View.commitTransaction() if the
xdg toplevel still hasn't acked/committed by the time the new
transaction completes.

To fix this, update the configure_state as necessary.
2024-02-20 23:14:12 +01:00
Isaac Freund
46323b4a5b
InputConfig: simplify libinput API usage
All of these API calls checking if the device supports a given option
and checking if the value would be changed are effectively useless.

A quick peek inside the libinput source code shows us that all of these
"setter" functions validate their arguments and return an error if they
are invalid.

Since we don't do anything with the information of whether or not a
config option has been changed or if a config option is even supported
for a given device, all these apply() functions can be simplified to a
single libinput function call.
2024-02-20 11:31:06 +01:00
Hugo Machet
1d40e5a9ab
InputConfig: Implement disable while trackpointing 2024-02-20 00:21:15 +01:00
Isaac Freund
bf7b9d15dd
Root: trival code cleanup in deactivateOutput() 2024-02-19 23:21:08 +01:00
Isaac Freund
b34e1c6ebd
command/map: remove references to locked mods
These have never created functional mappings as far as I'm aware.
2024-02-19 18:23:17 +01:00
LordMZTE
6692656c00
river: clear up docs on -c parameter
This makes the --help message clearly mention that the default init
executable is overidden.
2024-02-19 18:19:06 +01:00
Isaac Freund
a7b174ccf4
command/input: cleanup memory manangement a bit 2024-02-19 18:07:56 +01:00
Leon Henrik Plickat
931b6268e7
command/input: support globs 2024-02-19 18:07:45 +01:00
Hugo Machet
7f1f9152f2
river: add -no-xwayland cli flag
Add a cli flag to disable xwayland at runtime even if river has been
built with xwayland support.
2024-02-19 17:27:25 +01:00
Isaac Freund
ec9a1b4303
Keyboard: ignore >32 simultaneous key presses
wlroots implements this behavior with its key press tracking but
continues to forward the events to the compositor. Matching the wlroots
behavior here seems like the best way to avoid strange edge cases and
this is unlikely to ever be an annoying limit in practice.

Also take this oppurtunity to finally refactor away the hasMapping()
function in a way that doesn't sacrifice correctness even when hitting
this 32 key press limit.
2024-02-19 11:40:58 +01:00
tiosgz
e1970e4d52 Keyboard: don't crash when coming from a different tty
It didn't occur to me that this is a completely valid case when a key
release event is received even though there was no press event known
to river.

(I've also just had this same crash on something else, but i don't
understand what the cause could be.)
2024-02-19 08:54:40 +00:00
Isaac Freund
d1bb27038b
Keyboard: style/naming nits and comment tweaks
This commit includes no functional changes
2024-02-18 17:29:56 +01:00
tiosgz
93c2a2fd08 deps: update zig-wlroots
Simplifies wlr_seat.keyboardNotifyEnter() signature.
2024-02-18 16:08:51 +00:00
tiosgz
bd52c155ef Keyboard: rework key processing semantic
The old eat/pass-on point of view was good when there was only the
focused client to send the key to. But where does the input method
stand? Instead, we now want to know where the key goes, treating river
and clients all equally.

Thanks to ifreund for pointing me to std.BoundedArray which simplifies
some of the logic.
2024-02-18 15:31:53 +00:00
tiosgz
a1ce53a998 KeycodeSet: move to Keyboard.zig
The file was too short and did't make much sense on its own; actually,
it's quite clearly part of the Keyboard logic.
2024-02-18 07:33:29 +00:00
Isaac Freund
2bdbe414e8
View: don't clip off CSD shadow and the like
Instead just clip to the output dimensions as originally intended.
2024-02-15 11:59:38 +01:00
Leon Henrik Plickat
653b5c6660 river: fix names of input config settings 2024-02-15 11:41:43 +01:00
Leon Henrik Plickat
0cae415a93 refactor input configuration 2024-02-14 14:54:36 +01:00
Isaac Freund
a531311ac6
XdgToplevel: handle configure timeout gracefully
Currently configure timeouts hit the "client is buggy and initiated size
change while tiled or fullscreen" code path even if the client is not in
fact buggy. This causes state to get out of sync between river and the
client, and is highly visible as the borders drawn by river no longer
align with the buffer dimensions committed by the client.

This commit fixes this by tracking acks/commits in response to
configures even after a timeout and properly integrating them with the
transaction system.
2024-02-13 14:50:58 +01:00
Isaac Freund
f0b0606e9f
View: clip scene tree to output
There are some cases in which a view can end up with a size/position
that places some part of it outside its output. For example, a window
with a large minimum size in a tiled layout that is placed near the
right or bottom edge of the output may extend past the output bounds.

The problem with this is that part of the view outside the output bounds
may be rendered on another output where it does not belong in a multi-
monitor setup.

To fix this, clip the surfaces of the view and the borders to the output
bounds.
2024-02-10 14:17:29 +01:00
Isaac Freund
93b8bbc2fd
command/zoom: always warp cursor if configured
Focus may not actually change here so seat.focus() may not automatically
warp the cursor.  Nevertheless, a cursor warp seems to be what users
expect with `set-cursor-warp on-focus` configured, especially in
combination with focus-follows-cursor.
2024-02-10 12:00:14 +01:00
Isaac Freund
026c832ba1
xdg-toplevel: handle destroy before xdg-decoration 2024-02-06 12:59:09 +01:00
tiosgz
4685f6906d
Keyboard: eat key before running mapping
To see why this is needed, compare the following flows:
  - user: press key 'j' with Super already pressed
  - Keyboard: handle mapping, focusing next view
  - Seat: send wl_keyboard.enter with keys Super and 'j'
  - Keyboard: eat key 'j'
versus:
  - user: press key 'j' with Super already pressed
  - Keyboard: eat key 'j'
  - Keyboard: handle mapping, focusing next view
  - Seat: send wl_keyboard.enter with key Super.

The necessity of this was already mentioned in 1e3b8ed1; however,
without a comment in code, it was removed in 393bfb42 as superfluous.
Hopefully, the newly added comment will prevent such mistakes in the
future.

Fixes https://github.com/riverwm/river/issues/978
2024-02-05 12:33:09 +01:00
tiosgz
66f1881a72 Keyboard: fix key handling/eating logic
As noticed by leon-p, last refactorings made river send a release event
to the client even if the press event has been eaten. In addition, the
introduction of input method support means that we need to remember
*why* we've eaten the key.

Also make KeycodeSet more strict: i am not aware of any case when a
keyboard could have the same key pressed twice (specifically, keyboard
groups have this handled in wlroots), so make the behavior follow a
smaller set of possible scenarios.
2024-02-01 13:52:59 +00:00