Apply Rect to Output

This commit is contained in:
Ben Buhse 2026-02-16 17:27:31 -06:00
commit 515e94320b
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
3 changed files with 51 additions and 58 deletions

View file

@ -189,10 +189,10 @@ pub fn manage(window: *Window) void {
if (window.floating_rect.width == 0) {
// Never floated before; use 75% of usable area, centered on output
if (window.output) |output| {
window.floating_rect.width = @divFloor(output.usable_width * 3, 4);
window.floating_rect.height = @divFloor(output.usable_height * 3, 4);
window.floating_rect.x = output.usable_x + @divFloor(output.usable_width, 2) - @divFloor(window.floating_rect.width, 2);
window.floating_rect.y = output.usable_y + @divFloor(output.usable_height, 2) - @divFloor(window.floating_rect.height, 2);
window.floating_rect.width = @divFloor(output.usable_geometry.width * 3, 4);
window.floating_rect.height = @divFloor(output.usable_geometry.height * 3, 4);
window.floating_rect.x = output.usable_geometry.x + @divFloor(output.usable_geometry.width, 2) - @divFloor(window.floating_rect.width, 2);
window.floating_rect.y = output.usable_geometry.y + @divFloor(output.usable_geometry.height, 2) - @divFloor(window.floating_rect.height, 2);
} else {
window.floating_rect.width = window.rect.width;
window.floating_rect.height = window.rect.height;