diff --git a/src/apprt/action.zig b/src/apprt/action.zig index 4bb590eee..af1c22552 100644 --- a/src/apprt/action.zig +++ b/src/apprt/action.zig @@ -129,7 +129,7 @@ pub const Action = union(Key) { /// Jump to a specific split. goto_split: GotoSplit, - /// Jump to next/previous window. + /// Jump to next/previous window. goto_window: GotoWindow, /// Resize the split in the given direction. diff --git a/src/apprt/gtk/class/application.zig b/src/apprt/gtk/class/application.zig index ed2044c4e..331fff4e9 100644 --- a/src/apprt/gtk/class/application.zig +++ b/src/apprt/gtk/class/application.zig @@ -2016,40 +2016,40 @@ const Action = struct { } } - pub fn gotoWindow( - direction: apprt.action.GotoWindow, - ) bool { - const glist = gtk.Window.listToplevels(); - defer glist.free(); - - const node = glist.findCustom(null, findActiveWindow); - - const target_node = switch (direction) { - .next => node.f_next orelse glist, - .previous => node.f_prev orelse last: { - var current = glist; - while (current.f_next) |next| { - current = next; - } - break :last current; - }, - }; - const gtk_window: *gtk.Window = @ptrCast(@alignCast(target_node.f_data orelse return false)); - gtk.Window.present(gtk_window); - - const ghostty_window: *Window = @ptrCast(@alignCast(gtk_window)); - var value = std.mem.zeroes(gobject.Value); - defer value.unset(); - _ = value.init(gobject.ext.typeFor(?*Surface)); - ghostty_window.as(gobject.Object).getProperty("active-surface", &value); - - const surface: ?*Surface = @ptrCast(@alignCast(value.getObject())); - if (surface) |s| { - s.grabFocus(); - return true; - } - - log.warn("window has no active surface, cannot grab focus", .{}); + pub fn gotoWindow( + direction: apprt.action.GotoWindow, + ) bool { + const glist = gtk.Window.listToplevels(); + defer glist.free(); + + const node = glist.findCustom(null, findActiveWindow); + + const target_node = switch (direction) { + .next => node.f_next orelse glist, + .previous => node.f_prev orelse last: { + var current = glist; + while (current.f_next) |next| { + current = next; + } + break :last current; + }, + }; + const gtk_window: *gtk.Window = @ptrCast(@alignCast(target_node.f_data orelse return false)); + gtk.Window.present(gtk_window); + + const ghostty_window: *Window = @ptrCast(@alignCast(gtk_window)); + var value = std.mem.zeroes(gobject.Value); + defer value.unset(); + _ = value.init(gobject.ext.typeFor(?*Surface)); + ghostty_window.as(gobject.Object).getProperty("active-surface", &value); + + const surface: ?*Surface = @ptrCast(@alignCast(value.getObject())); + if (surface) |s| { + s.grabFocus(); + return true; + } + + log.warn("window has no active surface, cannot grab focus", .{}); return false; } diff --git a/src/input/Binding.zig b/src/input/Binding.zig index 0a927b85f..a3284c718 100644 --- a/src/input/Binding.zig +++ b/src/input/Binding.zig @@ -545,7 +545,6 @@ pub const Action = union(enum) { /// (`previous` and `next`). goto_split: SplitFocusDirection, - /// Focus on either the previous window or the next one ('previous', 'next') goto_window: WindowDirection, @@ -936,7 +935,7 @@ pub const Action = union(enum) { }; pub const WindowDirection = enum { - previous, + previous, next, }; diff --git a/src/input/command.zig b/src/input/command.zig index 037b5317c..deb6e8412 100644 --- a/src/input/command.zig +++ b/src/input/command.zig @@ -492,7 +492,6 @@ fn actionCommands(action: Action.Key) []const Command { }, }, - .toggle_split_zoom => comptime &.{.{ .action = .toggle_split_zoom, .title = "Toggle Split Zoom",