Commit Graph

771 Commits

Author SHA1 Message Date
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
Keith Hubbard
556d790694 render: draw borders before rendering views
Menus, tooltips, etc. can extend beyond a view's borders.  Render views
after their borders so floating content appears on top.

Unfocused floating content can still be obscured by views higher in the
stack and the focused view.
2021-08-07 10:18:52 +00: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
novakane
879046ef83 completions: Remove strict in focus-follows-cursor 2021-07-29 17:19:06 +00: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
novakane
f56c892958 build: Use pkg-config to handle river protocols 2021-07-28 19:30:50 +00: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
Rafael Escobar
90008cfa53
docs: fix typo in rivertile man page 2021-07-27 01:31:34 +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
novakane
32d35cdf91 Add -version flag to river, riverctl and rivertile 2021-07-24 14:14:53 +00: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
Leon Henrik Plickat
a3c6571326 cursor: reset state if needed on transaction commit
A transaction may move the current target of a cursor action to a
non-visible tag, make it fullscreen, or otherwise change things such
that the current cursor state no longer makes sense.

To handle this, check if we should reset cursor state every time a
transaction is committed.
2021-07-23 11:48:01 +00: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
Leon Henrik Plickat
dfa2471141
contrib: update layout.c for river-layout-v3 2021-07-21 14:01:51 +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
novakane
22251fa7ed
completions: Update for river-layout-v3 2021-07-20 10:48:48 +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