Commit Graph
100 Commits
Author SHA1 Message Date
Isaac Freund 37d9d6e725 Switch: eliminate "self" naming convention 2024-03-14 13:04:41 +01:00
Isaac Freund 0131d4670d SwitchMapping: eliminate "self" naming convention 2024-03-14 13:02:38 +01:00
Isaac Freund 82a40725f9 Control: eliminate "self" naming convention 2024-03-14 13:01:49 +01:00
Isaac Freund 3077074329 Mode: eliminate "self" naming convention 2024-03-14 13:00:15 +01:00
Isaac Freund b9dde3c49b LayoutDemand: eliminate "self" naming convention 2024-03-14 12:59:42 +01:00
Isaac Freund c3cee0b91f PointerMapping: eliminate "self" naming convention 2024-03-14 12:58:50 +01:00
Isaac Freund 278865065b StatusManager: eliminate "self" naming convention 2024-03-14 12:57:23 +01:00
Isaac Freund 1d8bca24ae SeatStatus: eliminate "self" naming convention 2024-03-14 12:55:54 +01:00
Isaac Freund 4a259d322b InputConfig: eliminate "self" naming convention 2024-03-14 12:53:09 +01:00
Isaac Freund b65e4f6b17 idle-inhibit: fix naming, eliminate "self" naming convention
Also add missing copyright headers
2024-03-14 12:51:34 +01:00
Isaac Freund b0d4610999 LayoutManager: eliminate "self" naming convention 2024-03-14 12:40:26 +01:00
Isaac Freund b7c53ceda7 Config: eliminate "self" naming convention 2024-03-14 12:40:13 +01:00
Isaac Freund 6c3f851464 Keyboard: eliminate "self" naming convention 2024-03-14 12:35:21 +01:00
Isaac Freund f02d26c533 InputManager: eliminate "self" naming convention 2024-03-14 12:34:28 +01:00
Isaac Freund 693a2b0dda XwaylandOverrideRedirect: eliminate "self" naming convention 2024-03-14 12:29:49 +01:00
Isaac Freund 28f30b2571 Mapping: eliminate "self" naming convention 2024-03-14 12:22:15 +01:00
Isaac Freund 904b623b84 XwaylandView: eliminate "self" naming convention 2024-03-14 12:21:21 +01:00
Isaac Freund 0e2cac08df XdgToplevel: eliminate "self" naming convention 2024-03-14 12:19:36 +01:00
Isaac Freund 2eb2a13284 Cursor: eliminate "self" naming convention 2024-03-14 12:08:24 +01:00
Isaac Freund 99a99b72e7 View: eliminate "self" naming convention 2024-03-14 12:07:27 +01:00
Isaac Freund d8f041c96f Output: eliminate "self" naming convention 2024-03-14 12:06:33 +01:00
Isaac Freund 267aa9a9b5 Seat: eliminate "self" naming convention 2024-03-14 12:05:36 +01:00
Isaac Freund 8a9b07ae4b Root: eliminate "self" naming convention 2024-03-14 12:04:15 +01:00
Isaac Freund aadb92dc0b Layout: eliminate "self" naming convention 2024-03-14 12:02:32 +01:00
Isaac Freund dabf7e9e97 Server: clean up initialization
This ended up uncovering a latent bug in the IdleInhibitorManager
initialization code, not sure how that ever worked.
2024-03-14 11:55:23 +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
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
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
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
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
Isaac Freund a7b174ccf4 command/input: cleanup memory manangement a bit 2024-02-19 18:07:56 +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
Isaac Freund d1bb27038b Keyboard: style/naming nits and comment tweaks
This commit includes no functional changes
2024-02-18 17:29:56 +01: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
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
Isaac Freund 69a51cadb4 attach-mode: code/documentation style tweaks 2024-01-13 12:36:20 -06:00
Isaac Freund 6e9bd83e1d Root: use Output.PendingState for fallback
Using the same type for these has the potential to simplify some future
code.
2024-01-12 16:49:04 -06:00
Isaac Freund 62dbe34bda river: fix -log-level filtering
This has been broken since the Zig 0.11.0 upgrade it seems.
2024-01-11 17:10:26 -06:00
Isaac Freund c9838c31b6 Keyboard: don't send enter before keymap event
It's unclear if this is technically a violation of the protocol or not,
but it makes little sense to do this and many clients in the wild crash
if wl_keyboard.enter is sent before wl_keyboard.keymap.
2024-01-11 16:55:02 -06:00
Isaac Freund ec8f57e704 Keyboard: check translated keysyms for mappings
If our current approch without xkbcommon translation does not match any
mapping on a key event attempt to match the translated keysym as well.

This makes e.g. the keypad number keys (e.g. KP_1) work intuitively as
they may require translation with numlock active.

