Commit Graph
100 Commits
Author SHA1 Message Date
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
Isaac Freund c479525ab8 rivertile: fix code to disallow 0 main count
Also document this limit
2023-01-06 17:47:54 +01:00
Isaac Freund e49db7682c build: bump version to 0.3.0-dev 2023-01-02 01:55:16 +01:00
Isaac Freund 4d8f816305 build: bump to version 0.2.0 2023-01-02 01:12:11 +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
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
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 eed7d94557 docs: improve keyboard layout documentation
- Remove recommendation of XKB_* environment variables in river(1) as we
  now have a dedicated riverctl keyboard-layout command.

- Give an example of how to use and switch between multiple layouts in
  the riverctl(1) man page.
2022-12-28 20:43:54 +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
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
Isaac Freund 4af7a3cb63 river-layout: fix version of layout_name events 2022-12-01 16:10:08 +01:00
Isaac Freund 3141940efb map-pointer: minor fixes and cleanups 2022-11-25 14:06:31 +01:00
Isaac Freund e2a27b3a4e example/init: run rivertile in background
There have been multiple "bug reports" from users that have added more
configuration using riverctl after this line starting rivertile and were
confused why that configuration has no effect.

It's not our job to explain how POSIX shell works, but we can make the
example a bit more foolproof for those who do not yet have experience
with it
2022-11-25 12:40:11 +01:00
Isaac Freund 3ed71c51e2 deps: update to latest zig-wlroots
This fixes a crash handling switch toggle events
2022-11-20 11:33:42 +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
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 ba823ef96e ci: remove Void Linux CI
This doesn't really seem worth keeping as glibc linux is already covered
by the Arch Linux CI and Void lags behind on package updates enough
compared to the others to be annoying.
2022-11-13 16:37:14 +01:00
Isaac Freund 29f32639a6 ci: update to wlroots 0.16.0 and wayland 1.21.0 2022-11-13 16:36:21 +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
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
Isaac Freund 416fdc8d06 layout: only arrange on user command if layout is active 2022-08-15 15:51:40 +02:00
Isaac Freund 1a9cba2aa9 river: fix SIGPIPE handling, cleanup fork/execve
Installing an empty handler does not have the same effect as using
SIG_IGN as the failing write syscall will not return EPIPE.
2022-08-11 12:02:30 +02:00
Isaac Freund d4b2f2b0fc Seat: send enter event on keyboard device creation
Currently we don't send an enter event when a new keyboard device is
created which causes issues when switching ttys. On switching away the
keyboard device is destroyed and leave is sent. Currently on switching
back the keyboard device is re-created but no enter event is sent before
we start sending key events, which is a violation of the protocol.
2022-07-26 16:25:04 +02:00
Isaac Freund 403eca90a5 ci: explicitly install libevdev
This is currently pulled in transitively on void, arch, and FreeBSD
which just stopped working on void due to upstream changes.
2022-07-10 19:00:17 +02:00
Isaac Freund 7402cb8aea deps: update to latest zig-wlroots
This fixes the return type of Foo.fromWlrSurface() functions which can
in fact return null in the edge case that the role matches but the
corresponding object has already been destroyed.
2022-07-01 20:53:45 +02:00
Isaac Freund db366e9455 Xwayland: fix View.fromWlrSurface for OR surfaces 2022-06-24 12:05:54 +02:00
Isaac Freund 7d9d889226 deps: update to latest zig-wlroots
This fixes a nasty ABI bug that could cause river to crash when
hotplugging down to 0 outputs.
2022-06-23 18:50:00 +02:00
Isaac FreundandDaan Vanoverloop 2eb013e214 Cursor: implement initial touch support
Still TODO are:
- Touch support for drags
- Mapping input devices to outputs (necessary for good multi-monitor
touch support)

Co-authored-by: Daan Vanoverloop <daan@vanoverloop.xyz>
2022-06-22 11:06:35 +02:00
Isaac Freund 5cce49095a Seat: refactor InputDevice handling
- The lifetimes of the Keyboard and Switch structs are now directly
tied to the corresponding InputDevice, which has become a field of
those structs.

- Seat capabilities are now properly updated on removing a keyboard.

These changes align with input device refactoring in upstream wlroots
which will make updating to easier 0.16.0.
2022-06-21 16:25:37 +02:00
Isaac Freund 67d07e84b0 InputDevice: use "switch" in input device names
Currently we use "switch_device" because that's what the enum variant
happens to be named in zig-wlroots so that it doesn't conflict with the
switch keyword.

