mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 04:57:32 -04:00
viewById works again, layer still ontop of other things
This commit is contained in:
parent
3ccf47e0be
commit
9186aeecd3
23 changed files with 282 additions and 181 deletions
|
|
@ -1,41 +0,0 @@
|
|||
//! This is a simple way to define a keymap. To keep hashing consistent the
|
||||
//! hash is generated here.
|
||||
const Keymap = @This();
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const xkb = @import("xkbcommon");
|
||||
const wlr = @import("wlroots");
|
||||
const zlua = @import("zlua");
|
||||
|
||||
const Lua = &@import("../main.zig").lua;
|
||||
|
||||
modifier: wlr.Keyboard.ModifierMask,
|
||||
keycode: xkb.Keysym,
|
||||
options: struct {
|
||||
repeat: bool,
|
||||
/// This is the location of the on press lua function in the lua registry
|
||||
lua_press_ref_idx: i32,
|
||||
/// This is the location of the on release lua function in the lua registry
|
||||
lua_release_ref_idx: i32,
|
||||
},
|
||||
|
||||
pub fn callback(self: *const Keymap, release: bool) void {
|
||||
const lua_ref_idx = if (release) self.options.lua_release_ref_idx else self.options.lua_press_ref_idx;
|
||||
|
||||
const t = Lua.state.rawGetIndex(zlua.registry_index, lua_ref_idx);
|
||||
if (t != zlua.LuaType.function) {
|
||||
std.log.err("Failed to call keybind, it doesn't have a callback.", .{});
|
||||
Lua.state.pop(1);
|
||||
return;
|
||||
}
|
||||
|
||||
Lua.state.call(.{ .args = 0, .results = 0 });
|
||||
Lua.state.pop(-1);
|
||||
}
|
||||
|
||||
pub fn hash(modifier: wlr.Keyboard.ModifierMask, keycode: xkb.Keysym) u64 {
|
||||
const mod_val: u32 = @bitCast(modifier);
|
||||
const key_val: u32 = @intFromEnum(keycode);
|
||||
return (@as(u64, mod_val) << 32) | @as(u64, key_val);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue