Commit Graph
100 Commits
Author SHA1 Message Date
Isaac Freund f2cf4b9455 common: use -h instead of -help
This doesn't really matter that much as unrecognized options will still
trigger a help message to be printed, but -h is much more standard so
lets make the predictable choice here while sticking to only single '-'
flags.
2021-11-01 00:34:15 +01:00
Isaac Freund 4cee1fb881 docs: assorted fixes/cleanups 2021-11-01 00:29:06 +01:00
Isaac Freund 8757644b2a docs: standardize on "layout generator"
This is likely more clear than "layout client" to most users.
2021-10-31 22:32:59 +01:00
Isaac Freund 8134b81283 Cursor: fix move/resize with high poll rate/low dpi mice 2021-10-30 20:40:35 +02:00
Isaac Freund 4b0c5acc46 View: fix checks to respect client side move/resize 2021-10-30 12:54:23 +02:00
Isaac Freund b986196118 view: respect client size resize of floating views
mpv for example has key bindings to set the window size to a multiple of
the video resolution. This is a valid use case for client-size resizing
of the view and river should respect this if the view is floating.
2021-10-30 12:22:49 +02:00
Isaac Freund e447e1b41f Xwayland: always send configure if requested
This seems to fix an issue with mouse input for steam if steam is not
started on an output at 0,0. X11 is pretty spooky.
2021-10-20 15:40:50 +02:00
Isaac Freund c84fd1a936 View: send enter/leave events to full surface tree 2021-10-20 14:11:19 +02:00
Isaac Freund 5bf7d22972 Cursor: only trigger focus-follow-cursor on motion
This greatly improves the UX of this feature, as views moving under a
stationary cursor (as happens during the zoom command for example) will
no longer trigger focus change.
2021-10-20 13:22:24 +02:00
Isaac Freund 4b94b9c083 Xwayland: honor fullscreen requests 2021-10-12 18:47:08 +02:00
Isaac Freund 50814e0ffe pointer-constraints: fix coordinates
Currently the implementation treats the x/y coordinates of
View.State.box as layout coordinates instead of output-relative. This
causes issues when using an output not at 0,0.
2021-10-11 15:01:57 +02:00
Isaac Freund 3b24e7fcd5 contrib: recommend using a venv for layout.py
This avoids needing to run pwayland's scanner with root privileges and
install the river-layout bindings to system directories.
2021-10-06 12:16:36 +02:00
Isaac Freund 5b8eab569c Server: fix use after free in deinit()
The input manager and seats must be destroyed before the display is
destroyed as they need to destroy their timer event sources used for key
repeat.
2021-10-02 14:48:23 +02:00
Isaac Freund 9270a2df08 View: fix unmap/destroy control flow
Currently the view destruction sequence is started as soon as a view
is unmapped. However, this is incorrect as a client may map the view
again instead of destroying it.

