109a4daa
Wire SurfaceState into Window
a73x 2026-04-16 10:47
Replaces the bare Window.configured flag with a SurfaceState embedded on the Window. Visibility queries now go through state.visible(), which is a no-op change today but will gate rendering once FrameLoop lands.
diff --git a/src/wayland.zig b/src/wayland.zig index c136a8c..951a92b 100644 --- a/src/wayland.zig +++ b/src/wayland.zig @@ -21,6 +21,7 @@ pub const Output = struct { pub const SurfaceState = struct { configured: bool = false, suspended: bool = false, /// Must outlive this SurfaceState. tracker: *ScaleTracker, pub fn visible(self: *const SurfaceState) bool { @@ -563,7 +564,7 @@ pub const Window = struct { outputs: *std.ArrayListUnmanaged(*Output), scale_generation: u64 = 0, applied_buffer_scale: i32 = 1, configured: bool = false, state: SurfaceState, should_close: bool = false, width: u32 = 800, height: u32 = 600, @@ -681,6 +682,7 @@ pub const Connection = struct { .xdg_toplevel = undefined, .tracker = &self.scale_tracker, .outputs = &self.outputs, .state = .{ .tracker = &self.scale_tracker }, }; errdefer window.surface.destroy(); @@ -1054,7 +1056,7 @@ fn xdgSurfaceListener(surface: *xdg.Surface, event: xdg.Surface.Event, window: * switch (event) { .configure => |cfg| { surface.ackConfigure(cfg.serial); window.configured = true; window.state.configured = true; }, } }