Commit Graph

805 Commits

Author SHA1 Message Date
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
Wouter van Heijst
3605a46bb5 Cursor: Focus follows cursor focuses empty outputs
When `focus-follows-cursor` is set and the cursor moves onto an output
where no views are present on the currently visible tags, focus the
output itself instead of an individual view.

This is useful e.g. when you want to spawn a terminal on your empty
monitor or switch it to a different tag.  Previously such changes would
happen to the monitor on which you previous focus was, despite the
cursor being somewhere else.
2024-01-06 14:16:21 +02: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
MaxVerevkin
9ce4525f08
river: Implement cursor_shape_v1 2024-01-04 14:14:00 -06:00
MaxVerevkin
9f0e0f2c0a
Cursor: actually set xcursor_name 2024-01-04 14:13:55 -06:00
Leon Henrik Plickat
c86f460135
Keyboard: Add new keyboards to groups if matched
Previously new keyboards would not be added to already existing
keyboard groups on (re-)connect. Only during the creation of
the groups themselves were devices added to them. This meant
that only keyboards connected during startup - before the init
is executed - would work with groups in a typical river session.
2024-01-04 11:00:16 -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
MaxVerevkin
6a74ed99fa
river: Implement fractional_scale_v1 2024-01-03 12:47:31 -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
praschke
55ed16efd1
input-method: address nits 2024-01-01 23:02:55 -06:00
praschke
8f497a3570
input-method: check that the input method is active when committing 2024-01-01 23:02:55 -06:00
praschke
18d4ccdd38
input-method: send text-input enter event after all leave events 2024-01-01 23:02:55 -06:00
praschke
4af77f5ffb
input-method: setKeyboard already sends modifiers 2024-01-01 23:02:54 -06:00
praschke
2abab1e9c7
river: Implement input_method and text_input 2024-01-01 23:02:54 -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
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
István Donkó
927dceb071
keyboard: add the ability to load layout from file 2023-11-09 13:23:07 +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
polykernel
2b463c9e4d
river: add fullscreen rule
This commit adds a fullscreen rule for configuring
whether the view should be drawn fullscreen on start up.

The actions "fullscreen" and "no-fullscreen" map to the two
possible state of a view and semantically operate on the same
rule list. The behavior of adding, deleting and listing rules
follows that of float and ssd.
2023-11-08 00:46:56 -05:00
polykernel
a0ea456ab2
river: add position and dimensions rules
This commit adds position and dimensions rules for configuring
the initial position and dimensions of views.

When a view is not matched by any position rules, it is centered
in the avaliable output space matching the current behavior. If
the provided position rule places the view outside of the output,
the view's position is clamped to the output bounds (with respect
to borders).

When a view is not matched by any dimensions rules, no default
dimensions is set by the server. If the provided dimensions rule
exceeds the minimum or maximum width/height constraints of the view,
the view's width/height is clamped to the constraints.

Position and dimensions rules have no effect if a view is started
fullscreen or is not floating. A view must be matched by a float
rule in order for them to take effect.
2023-11-08 00:46:55 -05: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
Isaac Freund
642f9b7ae0
XdgToplevel: tweak fullscreen state policy
Currently river only sends the fullscreen state to a maximum of one
toplevel per output at a time and switching tags such that the
fullscreen toplevel is not visible causes the fullscreen state to be
removed.

This may be technically correct, but it causes issues when programs like
firefox trigger animations on fullscreen state change.

This commit returns river's policy here to what we did back in 0.2 and
leaves the xdg_toplevel fullscreen state set regardless of whether or
not the toplevel is currently rendered as fullscreen or if there are
other fullscreen toplevels.
2023-11-03 17:16:04 +01:00
Isaac Freund
59c9842c8f
Cursor: use inflight_mode as needed in updateState()
This fixes possible assertion failures when quickly cancelling and
starting a new move/resize. The following steps, take from the bug
report, can currently reproduce the race:

