Add layer shell support and fix floating windows

Now, I actually save the river-layer-shell-v1 and keep track of the
non-exclusive area. The layout calculation uses the usable area instead
of the entire output's geometry.

I removed boundary clamping for the floating windows because it was a
bit janky when hitting the edges. I'll probably add it back at some
point. I also made windows default to 75% of the usable area instead of
keeping their tiled size so that maximized windows look decent when
floating for the first time. Finally, since I removed the clamping, I
added a center_float keybind to center a floating window. If you're
cycling through focused windows and one isn't on the screen, you can use
the center_float bind to get the window visible again.

Replaced all divTrunc with divFloor to be consistent. I think they
should all be positive, anyways, so they'd be the same, but I like just
having one.
This commit is contained in:
Ben Buhse 2026-02-14 11:29:00 -06:00
commit 5c427234d7
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
9 changed files with 108 additions and 71 deletions

View file

@ -145,7 +145,7 @@ fn run(wl_display: *wl.Display, context: *Context) !void {
log.err("Got a negative time ({d})", .{time});
return error.InvalidTime;
}
const timeout: i32 = @intCast((@divTrunc(time, 60) * 60 + 60 - time) * 1000);
const timeout: i32 = @intCast((@divFloor(time, 60) * 60 + 60 - time) * 1000);
const poll_rc = posix.poll(&pollfds, timeout) catch |err| {
fatal("Failed to poll {s}", .{@errorName(err)});