inital support for hooks...

Currently the following hooks are available:
 - WinMapPre
 - WinMapPost
This commit is contained in:
Squibid 2025-11-21 23:28:40 -05:00
parent b45544c97a
commit b3322eeb90
Signed by: squibid
GPG key ID: BECE5684D3C4005D
7 changed files with 193 additions and 0 deletions

View file

@ -12,6 +12,8 @@ const Output = @import("output.zig");
const View = @import("view.zig");
const Utils = @import("utils.zig");
const Keymap = @import("keymap.zig");
const Hook = @import("types/hook.zig");
const Events = @import("types/events.zig");
const gpa = std.heap.c_allocator;
const server = &@import("main.zig").server;
@ -34,7 +36,11 @@ allocator: *wlr.Allocator,
root: Root,
seat: Seat,
cursor: Cursor,
// lua data
keymaps: std.AutoHashMap(u64, Keymap),
hooks: std.ArrayList(*Hook),
events: Events,
// Backend listeners
new_input: wl.Listener(*wlr.InputDevice) = .init(handleNewInput),
@ -90,6 +96,8 @@ pub fn init(self: *Server) void {
.seat = undefined,
.cursor = undefined,
.keymaps = .init(gpa),
.hooks = try .initCapacity(gpa, 10), // TODO: choose how many slots to start with
.events = try .init(gpa),
};
self.renderer.initServer(wl_server) catch {