1. Start with a window in tiled mode.
2. Begin resizing the window with your cursor.
3. Send the window back to tiled mode (with a keybind) and quickly begin
resizing it again with your cursor.
2023-11-03 17:06:05 +01:00
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
Doclic
bf4154007d river: add outputs rule 2023-10-19 12:58:11 +02:00
Doclic
206bb2e713 river: make RuleList return deleted items 2023-10-19 01:21:52 +02:00
Isaac Freund
f364e1b81b
Cursor: use total delta for resize calculation
This means that interactive resize speed is no longer throttled by the
speed at which the client commits new buffers. Interactive resize speed
is now determined entirely by how fast the pointer input device is moved
by the user.

This may result in more subjectively "choppy" resizes for clients that
commit very slowly, but it should be less sluggish at least.
2023-10-17 19:10:41 +02:00
tiosgz
d73ef51c89 riverctl: rule-{add,del}: reorder parameters
Previous order was (action, conditions, action argument), current is
(conditions, action, action argument). The old one was an expansion of
(action, conditions), which itself most likely came from the separate
<action>-filter-add commands. On the other hand, the new order keeps
action and its argument together and is in line with the logical flow
(check conditions, apply action).

On shell completions: only bash absolutely needed to be updated. fish
and zsh slightly misbehave regardless of the order.
2023-10-16 17:04:40 +00:00
Isaac Freund
5690c833e9
View: clean up after Zig update 2023-10-16 16:42:33 +02:00
Isaac Freund
2e586c7061
build: update to Zig 0.11.0 2023-10-16 16:27:03 +02:00
tiosgz
7f30c655c7
Cursor: keep focus_follows_cursor_target updated
This goes as close as possible to the behavior before this state was
introduced (keeping the improvement which needed it, 931405ab), fixing
various mis-interactions of keyboard and focus_follows_cursor focus
changes.

The following text is irrelevant to restoring correct basic FFC behavior
and talks about less common scenarios with regards to FFC clashing with
views' input region beyond their geometry, continuing the work done in
931405ab.

Scenario 1: the cursor traveling along a view's border in a "dead zone",
never initiating a focus change. If the focused view has an extended
input region, that area has some functionality (such as client-initiated
resizing); therefore it should be respected and even if another view's
geometry is also under the cursor, focus shouldn't change. In case of
unfocused views, it is a matter of consistency with the focused-view
case. This outcome is also easier to implement, as it doesn't require
any additional code.