The reason we stopped doing this in I7c02ebcbc was due to layout where
e.g. Super+Shift+Space is translated as Space with the Shift modifier
consumed, thereby conflicting with a separate mapping for Super+Space.
This should not be a issue anymore though as we now only run a maximum
of one mapping per key event and we attemt to match mappings without
xkbcommon translation before attempting with translation.
2024-01-11 15:06:33 -06:00
Isaac Freund f6c434c7a7 river: log version during startup 2024-01-10 17:32:35 -06:00
Isaac Freund cc1f988e56 Root: fix stack order on restore from 0 outputs 2024-01-09 13:11:16 -06:00
Isaac Freund c38e7e2d87 Root: remove unneeded fallback.inflight lists 2024-01-09 13:03:55 -06:00
Isaac Freund 5947f04408 Seat: fix potential crash in handleMapping()
I haven't actually managed to reproduce a crash here yet but I feel much
more comfortable about this code with this change.
2024-01-07 16:55:10 -06:00
Isaac Freund 540ca043df Keyboard: fix mapping XF86ScreenSaver 2024-01-06 20:36:53 -06:00
Isaac Freund afbc84c994 river: re-add wl_drm support for now
It seems to be a bit too early to drop support for this legacy protocol.

Xwayland apparently still relies on it for hardware acceleration as do
fairly recent mesa versions still in widespread use.
2024-01-06 19:23:55 -06:00
Isaac Freund 9aa0f1a9a6 Output: fix possible crash on destroy 2024-01-05 12:50:36 -06:00
Isaac Freund 393bfb42b9 Keyboard: delete some uneeded code 2024-01-05 12:31:55 -06:00
Isaac Freund 913770975b Cursor: clean up cursor theme loading
wlroots will now load xcursor themes at the correct scale automatically
based on the scale of the outputs where ther cursors are displayed.

Also make the error handling a bit more robust.
2024-01-04 14:44:51 -06:00
Isaac Freund ebb6d1bdd1 xdg-activation: fix race with transaction system
This code could allows the view to be focused and urgent at the
same time if the request to activate the view is received just after
the pending focus has been set but before the transaction completes.
2024-01-04 10:10:31 -06:00
Isaac Freund 28dcd8320a linux-dmabuf: send better per-surface feedback
This commit leverages the new wlr_scene helper to send custom feedback
per surface rather than using the same default feedback for every
surface. This should allow direct scanout to work more reliably with
multiple outputs for example.
2024-01-03 17:23:53 -06:00
Isaac Freund 80ced04f68 river: drop support for wl_drm
wl_drm is a legacy interface superseded by the linux-dmabuf
protocol. All clients should migrate.

This commit drops support for the protocol which should help find
whatever problematic clients are left in the wild.

If it turns out that this is too soon we can easily keep supporting
wl_drm for a little while longer as wlroots has not yet dropped support
for it.
2024-01-03 17:22:00 -06:00
Isaac Freund db70868c04 XdgToplevel: fix frame perfection on unmap
It looks like the old workaround for this wlroots API wart is no longer
sufficient for wlroots 0.17.
2024-01-03 12:39:43 -06:00
Isaac Freund be4dbe3fe7 Keyboard: clarify keypress routing logic 2024-01-01 23:02:55 -06:00
Isaac Freund 40920c7818 TextInput: fix consecutive enable requests
The wording of the text-input-v3 protocol is quite confusing here
but I'm pretty sure this is now correct.
2024-01-01 23:02:55 -06:00
Isaac Freund 6f311af3b3 TextInput/InputRelay: style nits
There should be no functional changes in this commit
2024-01-01 23:02:55 -06:00
Isaac Freund 134a6bcfb5 TextInput: handle multiple text inputs correctly
The protocol states that we must send enter and leave to all text input
objects if the client has created multiple.

Only one text input is allowed to be activated by the client per seat
however.
2024-01-01 23:02:55 -06:00
Isaac Freund 49defcfb7a TextInput: remove pending_focused_surface
This state doesn't need to exist, just get the focus from the Seat.
2024-01-01 23:02:55 -06:00
Isaac Freund 3aba3abbcd build: require at least wlroots 0.17.1
There are enough bugs fixed in 0.17.1 which are relevant to river that I
think it's worthwhile to refuse to compile against 0.17.1.
2024-01-01 22:55:15 -06:00
Isaac Freund a128a574a4 output-management: work around wlroots crash 2024-01-01 22:52:25 -06:00
Isaac Freund 5f0c9e2ccf output-management: fix output config application
Currently wlr-output-management config application is broken since the
pre 0.17 code relied on the (now removed) output enable/disable event to
be emitted as part of the state application.

