Commit Graph

160 Commits

Author SHA1 Message Date
Isaac Freund
033cad47bf
build: update to Zig 0.12 2024-05-20 11:35:36 +02:00
Isaac Freund
94828474b0
View: add more assertions around destruction
This should make leaks like the one fixed by the previous commit harder
to write.
2024-04-08 15:19:12 +02:00
Isaac Freund
3594fe501e
View: fix assertion failure if focused while destroying
Also clean up this code a bit, it's no longer necessary to split these
one line functions out into separate files as Zig's conditional
compilation support has improved since these functions were originally
written.
2024-04-08 12:54:05 +02:00
Isaac Freund
13b9d23e2f
View: fix potential assertion failure on destroy
If a View is destroyed while part of a transaction we can currently hit
an assertion failure, this commit fixes it.
2024-03-18 22:33:24 +01:00
Isaac Freund
3f49ff9631
deps: update zig-wayland for a minor cleanup 2024-03-15 19:10:18 +01:00
Isaac Freund
0e2cac08df
XdgToplevel: eliminate "self" naming convention 2024-03-14 12:19:36 +01:00
Isaac Freund
99a99b72e7
View: eliminate "self" naming convention 2024-03-14 12:07:27 +01:00
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
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
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
Peter Kaplan
d71bebc032
command/attach-modes: above and below options 2024-03-05 17:53:16 +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
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
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
69a51cadb4
attach-mode: code/documentation style tweaks 2024-01-13 12:36:20 -06:00
Orfeas
6a71fc65b0
attach-mode: implement after <N> 2024-01-13 12:29:09 -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
c38e7e2d87
Root: remove unneeded fallback.inflight lists 2024-01-09 13:03:55 -06: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
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
Doclic
bf4154007d river: add outputs rule 2023-10-19 12:58:11 +02: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
Leon Henrik Plickat
0b142bd16b river: add tags rule 2023-06-28 15:38:32 +02: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
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
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
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
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
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
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
9bfa0ece23
View: handle destroy during inflight layout demand 2023-03-02 16:42:16 +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
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
6411c71151
Root: centralize focus(null) calls in applyPending() 2023-03-01 10:49:44 +01:00
Isaac Freund
8cb5ca9041
river: fix various fullscreen related bugs 2023-02-28 22:56:12 +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