tony / oxwm

Merge pull request #192 from CodyWan1990/fix/dispatch-int-arg Browse files
fix: pass int_arg to focusstack/movestack dispatch
Tony, btw. committed 2026-05-11 parents b0374a4 f2cf6ff commit 68d049a8a7cc824117ec63ae5f0c91f56ee4da90
Showing 2 changed files with 10 additions and 4 deletions. UnifiedSplit
+6 −2 src/config/lua.zig
@@ -590,14 +590,18 @@ fn luaClientToggleFloating(state: ?*c.lua_State) callconv(.c) c_int {
590 590
591 591 fn luaClientFocusStack(state: ?*c.lua_State) callconv(.c) c_int {
592 592 const s = state orelse return 0;
593 - const dir: i32 = @intCast(c.lua_tointegerx(s, 1, null));
593 + var isnum: c_int = 0;
594 + const raw = c.lua_tointegerx(s, 1, &isnum);
595 + const dir: i32 = if (isnum != 0) @intCast(raw) else 1;
594 596 createActionTableWithInt(s, "FocusStack", dir);
595 597 return 1;
596 598 }
597 599
598 600 fn luaClientMoveStack(state: ?*c.lua_State) callconv(.c) c_int {
599 601 const s = state orelse return 0;
600 - const dir: i32 = @intCast(c.lua_tointegerx(s, 1, null));
602 + var isnum: c_int = 0;
603 + const raw = c.lua_tointegerx(s, 1, &isnum);
604 + const dir: i32 = if (isnum != 0) @intCast(raw) else 1;
601 605 createActionTableWithInt(s, "MoveStack", dir);
602 606 return 1;
603 607 }
+4 −2 src/wm/actions.zig
@@ -69,6 +69,7 @@ pub fn spawnTerminal(wm: *WindowManager) void {
69 69 }
70 70
71 71 pub fn movestack(direction: i32, wm: *WindowManager) void {
72 + if (direction == 0) return;
72 73 const monitor = wm.selected_monitor orelse return;
73 74 const current = monitor.sel orelse return;
74 75
@@ -289,6 +290,7 @@ pub fn tagClient(tag_mask: u32, wm: *WindowManager) void {
289 290 }
290 291
291 292 pub fn focusstack(direction: i32, wm: *WindowManager) void {
293 + if (direction == 0) return;
292 294 const monitor = wm.selected_monitor orelse return;
293 295 const current = monitor.sel orelse return;
294 296
@@ -797,9 +799,9 @@ pub fn executeAction(action: config_mod.Action, int_arg: i32, str_arg: ?[]const
797 799 }
798 800 }
799 801 },
800 - .focus_next => focusstack(1, wm),
802 + .focus_next => focusstack(int_arg, wm),
801 803 .focus_prev => focusstack(-1, wm),
802 - .move_next => movestack(1, wm),
804 + .move_next => movestack(int_arg, wm),
803 805 .move_prev => movestack(-1, wm),
804 806 .resize_master => setmfact(@as(f32, @floatFromInt(int_arg)) / 1000.0, wm),
805 807 .inc_master => incnmaster(1, wm),