Handle {exit_}fullscreen_requested events on Windows

This commit is contained in:
Ben Buhse 2026-02-19 13:56:37 -06:00
commit 7045b21534
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
4 changed files with 23 additions and 3 deletions

View file

@ -54,7 +54,7 @@ pub const Options = struct {
river_input_manager_v1: *river.InputManagerV1,
river_libinput_config_v1: *river.LibinputConfigV1,
river_layer_shell_v1: *river.LayerShellV1, // TODO
river_layer_shell_v1: *river.LayerShellV1,
river_window_manager_v1: *river.WindowManagerV1,
river_xkb_bindings_v1: *river.XkbBindingsV1,

View file

@ -626,9 +626,10 @@ fn calculateLayout(output: *Output) void {
// window rules are reflected in the first frame's layout.
window.initialize();
if (output.tags & window.tags != 0x0000) {
// Floating windows should be shown but not included in this layout generation
// Fullscreen and floating windows should be shown but not included in layout generation
const will_be_fullscreen = window.pending_manage.fullscreen orelse window.fullscreen;
const will_float = window.pending_manage.floating orelse window.floating;
if (!will_float) {
if (!will_be_fullscreen and !will_float) {
active_count += 1;
active_list.append(&window.active_list_node);
}

View file

@ -193,6 +193,7 @@ fn windowListener(river_window_v1: *river.WindowV1, event: river.WindowV1.Event,
null;
},
.parent => |ev| {
// Nothing to do if ev.parent is null
const parent = ev.parent orelse return;
window.parent = parent;
@ -204,6 +205,23 @@ fn windowListener(river_window_v1: *river.WindowV1, event: river.WindowV1.Event,
.y = parent_window.rect.y + @divTrunc(parent_window.rect.height, 2),
};
},
.fullscreen_requested => |ev| {
window.pending_manage.fullscreen = true;
// This event allows the window to provide an output preference,
// so we should move the window if it wants
if (ev.output) |river_output_v1| {
if (river_output_v1.getUserData()) |user_data| {
const output: *Output = @ptrCast(@alignCast(user_data));
// We have to remove window from current output's windows list first
window.link.remove();
output.windows.append(window);
window.pending_manage.pending_output = .{ .output = output };
}
}
},
.exit_fullscreen_requested => window.pending_manage.fullscreen = false,
else => |ev| {
log.debug("unhandled event: {s}", .{@tagName(ev)});
},