This however wasn't really thought through and "switch" makes more sense
to expose to the user.
2022-06-20 19:51:34 +02:00
Isaac Freund c40dc5ee75 InputDevice: move to separate file 2022-06-20 16:29:35 +02:00
Isaac Freund 78d96d19e4 example/init: don't use exec
This causes far too much unnecessary confusion for people new to shell
scripting and is fairly pointless anyways.
2022-06-17 19:29:28 +02:00
Isaac Freund a413790158 build: don't scan xdg-output
This was used for the river-options protocol implementation in riverctl
and is no longer needed since the river options protocol got removed.
2022-06-03 23:31:07 +02:00
Isaac Freund 50c9e3d81b Cursor: revive 'always' focus-follows-cursor mode
This was removed a while back because it was buggy and I didn't know
of anyone using it. Since refactoring it is now trivial to implement
and I know of at least one person using it, so I don't mind reviving it.
2022-06-03 12:03:08 +02:00
Isaac Freund 2df2151afa river-status: only send mode event if client bound version 3 2022-06-02 12:21:57 +02:00
Isaac Freund d657dc791b river-status: add mode event to seat status
This allows clients such as a status bar to display the currently active
mode.
2022-06-01 00:15:09 +02:00
Isaac Freund 03e8da669c Xwayland: Rename XwaylandUnmanaged to XwaylandOverrideRedirect 2022-05-30 01:08:09 +02:00
Isaac Freund 706dca9b1a ci: fix xbps invocation 2022-05-29 20:17:39 +02:00
Isaac Freund 960afa89ec View: refactor initialization
This anytype parameter is a wart that's been around for far too long.
2022-05-29 16:28:12 +02:00
Isaac Freund 6ef97eea24 Xwayland: handle override redirect state changes 2022-05-29 16:28:07 +02:00
Isaac Freund d1997139cc docs: add note on example init file to PACKAGING.md 2022-05-22 19:17:14 +02:00
Isaac Freund 71ba891850 docs: expand on -Dcpu in PACKAGING.md 2022-05-22 16:17:55 +02:00
Isaac Freund d0625d668a docs: create PACKAGING.md 2022-05-22 15:35:42 +02:00
Isaac Freund 3cb6428da6 build: add -Dstrip and -Dpie build options 2022-05-22 15:25:38 +02:00
Isaac Freund ded490d3dd Output: remove overzealous assert
If running river with WLR_BACKENDS=headless, every output is headless
not just the noop output.
2022-05-20 15:13:28 +02:00
Isaac Freund 7c440b834e build: follow semantic versioning for -dev versions
The new version format is 0.2.0-dev.76+d1cf95b which is compliant to the
semantic versioning 2.0.0 spec and sorts better than the old format.
2022-05-16 22:34:43 +02:00
Isaac Freund 7122df7ec4 layer-shell: fix overflow if desired size exceeds output bounds 2022-05-16 19:03:23 +02:00
Isaac Freund d47be3b592 deps: update to latest zig-wayland 2022-05-11 18:02:32 +02:00
Isaac Freund 90b37645cf ci: make wget output non verbose
This still prints errors, but doesn't print progress bars or other
superfluous information.
2022-05-01 19:03:32 +02:00
Isaac Freund e0246c0410 Cursor: Don't passthrough() on update if hidden
Currently when the surface under the hidden cursor changes, we
passthrough() which results in the cursor being made visible and giving
pointer focus to the surface under the cursor if any. Obviously this is
not desirable as the cursor is supposed to remain hidden until moved.
This added check prevents this.
2022-04-19 11:10:53 +02:00
Isaac Freund ae349b0ce4 layer-shell: fix overflow with large bottom margin 2022-03-28 12:11:28 +02:00
Isaac Freund adf6e1f19d layer-shell: allow surfaces larger than the output
The motivation for this change is to simplify the implementation
and remove a massive footgun that is currently present and causing
UB/crashes. If a layer surface is destroyed in arrangeLayers() then
the code in LayerSurface.handleCommit() after the arrangeLayers()
call accesses free'd memory. This is of course possible to fix,
but it's far simpler to loosen up the protocol implementation a bit.

The new implementation is also in line with what sway and the new
wlroots layer shell helper do and is perfectly valid according to
the protocol.
2022-03-05 14:25:20 +01:00
Isaac Freund 238c39379d doc: Add additional style rule to CONTRIBUTING.md 2022-03-02 15:34:51 +01:00
Isaac Freund 7b4c9c39ee DragIcon: Properly initialize if already mapped 2022-02-26 16:54:48 +01:00
Isaac Freund 1c1be3e0bb rivertile: use u31s to remove most @intCast()s 2022-02-26 16:19:15 +01:00
Isaac Freund e67a9423a8 rivertile: properly validate -main-ratio flag 2022-02-21 10:26:10 +01:00
Isaac Freund 147d9c2f90 View: use last set fullscreen state in applyPending()
This avoids a race where the fullscreen set is e.g. set then unset
before the transaction has been completed and the current state has
been updated.
2022-02-05 00:08:21 +01:00
Isaac Freund be870e058d View: fix/simplify logic in applyPending()
In particular, this fixes a crash that can happen if a client is made
non-fullscreen and then, while that transaction is ongoing, made
fullscreen again.
2022-02-03 21:23:02 +01:00
Isaac Freund 79d7775a3d code: relicense to GPL-3.0-only
I don't need anyone's permission to make this change since
GPL-3.0-or-later is one-way compatible with GPL-3.0-only.
2022-01-31 19:33:22 +01:00
Isaac Freund 363efd3e79 ci: run on 0.1.x branch 2022-01-29 13:48:50 +01:00
Isaac Freund 1e3ea826c0 wlr-output-management: simplify implementation
Notably, we no longer call both wlr_output_test and wlr_output_commit
when applying an output config, which seems to fix or workaround an
occasional crash since updating to wlroots 0.15.0.
2022-01-28 23:28:00 +01:00
Isaac Freund 745fe82947 layer-shell: center when opposing anchors are set
Currently river will place the surface at the top or left edge if
opposing anchors are set without a 0 width/height. Instead, center
the surface between the anchors.
2022-01-25 00:11:20 +01:00
Isaac Freund b716e262cd XdgPopup: remove commit listener on destroy if mapped
Since the destroy() function may be called by river while the popup is
mapped, we must handle this case.
2022-01-23 20:37:37 +01:00
Isaac Freund 20ca8a2051 docs: fix typo in river(1) man page 2022-01-23 12:09:27 +01:00
Isaac Freund f6b1632af2 example/init: Use Alt/Super aliases 2022-01-17 13:15:15 +01:00
Isaac Freund f79c784e84 command/map: add Alt/Super as aliases for Mod1/Mod4
I personally made the mistake of using Alt instead of Mod1 when messing
with my config. This change makes things a bit more user
friendly/intuitive.
2022-01-17 12:38:41 +01:00
Isaac Freund c9fd8b3f37 XdgPopup: fix unconstrain from box coords
We currently don't properly handle xdg surface geometry of the parent,
which causes popups to render partially off-screen in some cases.