The old code was pretty smelly and hard to understand, I'm glad the
upstream improvements pushed river's code in this directions.
2024-01-01 22:52:25 -06:00
Isaac Freund b440767b54 gamma-control: track wlroots 0.17 changes 2023-12-29 16:22:15 -06:00
Isaac Freund 677766956e deps: update to lastest zig-wlroots
This fixes a few issues with the XwaylandSurface bindings
2023-12-06 11:00:45 +01:00
Isaac Freund 093b85d234 build: fix comment on scanner.generate() versions 2023-12-05 11:37:15 +01:00
Isaac Freund cf06498f22 ci: fix arch and alpine 2023-12-05 11:25:17 +01:00
Isaac Freund deb671bec8 Output: fix initial commit for wayland backend
Also add some more logging
2023-12-05 11:06:27 +01:00
Isaac Freund d207e08dab Root: fix faulty assertion, cleanup
Thanks to tiosgz for prompting me to look at this more closely.

There doesn't seem to be any compelling reason to use the
wlr_scene_output_layout helper, it's simpler to just make the two
necessary SceneOutput.setPosition() calls manually. This will hopefully
be refactored down to a single call eventually as well.
2023-12-05 10:32:30 +01:00
Isaac Freund 1dc1ac02bc Output: fix regression of initial mode logic
This logic that looked pointless to me while doing the wlroots 0.17
upgrade is in fact important as tiosgz helpfully pointed out.

It was added back in bc610c8b to address an issue. Hopefully the new
comments stop me from trying to break it again :)
2023-12-05 00:27:36 +01:00
Isaac Freund 6bfaf62cef SceneNodeData: fix fromNode()
This currently fails to check the node passed and skips directly to the
parent.
2023-12-05 00:27:22 +01:00
Isaac Freund 7ee6c79b6b build: update to wlroots 0.17 2023-12-01 17:29:05 +01:00
Isaac Freund 50ccd4c5b3 session-lock: fix pointer focus handling on map 2023-11-17 19:51:57 +01:00
Isaac Freund 68366c7331 Cursor: fix high polling rate resize regression
The previous commit ended up clamping the accumulated f64 offset to an
integer every frame, losing any sub-pixel cursor motions. This has been
known to cause problems with high polling rate mice in the past.

Return to the same approve the move cursor mode uses to solve this and
accumulate a separate sub-pixel delta.
2023-11-14 15:36:25 +01:00
Isaac Freund c50ed9c7e7 Cursor: clamp cursor movement to resize bounds
Currently resizing a window allows moving the invisible "internal"
cursor infinitely far off screen despite the fact that the window is
bounded by the size constraints of the client and by the output
dimensions. This means that attempting to resize past these bounds in
one dimension will result in the "internal" cursor being far out of
bounds and will require an equal movement in the opposite direction in
order to continue resizing.

Exposing this implementation detail of an invisible "internal" cursor
separate from the rendered cursor is of course bad, so clamp it to the
bounds of the resize.
2023-11-13 22:54:36 +01:00
Isaac Freund 69b61602cf View: handle map while no outputs are available
Currently views which are mapped while no outputs are available can
never actually get rendered because they have 0 tags and are stuck in
the hidden stack.

This commit fixes this and they should now be restored when a new output
becomes available.
2023-11-09 16:36:39 +01:00
Isaac Freund 04dea1edee river: remove dead code
This file has been dead since the refactor to use the wlroots
scene graph deleted view_stack.zig
2023-11-09 00:08:56 +01:00
Isaac Freund 6c81990163 xdg-toplevel: ignore redundant move/resize requests
Such requests currently lead to an assertion failure.

I don't know what changed in nautilus 45.0 that caused it to start doing
this and I probably don't want to know.
2023-11-08 13:16:50 +01:00
Isaac Freund c4fe1e1a3f rules: rename "tag" action to "tags"
This rule action accepts and assigns a set of 32 tags represented as a
32 bit integer just like all of river's other commands handling tags.

Using the singular here is potentially misleading and is also
inconsistent with set-view-tags, etc. which all use the plural.

Sorry about the breaking change for those who use master branch, ideally
I would have caught this before merging but at least I noticed before a
release.

This commit also does a bit of internal refactoring/cleanup of the rules
system.
2023-11-08 11:33:27 +01:00
Isaac Freund 18a440b606 pointer-constraints: fix assertion failure
It is possible for the assertion in PointerConstraint.confine() to fail
if a view with an active pointer constraint is, for example, resized
using a keybinding such that the pointer is outside the constraint
region.

Handle this edge case by deactivating the constraint. The other option
would be to warp the pointer to the nearest point still inside the
constraint region. Deactivating the constraint is far simpler however
and I don't expect this to be a UX pain point.
2023-11-06 13:14:16 +01:00