Instead, only start the view destruction sequence when the underlying
xdg toplevel or xwayland surface is destroyed.
2021-10-02 14:48:22 +02:00
Isaac Freund e0784247b6 doc: update my (Isaac's) email address 2021-10-02 13:01:58 +02:00
Isaac Freund fd70a93c67 View: add fullscreen check missing in previous commit 2021-10-02 12:05:24 +02:00
Isaac Freund e6bb373240 View: resize if moved between outputs while fullscreen 2021-09-30 17:17:46 +02:00
Isaac Freund 8ec0e30fd7 Subsurface: remove commit listener in destroy()
Currently if destroy() is called while a subsurface is mapped a dangling
commit listener is left behind. This is obivously a problem, so check if
the subsurface is mapped in destroy() and remove the listener if needed.
2021-09-30 16:45:14 +02:00
Isaac Freund 6616d32353 ci: fix xbps invocation
This avoids errors like:

util-linux-common-2.37.2_1 in transaction breaks installed pkg `libfdisk-2.37.1_1'
util-linux-common-2.37.2_1 in transaction breaks installed pkg `libsmartcols-2.37.1_1'
libuuid-2.37.2_1 in transaction breaks installed pkg `libfdisk-2.37.1_1'
libuuid-2.37.2_1 in transaction breaks installed pkg `util-linux-2.37.1_1'
libblkid-2.37.2_1 in transaction breaks installed pkg `libfdisk-2.37.1_1'
libblkid-2.37.2_1 in transaction breaks installed pkg `util-linux-2.37.1_1'
libmount-2.37.2_1 in transaction breaks installed pkg `util-linux-2.37.1_1'
Transaction aborted due to unresolved dependencies.
2021-09-27 19:10:46 +02:00
Isaac Freund a3fdb294b3 Cursor: implement surfaceAt() for XwaylandUnmanaged 2021-09-27 18:34:59 +02:00
Isaac Freund b8ebbc29cf xdg-toplevel: fix configure serial checking
Currently if another configure is in flight after the one we are
tracking the serial of and the client acks the second configure as well
(or only the second configure) before committing, we will never realize
the configure we are tracking has been acked.

Instead, listen for the ack_configure signal and set a bool that we can
check on surface commit.

This probably isn't an issue that would actually be hit by well behaved
clients as river doesn't send redundant configure events. However,
having correct code is always better even if it's slightly more complex.
2021-09-18 18:45:30 +02:00
Isaac Freund 98aed8d47e river: fix viewporter protocol implementation
It turns out that wlroots requires us to do a bit more than just create
the wlr_viewporter. Docs are being added to the wlroots header in
https://github.com/swaywm/wlroots/pull/3171
2021-09-06 19:03:17 +02:00
Isaac Freund 119d733bdf docs: update example init for float fitler changes 2021-09-06 14:46:34 +02:00
Isaac Freund 6e51a8fcdd river-status: fix output status destruction
There was a use-after-free if the Output was destroyed first, and the
memory of the output status was leaked.
2021-08-12 22:38:08 +02:00
Isaac Freund d4c249a5cb output: simplify layer shell handling on destroy
No need for noop output hacks here, wlr.LayerSurfaceV1.close()
synchronously emits the unmap signal if the layer surface is mapped.
2021-08-12 21:58:17 +02:00
Isaac Freund 1e18ac9d74 layer-shell: ignore commits on closed layer surface 2021-08-12 21:18:26 +02:00
Isaac Freund 1baf3bf462 seat: always add view to focus stack on map
Currently if a view is mapped while some other view is fullscreen, it
will not be added to the focus stack, which means that if the fullscreen
view is then closed the view which was not added to the focus stack will
not be focused.

To fix this, always add views to the focus stack on map.
2021-08-10 21:54:36 +02:00
Isaac Freund e752555969 config: fix leak of default layout namespace 2021-08-09 16:48:51 +02:00
Isaac Freund 7013bc3b69 Xwayland: fix possible use-after-free on unmap
The view.unmap() call may synchronously destroy the view, which makes
the the code removing listeners which is currently run after
view.unmap() access free'd memory.

To fix this, simply change the order of the calls to match that of
XdgToplevel.handleUnmap().
2021-08-09 16:40:45 +02:00
Isaac Freund 2fc0875a3e river: fix crash on disabling all outputs
If using the on-output-change cursor warp option river currently crashes
when the last real output is disabled as the noop output used as a
fallback is not present in the output layout.
2021-08-02 16:16:58 +02:00
Isaac Freund 295f965f91 river-layout: fix typo in protocol 2021-08-02 15:58:56 +02:00
Isaac Freund 2f3fe5019b util: remove unused function 2021-07-31 00:57:23 +02:00
Isaac Freund 00f51e00b4 cursor: remove strict focus-follows-cursor mode
This is pretty much unusable after recent improvements to the cursor
code, and was totally broken causing a stack overflow as soon as the
cursor was moved over any surface until the previous commit.

Furthermore, none of the core contributors or people active on IRC seem
to use it.
2021-07-29 14:05:17 +02:00
Isaac Freund bae826ef0e cursor: fix crash if focus-follows-cursor is set
Currently we hit a stack overflow as we do not check if the target view
already has keyboard focus before calling Seat.focus() in
Cursor.passthrough(). To fix this, simply add this check.
2021-07-29 13:42:36 +02:00
Isaac Freund 863f8156f7 river: properly teardown surface tree
When an xdg toplevel, layer surface, etc is destroyed, it is not
guaranteed that all the children in the surface tree have already been
destroyed. If there are still children around, destroying the root of
the tree would leave dangling pointers.

To fix this, destroy all children when destroying any node in the tree.
2021-07-28 13:44:23 +02:00
Isaac Freund 9e70fb25a5 output: fix debug log on tag change 2021-07-28 13:44:23 +02:00
Isaac Freund 8a1e96cddc config: change color format to 0xRRGGBBAA
The current format of #RRGGBBAA is problematic as # starts a comment
in POSIX compliant shells, requiring escaping/quoting and increasing
complexity.

This is a breaking change.
2021-07-26 20:36:46 +02:00
Isaac Freund ae871c2fee docs: Wayland should always be capitalized
This matches the style used on https://wayland.freedesktop.org/
2021-07-26 12:20:48 +02:00
Isaac Freund bbfd0c334c view: arrange when exiting fullscreen to layout
This arrange is actually required because the post_fullscreen box might
not hold the correct dimensions if the view was made fullscreen while
a transaction was already in progress.
2021-07-25 22:30:47 +02:00
Isaac Freund 988a4623ab view: ensure saved buffers are always dropped
Currently if a view is moved from layout to fullscreen while a
transaction involving that view is in progress the saved buffers are not
dropped, which causes stale state to be rendered.
2021-07-25 22:22:46 +02:00
Isaac Freund eab9c0901a layout: assert output state matches layout applied
This is guaranteed to already be set to the layout being committed. It
is set either when a client binds a new layout object or when the user
changes the layout namespace in use.
2021-07-25 22:17:40 +02:00
Isaac Freund a07e5de945 build: install river-layout-v3 to $PREFIX/share/river
This makes it easier for other projects (i.e. everyone's layout
generators) to depend on the protocol xml without needing to vendor it.

The river-layout-v3 protocol should remain stable for the
forseeable future, hopefully forever. On the other hand, the current
river-control-unstable-v1 and river-status-unstable-v1 protocols
will be replaced as soon as we have time to implement better
versions. Therefore, let's not encourage usage of the protocols we
intend to remove.
2021-07-25 19:31:38 +02:00
Isaac Freund b49ea34f15 build: remove example river-status client
This is out of date and currently doesn't compile. It also doesn't
really belong in the repository IMO, except maybe in the contrib
folder.
2021-07-25 19:15:33 +02:00
Isaac Freund 4cc1167863 river: improve new layer surface log formatting 2021-07-25 17:17:45 +02:00
Isaac Freund 734521560b river: add custom wlroots log handler
This makes river's log output more consistent and will allow
filtering by the wlroots scope in the future.
2021-07-25 01:22:36 +02:00
Isaac Freund c26d18647b river: simplify log levels exposed to the user 2021-07-24 20:45:58 +02:00
Isaac Freund 8eaf7eb9cd docs: fix inconsistent capitalization 2021-07-24 19:45:25 +02:00
Isaac Freund aa19a1a964 docs: add -help and -version options to man pages 2021-07-24 19:42:34 +02:00
Isaac Freund 23088b800c common: standardize on -help option
Also:

- Check for -help option *before* unknown options
- Use common flags parsing code for riverctl
- Add usage text to riverctl
2021-07-24 19:31:04 +02:00
Isaac Freund a5a505ecba common: remove support for positional arguments
This is currently unused and I don't like the approach anymore
regardless. If/when we need positional arguments (probably when
implementing the upcoming river-control protocol in rivertile)
they should be handled separately from flags.

This commit also improves the CLI error reporting to always print the
usage string if invalid arguments were passed.
2021-07-24 18:29:48 +02:00
Isaac Freund f6fa3425de river: use common CLI arg parsing code
This makes river's main() function quite a bit cleaner.
2021-07-24 16:44:11 +02:00
Isaac Freund 9c633a7888 layout: cleanup in progress layout demand on destroy
This fixes an issue where a layout client that crashed during a layout
demand caused river to enter invalid state and potentially soft-lock.
2021-07-24 14:14:36 +02:00
Isaac Freund 6f91011895 river: fix crash on parsing empty string as color 2021-07-24 10:39:38 +02:00
Isaac Freund f371e00716 cursor: fix logic in Cursor.updateState()
The previous commit re-introduced a bug fixed by a3c65713 which caused
the pointer enter event not to be sent until moving the pointer when
switching tag focus or otherwise manipulating the window manager caused
the cursor to end up over a new surface.
2021-07-24 02:30:15 +02:00
Isaac Freund 53dd3875b3 cursor: avoid sending unnecessary pointer motion events
If the current Cursor.maybeResetState() function is called while in
passthrough mode, it will send a pointer motion event. This is
unnecessary as we have already sent the same pointer motion event at
least once.

Also refactor the code slightly and improve naming.
2021-07-23 19:18:49 +02:00
Isaac Freund b243cd7fc3 river: destroy backend before Root.deinit()
Handling output destroy now requires the wlr_output_layout to still be
around, as we need it to properly handle cursor state. In order to make
sure that all outputs are destroyed before the wlr_output_layout is,
simply destroy the backend before calling Root.deinit().
2021-07-23 19:03:08 +02:00
Isaac Freund 36ce81bb67 cursor: add missing maybeResetState() callsite
This function needs to be called whenever pending state is made current,
which includes when views not tracked by the transaction system commit.
2021-07-23 18:37:24 +02:00
Isaac Freund f86291169e cursor: allow commands to override cursor operations
Now that we properly handle state changes during cursor operations,
blocking these commands if the target view is the target of a cursor
operation is unnecessary complexity. It is also inconsistent as we
don't block changing the tags of the view.
2021-07-23 17:11:43 +02:00
Isaac Freund 969d7b0344 cursor: remove surfaceAt() parameters
We always pass the current cursor position, so this is a nice
simplification.
2021-07-23 16:52:48 +02:00
Isaac Freund 7428519a93 cursor: refactor surfaceAt() to return parent
This allows us to properly handle e.g. clicking on a xdg popup of a view
that is not currently focused by focusing that xdg popup's parent view.
2021-07-23 16:33:25 +02:00
Isaac Freund f62eedb048 render: sync with Cursor.surfaceAt(), draw all view popups
This was slightly out of sync with Cursor.surfaceAt() which did not
fullscreen or xwayland unmanaged views properly. Also simplify things
and improve correctness by always rendering all xdg popups. A view
losing focus does not always mean that all popups will be destroyed.
2021-07-23 15:42:47 +02:00
Isaac Freund b7d330c0da river-layout: make minor copyediting fixes 2021-07-22 11:45:46 +02:00
Isaac Freund b7e15a8ef6 river: make spawn command take only one argument
Currently the spawn command takes any number of arguments and naively
joins them together with spaces before passing them as the single
argument of `/bin/sh -c`. This however produces unexpected results as
soon as shell quoting gets involved in the arguments passed to spawn.
For example, running

riverctl spawn foo "bar baz"

will execute `/bin/sh -c "foo bar baz"`, unexpectedly splitting bar and
baz into separate arguments. To avoid this confusion, make the spawn
command take only a single argument, forcing the user to quote properly
to spawn multi-argument commands.
2021-07-21 14:07:49 +02:00
Isaac Freund 1d000e5666 rivertile: simplify commands
Instead of having separate commands for modifying/setting a value, use
the presence of a +/- sign to indicate modification.
2021-07-21 14:01:51 +02:00
Isaac Freund 2635f3299a river-layout: update to v3
- Remove advertise_view and advertise_done events. Using the information
provided by these for any purpose would make the layout far less
predictable. Futhermore, in the months this has been available for use,
to my knowledge nobody has actually used it for anything useful.

- Replace the set/mod layout value events with a single user_command
event. This simplifies the protocol and is more flexible for clients.

- Add a layout_name argument to the commit request. This name is an
arbitrary, user-facing string that might, for example, be displayed by a
status bar. This was present in early drafts of the protocol, but was
removed in favor of river-options. Since river-options itself has since
been removed and this feature is nice to have, re-add it.

- Rename main factor to main ratio in rivertile. The "factor" name was
just legacy from dwm, "ratio" is much more accurate.
2021-07-20 10:48:11 +02:00
Isaac Freund 96e1082156 river: remove opacity command
This code is complex and increases maintenance burden but doesn't
add any functionality, only eye-candy.

Futhermore, neither I nor any of the core contributors use it.

There may be a place in river for such eye-candy down the line, in which
case this code could be revived. Currently river is early enough in its
development that our focus should be on core functionality instead.
2021-07-20 08:47:02 +00:00
Isaac Freund b6212ba972 docs: improve formatting consistency 2021-07-20 02:31:24 +02:00
Isaac Freund f30610d64c docs: mention man pages before wiki
Don't want people getting the idea that the wiki is more important. The
man pages are the only official documentation.
2021-07-17 16:13:10 +02:00
Isaac Freund d6ad06ae87 docs: simplify README 2021-07-17 16:10:07 +02:00
Isaac Freund 0063c722e5 river: remove system /etc dir from init search paths
A true "default" config doesn't make sense for river. Everyone who uses
river seriously will customize their init script. Futhermore, the
current behavior of embedding the install path of the default system
config in the river binary is complex and prone to breaking.
2021-07-17 16:04:51 +02:00
Isaac Freund 604cf98047 command: make args type 0-terminated
Since we often need to pass these args back C code, keeping the 0 byte
around saves some allocations.
2021-07-15 13:32:33 +02:00
Isaac Freund 3c951fed74 view: fix typo causing UB on resizing xwayland views 2021-07-14 23:51:49 +02:00
Isaac Freund d413db9227 xdg-shell: set resizing state during interactive resize 2021-07-14 15:32:24 +02:00
Isaac Freund 7b18b4944e config: use hash sets for filters, clean up code 2021-07-12 17:57:01 +00:00
Isaac Freund e2e4cd2953 doc: remove dead wiki link from readme
river is now in nixpkgs so this page and the link are undeeded.
2021-06-30 11:04:33 +02:00
Isaac Freund 39578db134 render: @panic() if CLOCK_MONOTONIC is not supported
Making this unreachable and invoking illegal behavior is incorrect.
2021-06-27 13:20:36 +02:00
Isaac Freund df492f83e6 completions: add set-cursor-warp for zsh/fish 2021-06-26 19:03:49 +02:00
Isaac Freund 505639432e Revert "build: assert wlroots version at comptime"
zig-wlroots now has this assert built in

This reverts commit 3392b21aa8.
2021-06-24 20:21:07 +02:00
Isaac Freund 3392b21aa8 build: assert wlroots version at comptime
This will prevent people compiling river against the wrong wlroots
version and wondering why it crashes.
2021-06-24 19:34:15 +02:00
Isaac Freund 951c11f642 ci: build wlroots from source 2021-06-23 15:35:10 +02:00
Isaac Freund 41874b47ae code: update to wlroots 0.14.0 2021-06-23 15:35:10 +02:00
Isaac Freund 3efcfedcf4 layer-shell: handle commits before map
A client is free to change its mind and request a different
size/anchor/etc after recieving the initial configure but before
attaching and committing the first buffer. This means that we should
respond to such a situation with a new configure.

mako has been observed doing this in the wild for example.
2021-06-22 14:07:14 +02:00
Isaac Freund a2c81adba0 xdg-toplevel: remove listeners before view destroy
Currently in handleUnmap() we call View.unmap() before removing
listeners. However View.unmap() may destroy the view before returning
if the transaction started doesn't have to wait on any configures.

To ensure that we don't try to remove listeners which have already been
free'd, do this before calling View.unmap().
2021-06-17 20:57:14 +00:00
Isaac Freund 5daec347c0 render: damage on background/border color change 2021-06-16 17:42:09 +00:00
Isaac Freund f3024d9198 decoration: remove listeners on destroy 2021-06-14 22:55:10 +00:00
Isaac Freund 9ecffe21d8 layout: fix use-after-free in destroy() 2021-06-14 22:45:11 +00:00
Isaac Freund 6f61ea07db view: ensure surface_box is initailized before use 2021-06-14 22:37:14 +00:00
Isaac Freund 37251c8758 output: handle OutputDamage destroy
This may be destroyed before our output destroy listener is called.
2021-06-14 22:17:01 +00:00
Isaac Freund 20eb94317a root: simplify noop output handling
Instead of removing the listeners of the noop output early, simply never
add them.
2021-06-14 21:52:44 +00:00
Isaac Freund cab947b3a3 ci: add gcc to fix build
Zig relies on the existence of a system c compiler in order to
find the native libc include paths.
2021-06-09 20:35:30 +00:00
Isaac Freund 88410cc2b8 output: destroy Layouts on Output removal
The Layout struct holds a pointer to the Output which becomes invalid
when the Output is destroyed so we must ensure all the layouts of an
Output are destroyed first.
2021-06-09 20:03:19 +00:00
Isaac Freund 68267a4cfe river: don't extend timeout on transaction preemption
This avoids locking up the compositor if a client is unresponsive and
the user continuously initiates new transactions through their actions.
2021-06-08 15:18:45 +00:00
Isaac Freund e90474657f view: send activated/fullscreen configures immediately
The transaction system exists to coordinate size changes of all views
in a layout in order to achieve frame perfection. Since many clients
do not need to commit a new buffer in response to a activated state
change alone, this breaks things when such a configure event is tracked
by the transaction system. Instead, simply send activated and fullscreen
configures right away but still track this state in a double-buffered
way so that e.g. border color changes based on focus are frame-perfect.

This also fixes a related issue with the transaction system where views
that did not need to commit in response to our first configure were not
rendered until their next frame.
2021-06-08 06:00:15 +00:00
Isaac Freund 021fd8f376 code: remove now unnecessary zig fmt directives
zig fmt does what we want since zig 0.8.0
2021-06-08 03:20:56 +00:00
Isaac Freund 1bacaa5b43 view: get rid of notifyConfiguredOrApplyPending()
This function is only called in one place, just inline the code.
2021-06-08 02:56:19 +00:00
Isaac Freund cef6d5a0be render: fix damage tracking of drag icons 2021-06-07 18:34:54 +00:00
Isaac Freund 0e9dc089d1 render: track subsurfaces created before role assignment 2021-06-05 19:30:43 +00:00
Isaac Freund aaf5a190fc doc: correct zig version requirement in readme 2021-06-05 19:15:21 +00:00
Isaac Freund c0a2286847 code: update to zig 0.8.0 2021-06-05 17:29:58 +00:00
Isaac Freund ca4abd261f xdg-toplevel: remove set_app_id listener 2021-05-31 15:46:39 +00:00