GTK4 clients such as easyeffects seem to trigger this issue reliably.
2022-01-12 14:50:55 +01:00
Isaac Freund a340a605a4 Cursor: remove minor outdated workaround
Since Zig 0.9 @tagName() and other similar builtins return 0 terminated
data.
2022-01-05 18:13:08 +01:00
Isaac Freund 1c515759b4 Seat: do a better job of cleaning up listeners
I thought this should be fine as river won't yield to the event loop
when Seat.deinit() is called before the wlroots seat is destroyed, but
a segfault on exit has been reported with a stack trace mentioning
wlr_seat_destroy(). Let's hope this clears that up.
2022-01-02 19:46:18 +00:00
Isaac Freund e16eabd928 Xwayland: move window to top of X11 stack on focus
This is required for X11 input handling to work properly with
overlapping windows.
2022-01-02 04:32:28 +00:00
Isaac Freund ea4bd5e54b Cursor: fix down mode motion events for subsurfaces
There are a couple of TODOs here that are not worth resolving until
after moving to the scene graph api.
2021-12-29 06:19:37 +00:00
Isaac Freund c1d985ac29 build: update to zig version 0.9.0 2021-12-24 05:28:14 +00:00
Isaac Freund 1edaa5ad21 docs: soften the README disclaimer a bit 2021-12-22 22:09:45 +00:00
Isaac Freund 6a093fecee river: remove wlroots 0.14 workarounds
Since updating to wlroots 0.15 we can remove several workarounds we had
in place due to wlroots improvements.
2021-12-22 20:15:57 +00:00
Isaac Freund 90aee02b70 Subsurface: add commit listener on create if mapped
Subsurfaces may already be mapped when create is called, in which case
we must add the commit listener.
2021-12-22 05:30:20 +00:00
Isaac Freund 334ede00e1 Cursor: properly handle clients setting the cursor image
The new code to dedup XcursorManager.setCursorImage() calls for
efficiency currently doesn't handle clients setting the cursor properly.
This commit corrects this oversight.
2021-12-22 04:32:23 +00:00
Isaac Freund 2288778dd7 ci: update for wlroots 0.15.0 2021-12-22 03:56:47 +00:00
Isaac Freund c34d850397 layer-shell: fix regression from wlroots 0.15 update
The way wlroots handles the layer surface configure flow has changed a
bit and river's logic needs updating.
2021-12-21 19:41:47 +00:00
Isaac Freund f2fc9aca18 Cursor: dedup XcursorManager.setCursorImage() calls
wlroots doesn't avoid re-setting the same cursor image so this is
relatively expensive to call repeatedly if nothing has changed.
2021-12-21 03:50:12 +00:00
Isaac Freund 4d19621f1e river: update to wlroots 0.15.0 2021-12-21 03:18:30 +00:00
Isaac Freund c3370afa3d common/flags: make argFlag() return a slice
We always pass the result of this to mem.span() currently, no need for
the code duplication.
2021-12-15 17:09:45 +01:00
Isaac Freund 93afdb32bf layer-shell: tighten up handling of large margins 2021-11-29 23:56:26 +01:00
Isaac Freund bd70c010e9 Cursor: add workaround in pointer drag termination
Currently wlroots sends use the drag destroy event before sending the
wl_data_device.leave event to the client, which makes things a bit
awkward. My patch fixing this has been merged to wlroots master so we
can remove this when upgrading to wlroots 0.15, but until then this
workaround will fix the issue.
2021-11-23 22:54:19 +01:00
Isaac Freund 9212ac89fa Cursor: fix pointer drags with focus-follows-cursor 2021-11-19 11:33:27 +01:00