Formatting

pull/9899/head
Max Bretschneider 2025-10-23 23:33:27 +02:00 committed by Mitchell Hashimoto
parent 3000136e61
commit 55ae4430b9
4 changed files with 36 additions and 38 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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,
};

View File

@ -492,7 +492,6 @@ fn actionCommands(action: Action.Key) []const Command {
},
},
.toggle_split_zoom => comptime &.{.{
.action = .toggle_split_zoom,
.title = "Toggle Split Zoom",