mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
make sure all callbacks send their errors to the remote lua clients
This commit is contained in:
parent
7a619ab770
commit
12aa7b6448
2 changed files with 4 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ pub fn callback(self: *const Hook, args: anytype) void {
|
||||||
|
|
||||||
const t = Lua.state.rawGetIndex(zlua.registry_index, self.options.lua_cb_ref_idx);
|
const t = Lua.state.rawGetIndex(zlua.registry_index, self.options.lua_cb_ref_idx);
|
||||||
if (t != zlua.LuaType.function) {
|
if (t != zlua.LuaType.function) {
|
||||||
std.log.err("Failed to call hook, it doesn't have a callback.", .{});
|
RemoteLua.sendNewLogEntry("Failed to call hook, it doesn't have a callback.");
|
||||||
Lua.state.pop(1);
|
Lua.state.pop(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ const xkb = @import("xkbcommon");
|
||||||
const wlr = @import("wlroots");
|
const wlr = @import("wlroots");
|
||||||
const zlua = @import("zlua");
|
const zlua = @import("zlua");
|
||||||
|
|
||||||
|
const RemoteLua = @import("../RemoteLua.zig");
|
||||||
const Lua = &@import("../main.zig").lua;
|
const Lua = &@import("../main.zig").lua;
|
||||||
|
|
||||||
modifier: wlr.Keyboard.ModifierMask,
|
modifier: wlr.Keyboard.ModifierMask,
|
||||||
|
|
@ -25,13 +26,13 @@ pub fn callback(self: *const Keymap, release: bool) void {
|
||||||
|
|
||||||
const t = Lua.state.rawGetIndex(zlua.registry_index, lua_ref_idx);
|
const t = Lua.state.rawGetIndex(zlua.registry_index, lua_ref_idx);
|
||||||
if (t != zlua.LuaType.function) {
|
if (t != zlua.LuaType.function) {
|
||||||
std.log.err("Failed to call keybind, it doesn't have a callback.", .{});
|
RemoteLua.sendNewLogEntry("Failed to call keybind, it doesn't have a callback.");
|
||||||
Lua.state.pop(1);
|
Lua.state.pop(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Lua.state.protectedCall(.{ .args = 0, .results = 0 }) catch {
|
Lua.state.protectedCall(.{ .args = 0, .results = 0 }) catch {
|
||||||
// TODO: add a callback to remote lua when that gets merged
|
RemoteLua.sendNewLogEntry(Lua.state.toString(-1) catch unreachable);
|
||||||
};
|
};
|
||||||
Lua.state.pop(-1);
|
Lua.state.pop(-1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue