From a8ce01a2d8785b40cd7c729813d2cedf48a01de3 Mon Sep 17 00:00:00 2001 From: Jeremia Dominguez Date: Fri, 22 Aug 2025 20:23:05 -0500 Subject: [PATCH] Just adding/removing something things I forgot. --- .gitignore | 2 ++ src/Client.zig | 11 ++++------- src/main.zig | 17 ----------------- 3 files changed, 6 insertions(+), 24 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dca1103 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +zig-out/ +.zig-cache/ diff --git a/src/Client.zig b/src/Client.zig index a762ee4..5ffa077 100644 --- a/src/Client.zig +++ b/src/Client.zig @@ -12,10 +12,6 @@ const z2d = @import("z2d"); const Client = @This(); -// TODO: Decorations. -// First server-side decorations. -// Then, once I have my layout code working, client-side decorations as fallback. - alloc: std.mem.Allocator, display: *wl.Display, shm: ?*wl.Shm = null, @@ -167,10 +163,11 @@ pub const Window = struct { window.buffer_data = data; } + // Called when the window needs to be resized. + // Creates a wl_shm_pool if the one the Window currently has is not big enough. + // The pool is allocated enough memory for two frames, given the size. + // Two wl_buffer are created with half the memory each. fn onSize(window: *Window, width: u32, height: u32) !void { - const client = window.client; - _ = client; // autofix - const size = width * height * @sizeOf(z2d.pixel.RGB) * 2; std.log.debug("(wayland) onSize: {d}x{d} ({d})", .{ width, height, size }); if (size == 0) return; diff --git a/src/main.zig b/src/main.zig index 4bc1363..5156d39 100644 --- a/src/main.zig +++ b/src/main.zig @@ -68,8 +68,6 @@ const Color = struct { } }; -const red: z2d.Pattern = .{ .opaque_pattern = .{ .pixel = .{ .rgb = .fromClamped(0, 0, 1) } } }; - fn rect(alloc: std.mem.Allocator, surface: *z2d.Surface, x: f64, y: f64, width: f64, height: f64, color: Color) !void { var path: z2d.StaticPath(6) = .{}; path.init(); @@ -80,18 +78,3 @@ fn rect(alloc: std.mem.Allocator, surface: *z2d.Surface, x: f64, y: f64, width: path.close(); try z2d.painter.fill(alloc, surface, &color.toPattern(), &path.nodes, .{}); } - -// const rect = blk: { -// var path: z2d.StaticPath(6) = .{}; -// path.init(); - -// path.moveTo(0, 0); -// path.relLineTo(100, 0); -// path.relLineTo(0, 100); -// path.relLineTo(-100, 0); -// path.close(); - -// const outpath = path.nodes; - -// break :blk outpath; -// }; -- 2.54.0