Scenario 2: *clicking* such a dead zone, i.e. extended input region (of
an unfocused view). In question is not whether to focus the view (yes),
but whether the focus_follows_cursor_target should be set to the view as
well. Only one case seems relevant to me here, which is when ffc_target
is another view whose geometry is under the cursor, but covered by this
newly-focused view's input region. The most likely action following the
click is resizing the newly-focused view, where a touchpad or faulty
mouse could make the cursor move a bit farther after the button has been
released. I believe that ffc_target shouldn't have been updated, in
order to now prevent focus from skipping away.
(Another variant is me, wondering why the wrong view got focused and
trying to focus the right one using FFC. In that case, however, one
could ask if it's river that misbehaves and whether the application is
really well-integrated into the user's desktop when it provides a
feature they don't desire.)
2023-09-05 12:25:42 +02:00
tiosgz
0cc930b738 Root: fix inflight_layout_demands counting
Not decreasing the counter caused a weird bug where disabling/removing
an output (curiously, it seems to apply only to last active output being
removed) would lock the user out of the session, not letting the
transaction to complete (therefore hiding all views on a newly added
output) and messing up focus.

Fixes https://github.com/riverwm/river/issues/830
2023-08-13 11:22:28 +00:00
tiosgz
4726a6b0f1 Root: migrate {all,active}_outputs to wl.list
As discussed with ifreund on irc. This avoids extra allocation in case
of all_outputs and confusion in case of active_outputs (because with the
Output embedded in the Node, i thought its value was copied instead of
its pointer).
2023-08-13 11:10:46 +00:00
tiosgz
8966f95e72 Root: make 'fallback output empty' assertion stricter 2023-08-13 11:06:57 +00:00
tiosgz
57186fced3 Root: rename field outputs to active_outputs
Although this list only including active outputs was already documented,
making this explicit in its name reduces confusion and debugging
overhead.
2023-08-13 11:06:25 +00:00
tiosgz
bbd21c1637 river: update some comments
Mostly stuff not reflecting renames, plus a few if-then comma errors i
noticed.
2023-08-03 10:52:16 +00:00
Leon Henrik Plickat
c16628c7f5 river: fix spatial direction focusing / swapping 2023-07-11 01:11:40 +02:00
Leon Henrik Plickat
b35d779122 river: focus-view and swap by spatial direction 2023-07-09 23:20:06 +02:00
Leon Henrik Plickat
5ce2ca1bc0 river: fix crash when trying to add tag rule without tag argument 2023-07-02 19:21:52 +02:00
Leon Henrik Plickat
0b142bd16b river: add tags rule 2023-06-28 15:38:32 +02:00
Leon Henrik Plickat
a98de941d0 river: change order of colums in list-rules command
This will make it easier to extend the command later for new rules
2023-06-27 10:47:44 +02:00
Leon Henrik Plickat
9b5ea39580 river: allow settings child type of RuleList 2023-06-27 10:44:28 +02:00
Isaac Freund
470eb22280
river-layout: Remove incorrect assertion
This assertion is not correct since removing transaction preemption.
2023-06-20 15:26:29 +02:00
Isaac Freund
6e2169a149
XdgToplevel: store scene node in wlr_surface data
This was accidentally removed in 05eac54b077, which broke
SceneNodeData.fromSurface() for xdg_toplevels.

This means that thing such as xdg-activation and idle inhibit didn't
work since that commit and should work again starting from this commit.
2023-06-05 19:49:39 +02:00
Väinö Mäkelä
792d94253c
XdgToplevel: keep wlroots updated on view sizes
When sending a configure, wlroots will send the same size that was sent
on the previous configure unless a new size is set. If a client resizes
their window itself, the size wlroots has in
XdgToplevel.scheduled will be obsolete and needs to be updated by river.
2023-05-11 23:02:34 +02:00
Pablo Ovelleiro Corral
b369815070
command/send-to-output: add -current-tags flag 2023-03-25 14:32:31 +01:00
tiosgz
e207a0e03a
Server: remove debug leftover 2023-03-24 16:57:36 +01:00
Isaac Freund
3865a7be7c
session-lock: fix assertion failures and clean up
The removed assertions aren't possible to guarantee due to the fact that
the lock render state is updated asynchronously as the output is
rendered.
2023-03-24 15:27:25 +01:00
Isaac Freund
eaa2f6d37e
LayerSurface: fix surfaces on multiple outputs at once
The previous commit broke handling of keyboard interactive
layer surfaces being created on multiple outputs at once.

This new approach reverts part of the logic change in the previous
commit while keeping the fix for the crash and the new assertion.
2023-03-16 15:10:52 +01: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
50c6ae245f
build: work around zig 0.10.0 bug to fix CI 2023-03-15 17:34:10 +01:00
Isaac Freund
c2ce893dd0
Cursor: apply x/y change during resize on commit
This fixes issues with resizing clients that stick to a fixed aspect
ratio during resize such as mpv.
2023-03-15 17:33:16 +01:00
Isaac Freund
a679743fa0
Cursor: lock to current geometry during move/resize
This eliminates cursor jitter entirely during interactive resize.

This also fixes a bug where the xdg-toplevel resizing state was not
cleared if a resize operation was aborted due to a change in view tags
or similar.
2023-03-14 13:34:55 +01:00
Isaac Freund
9db41115a8
XdgToplevel: ensure view dimensions match geometry
Some clients (e.g. mpv) do not respond to configures by committing
buffers of the exact size requested. Instead they may commit a buffer of
a smaller size in order to maintain an aspect ratio or not commit a
buffer at all.
2023-03-14 12:30:53 +01:00
Isaac Freund
90f240355e
Cursor: fix warp on output change with no views 2023-03-14 12:07:14 +01:00
Isaac Freund
0ba65848a1
Root: separate fallback list to handle 0 outputs
Mixing views that are currently being mapped/unmapped with views that
are stashed during hotplug down to 0 outputs is error-prone and almost
certainly has a bug or two hiding currently.
2023-03-14 11:53:04 +01:00
Isaac Freund
95825b0153
Root: remove incorrect assertions in addOutput() 2023-03-14 11:41:02 +01:00
Isaac Freund
dd542b5284
Output: reinitialize output_status, cleanup
If a output is removed and added back without being destroyed this must
be reinitialized.

This commit also cleans up the Root.applyPending() calls related to
output hotplug and adds some more logging.
2023-03-14 11:39:10 +01:00
Isaac Freund
b2b2c9ed13
river: add rules system
This is a breaking change and replaces the previous
csd-filter-add/remove and float-filter-add/remove commands.

See the riverctl(1) man page for documentation on the new system.
2023-03-12 16:44:19 +01:00
Isaac Freund
05eac54b07
xdg-decoration: clean up implementation
We now send some protocol errors that wlroots 0.16 is missing [1].
This also allows us to access the xdg decoration from a view, which will
be necessary for some future changes.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4051
2023-03-10 18:49:30 +01:00
Isaac Freund
fcb184f0bd
View: add none impl tag for better safety checks 2023-03-10 14:15:15 +01:00
Isaac Freund
fc6d1cca15
xdg-shell: determine tiled state by float state
How river currently sets this isn't really in accordance with the spirit
of the protocol. It was originally done this way to get gtk3 windows to
look a little bit better with borders drawn around them. However, I've
come to believe that river shouldn't just ignore standards like this.

The right way to do things would be to either implement the
xdg-decoration protocol for gtk properly or to be pragmatic and accept
some programs are intended to be used with CSD and that's OK.
2023-03-10 10:48:54 +01:00
Isaac Freund
0de3f67898
river-status: only send layout name if changed 2023-03-09 23:14:26 +01:00
Isaac Freund
ebfa892d95
XdgToplevel: clean up wlr_surface data on destroy 2023-03-08 12:20:27 +01:00
Isaac Freund
f072d19e51
Xwayland: eliminate unneeded user data usage
This is some dead code that is left over from before the scene graph
changes.
2023-03-08 11:37:28 +01:00
Isaac Freund
9a2e0d97d7
layer-shell: apply exclusive zones in separate pass
This brings the behavior closer to what we had before the scene
graph refactor.

The main difference now is that the order has changed from background to
overlay instead of from overlay to background. This ordering seems to
make more sense in the cases I've tested and the old ordering was just
cargo-cult anyways.
2023-03-07 23:43:23 +01:00
Isaac Freund
29976e5741
Seat: fix potential assertion failure 2023-03-06 20:17:59 +01:00
Isaac Freund
684f26acac
river: improve comments on pending/inflight/current 2023-03-06 16:30:42 +01:00
Isaac Freund
05e8fbc8b9
wlr-foreign-toplevel-management: implement protocol
Well, at least as much of it as was implemented before the scene graph
refactor.
2023-03-06 12:58:54 +01:00
Isaac Freund
f21eb4d05b
Xwayland: only raise views if activated 2023-03-06 10:08:10 +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
db726718ef
Cursor: use pending position to warp during move 2023-03-05 09:44:14 +01:00
Isaac Freund
cc2b38af92
presentation-time: support protocol 2023-03-04 23:06:41 +01:00
Isaac Freund
b6ac1021ae
Server: remove headless backend
This was previously used to create a noop output, but we no longer rely
on that hack.
2023-03-04 23:02:52 +01:00
Isaac Freund
44004e2d28
SceneNodeData: allow access from wlr_surfaces
This replaces the old View.fromWlrSurface function and is more general.

This commit also moves the xdg activation request_activate listener to
Server as it has no reason to be in View.
2023-03-04 22:41:35 +01:00
Isaac Freund
ea4e589fdc
river: clean up some uneeded TODOs 2023-03-04 20:58:02 +01:00
Isaac Freund
f5f9b526a0
river: fix a few leaks 2023-03-04 20:12:37 +01:00
Isaac Freund
4d2f5bb32d
Cursor: store offset and warp cursor during move
This is more reliable since it uses absolute coordinates instead of a
relative movement which could cause the cursor position to get out of
sync with the view.

This is the same approach used for resize.
2023-03-04 19:17:18 +01:00
Isaac Freund
b4ae62cd40
View: rework configure abstraction
- Move the decision whether a configure should be tracked or not into
the xdg toplevel/xwayland code.

- Only track configures for xdg toplevels with the transaction system
if the dimensions of the view are affected.
2023-03-04 16:03:16 +01:00
Isaac Freund
915fb7ae7b
xdg-shell: honor client move/resize requests 2023-03-03 20:13:06 +01:00
Isaac Freund
c29153255c
Cursor: allow resizing from all edges
Co-authored-by: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
2023-03-03 20:13:06 +01:00
Isaac Freund
8d9b6ab99e
deps: update zig-wlroots to fix Xwayland crash 2023-03-03 15:50:24 +01:00
Isaac Freund
4a9d84bdb8
Xwayland: hide override redirect windows if locked 2023-03-03 15:21:54 +01:00
Isaac Freund
0be43ad45f
Root: keep all fullscreen views the correct size
Currently we may resize fullscreen views when they become visible/not
visible when switching tags even if their fullscreen state remains
constant. This is suboptimal, and as it turns out also much more complex
to implement.
2023-03-03 13:40:44 +01:00
Isaac Freund
9ce1847d32
XdgToplevel: fix size_changed check on commit
We need to initialize the geometry on map to ensure the first commit is
handled correctly.

Also we don't care about the x/y of the geometry, only the width/height.
2023-03-02 19:24:54 +01:00
Isaac Freund
56e4efe68d
Xwayland: fix has_fixed_size heuristic for floating 2023-03-02 17:11:32 +01:00
Isaac Freund
9bfa0ece23
View: handle destroy during inflight layout demand 2023-03-02 16:42:16 +01:00
Isaac Freund
686ef11fc8
river: render floating views above the layout 2023-03-02 15:10:10 +01:00
Isaac Freund
ecb959f068
View: fix frame perfection on unmap 2023-03-01 23:04:42 +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
ed0aa73670
Output: fix background of transformed outputs 2023-03-01 19:40:37 +01:00
Isaac Freund
b1540e2d94
Root: fix use of view.current before update
In commitTransaction() we currently the current view state to determine
whether or not to enable the view's scene tree. However we don't update
the view's current state until after that check.
2023-03-01 19:03:16 +01:00
Isaac Freund
bf759c7c57
View: clamp to output on exiting float/fullscreen 2023-03-01 17:13:14 +01:00
Isaac Freund
50513390ce
View: move borders state to State struct
This state affects rendering, so it should pass through the transaction
system like the rest.
2023-03-01 16:12:27 +01:00
Isaac Freund
c1c72e23a3
Root: fix more fullscreen bugs
Moving fullscreen views between outputs now works properly.
A case in which we did not inform the client that it is no longer
fullscreen has been fixed as well.
2023-03-01 12:16:53 +01:00
Isaac Freund
5f0af38992
session-lock: fix race with multiple outputs
The race is as follows:
1. Output A commits and sets render state to pending_lock_surface
2. Output B commits and sets render state to pending_lock_surface
3. Output A presents and sets render state to lock_surface
4. maybeLock() does not lock because waiting on output B
5. Output A commits and sets render state to pending_lock_surface
6. Output B presents and sets render state to lock_surface
4. maybeLock() does not lock because waiting on output A
2023-03-01 11:33:26 +01:00
Isaac Freund
472f882f42
Output: inline renderOutput function
Having this in a separate file no longer makes sense since the switch to
the scene graph.
2023-03-01 11:32:04 +01:00
Isaac Freund
6411c71151
Root: centralize focus(null) calls in applyPending() 2023-03-01 10:49:44 +01:00
Isaac Freund
07154720fa
csd-filter-add/remove: add missing applyPending()
A transaction is now necessary to update border state.
2023-02-28 23:00:02 +01:00
Isaac Freund
8cb5ca9041
river: fix various fullscreen related bugs 2023-02-28 22:56:12 +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
005bde367c
OutputStatus: rework implementation
This was motivated by the view tags not being proplerly updated by
Root.commitTransaction() when there were no views on an output.
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
f5dc67cfc1
View: use saved surface trees for transactions 2023-02-28 14:55:59 +01:00
Isaac Freund
ce7fda4ed9
Xwayland: render using the scene graph 2023-02-28 14:55:59 +01:00
Isaac Freund
0b2272ec57
DragIcon: render using the scene graph 2023-02-28 14:55:58 +01:00
Isaac Freund
0e0b585c44
xdg-shell: implement version 5 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
85843dd5c7
View: remove dead code
wl_output.enter/leave is handled by wlr_scene now.
2023-02-28 14:55:58 +01:00
Isaac Freund
1b57fe0aa7
Xwayland: create scene tree 2023-02-28 14:55:58 +01:00
Isaac Freund
a545a06c5b
View: implement borders with scene graph 2023-02-28 14:55:58 +01:00
Isaac Freund
f4a8d6dcc9
Output: use separate scene trees for layers 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
683ed0f04e
Cursor: remove surfaceAt()
We now use the wlr_scene API to find out what is at the cursor location.
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
07294057cb
wlr-foreign-toplevel-management: remove protocol
This can be re implemented after the migration to the scene graph is
complete.
2023-02-28 14:55:58 +01:00
Isaac Freund
168756cbe8
render: remove damage tracking
This will be handled by wlr_scene shortly.
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
06cb76f937
Keyboard: fix keyboard-layout mapping crash 2023-02-28 14:40:10 +01:00
Isaac Freund
0ccf0e65d5
deps: update to latest zig-wayland/zig-wlroots 2023-02-27 13:35:55 +01:00
Isaac Freund
e1ab51f260
Seat: guard setFocusRaw() usage while locked
Focusing a layer shell or Xwayland override redirect surface while
locked is a bug.
2023-02-10 13:15:16 +01:00
Isaac Freund
5274383c72
wlr-output-management: fix bug due to zig miscompilation
It looks like having the empty error capture |_| on the else branch of
the if statement causes the else branch to be ignored by the compiler.

This should be a compile error, as the condition of the if statement is
a bool, not an error union.
2023-01-30 23:48:24 +01:00
Isaac Freund
76952183c0
session-lock: fix assertion failure on hot-plug while locked 2023-01-25 12:39:00 +01:00
Isaac Freund
946173005d
wlr-output-management: leverage new wlroots APIs
These new functions allow testing commits without messing up the
pending state of the output and needing to rollback. The new apply()
function also makes the code considerably more concise.
2023-01-24 13:55:40 +01:00
Alexander Courtis
4c6f47669b
wlr-output-management: apply adaptive sync state 2023-01-24 11:18:27 +01:00
Isaac Freund
a9bfb7c924
idle-inhibit: fix use-after-free
A user reported a crash that only reproduces when preloading a hardened
malloc implementation. From the stack trace, this use-after-free seems
to be the most likely cause. Yay hardened malloc!
2023-01-21 14:54:14 +01:00
Isaac Freund
6c7586e8d7
session-lock: properly handle disabled outputs
Outputs that are part of the layout but currently disabled (e.g. due
to use of wlr-output-power-management) are not correctly handled as
river currently waits for them to present a new locked frame before
sending the locked event.

This new frame never comes however since the output is disabled. Fix
this by maintaining the correct Output.lock_render_state as outputs
are enabled/disabled.

Additionally add missing maybeLock() calls to handle the case that all
outputs in the layout are disabled.
2023-01-18 12:31:07 +01:00
Hugo Machet
8a3530b8a3
View: fix pointer comparison in notifyTitle()
Curently since the struct is semantically passed by value not reference,
there is no guarantee that the `seat_node.data.focused.view == &self`
comparison will work as intended. Since updating to Zig 0.10.0, it seems
this latent bug has now manifested and the focused view title is no
longer sent to the client when it changes.

Fix this by taking the view argument by constant pointer instead.
2023-01-13 14:03:17 +01:00
Zakariyya Von Forslun
6fdfb7134f Cursor: fix incorrect lock manager state assertion 2023-01-13 11:14:30 +01:00
Isaac Freund
84abdfaced
command/layout: fix a memory leak 2023-01-12 15:35:31 +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
2c0c606596
flags: further cleanup after Zig 0.10
Long live the self hosted compiler!
2023-01-08 17:01:14 +01:00
Isaac Freund
09f3f141ae
deps: update to Zig 0.10 2023-01-08 16:21:42 +01:00
Isaac Freund
f370202b68
render: fix rounding for fractional scaling
We currently scale the width/height of rectangles based on the scaled
x/y instead of the unscaled x/y. This however leads to inconsistent
width/height due to rounding. Fix this bug by basing width/height
scaling off of the original x/y.

Furthermore, fix a typo where we scaled the height off of the x
coordinate instead of the y coordinate.
2023-01-08 15:25:16 +01:00
Isaac Freund
4dd02358d9
session-lock: fix assertion failure on abnormal client behavior
If the client commits a protocol error or otherwise crashes before the
session has been fully locked, we currently try to send the locked event
without checking if the client has been destroyed.

This commit adds the necessary if statement.
2023-01-07 17:35:22 +01:00
Isaac Freund
f511a34ded
session-lock: fix assertion failure due to race
There's currently a potential race in the implementation that can be hit
during unlocking. This is not a security vulnerability, but it does
cause the compositor to crash due to a failed assertion.

This commit simplifies the code and fixes the race as well as tightening
up the assertions around this state/control flow even further.
2023-01-07 14:58:28 +01:00
Isaac Freund
df2fc30238
session-lock: wait for present before locking
Currently we send the locked event after rendering and commit of blank
or lock surfaces buffers on all outputs. However, this is technically
not enough to ensure that the buffers have been presented.

Instead, listen to the wlr_output present event to ensure that no
normal, "unlocked" content is possibly visible.
2023-01-06 18:51:40 +01:00
MaxVerevkin
030f7efd4f
render: premultiply alpha for user-provided colors
The wlroots rendering API expects colors to be provided with
premultipled alpha but we currently do not parse them as such. This
causes blending with e.g. a transparent border color to be very broken.
2023-01-06 17:14:52 +01:00
alex
86ac0ffd0b river: fix bug in snap down / right
The calculation of view.pending.box.x for snap right should be based on
output_width (not output_height).

The inverse applies to view.pending.box.y for snap down.
2023-01-06 15:19:43 +01:00
Isaac Freund
39104ae9e3
command/spawn-tagmask: apply globally
Currently the spawn-tagmask applies to the currently focused output.
This however means that it is lost if the monitor is unplugged and makes
it hard to set for all outputs.

Change this to make the command apply to all outputs.

This is a breaking change.
2023-01-02 00:58:25 +01:00
shironeko
931405abe4
Rework focus-follows-cursor to work with warp
When focus-follows-cursor is used with cursor-warp, some windows will
get focus before the cursor properly "enters" the window since they have
a larger input-region than their window geometry, this causes the cursor
to be yanked to the middle unexpectedly.

This fix makes it so the focus is only given when the cursor enters the
window geometry.
2023-01-01 18:05:41 +01:00
Isaac Freund
2c86c2b6e5
river-control: update zig-wayland to fix leak
It was forgotten to destroy the callback server side object when sending
the destructor event. With the new zig-wayland version, this cannot be
forgotten.
2022-12-31 23:22:47 +01:00
Isaac Freund
609055e835
layout: fix size of CSD views
Currently we subtract the border width from the size of CSD view as well
as SSD ones, which is not correct.
2022-12-31 19:27:18 +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
Leon Henrik Plickat
5d4c2f2fbd river: fix resize command
In 489a49735 the view.move() call, which is used to keep the view centered after
a resize, was accidentally removed.
2022-12-29 14:56:06 +01:00
Isaac Freund
e18d0d5e1c
flags: automatically prepend '-'
This makes the usage a bit cleaner as the results of the parsing may be
accessed with e.g. ret.flags.version instead of ret.flags.@"-version".
2022-12-28 22:11:14 +01:00
Isaac Freund
2be9ac05d6
command/map: use flags.zig, cleanup 2022-12-28 21:56:42 +01:00
Isaac Freund
0cb6b3f81d
command/keyboard-layout: use flags.zig, cleanup 2022-12-28 20:21:23 +01:00
Isaac Freund
16cbe5f469
flags: rewrite to allow [:0]const u8 arguments
This also cleans up the code by using @Type(), eliminating the need
for the argFlag() and boolFlag() functions.

Allowing [:0]const u8 arguments makes this parser useful for
river-control commands as well.
2022-12-28 20:21:23 +01:00
Leon Henrik Plickat
ad1dbb1180
river: add keyboard-layout command
This allows switching river's keyboard layout at runtime.
2022-12-28 20:20:36 +01:00
Andrea Feletto
2eb0a7a75c
river: support wp-single-pixel-buffer-v1 2022-12-24 20:14:30 +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
Isaac Freund
096e175cec
View: honor fullscreen requests before map 2022-12-24 03:06:53 +01:00
MaxVerevkin
e603c5460a
river-status: correctly advertise version 4
This should have been a compile error but slipped through due to a bug
in zig-wayland. This bug has now been fixed and the submodule updated.
2022-12-02 15:19:13 +01:00
Leon Henrik Plickat
b8e2ee2a0c
river-status: expose current layout name 2022-12-01 15:51:00 +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
Isaac Freund
cce729d89d
session-lock: send wl_pointer.enter immediately 2022-11-13 16:45:18 +01:00
Isaac Freund
98d2f6a568
session-lock: add basic logging 2022-11-13 16:45:18 +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
c0e64829f0
layer-shell: start transaction on map
The fact that this call is missing is a bug, as the changes made by
arranging the output layers as well as changes to the focus will not be
fully applied.
2022-08-25 13:24:42 +02:00
Leon Henrik Plickat
29ae7ba311 river: advertise correct version of layout protocol 2022-08-19 00:04:16 +02:00
Leon Henrik Plickat
844ffce037
river-layout: add user_command_tags event
It is not guaranteed that the next layout_demand event after a user_command
event has the same active tags (for example when there are no views visible).
As an example, a user could trigger a user_command while no views are visible,
then switch to a different tag set which has active views. The active tags of
the previous layout_demand may also be different.

Therefore it is impossible to correctly implement a layout generator which has
user commands apply only to the currently active tag set, which is solved by
this patch.
2022-08-16 13:40:07 +02:00
Isaac Freund
416fdc8d06
layout: only arrange on user command if layout is active 2022-08-15 15:51:40 +02:00