Type-safe rework

pull/9899/head
Max Bretschneider 2025-10-24 19:22:44 +02:00 committed by Mitchell Hashimoto
parent 6b8a7e1dd1
commit 6230d134e1
1 changed files with 8 additions and 8 deletions

View File

@ -2034,18 +2034,18 @@ const Action = struct {
break :last current; break :last current;
}, },
}; };
const gtk_window: *gtk.Window = @ptrCast(@alignCast(target_node.f_data orelse return false)); const data = target_node.f_data orelse return false;
const gtk_window: *gtk.Window = @ptrCast(@alignCast(data));
gtk.Window.present(gtk_window); gtk.Window.present(gtk_window);
const ghostty_window: *Window = @ptrCast(@alignCast(gtk_window)); const ghostty_window = gobject.ext.cast(Window, gtk_window) orelse return false;
var value = std.mem.zeroes(gobject.Value);
defer value.unset(); var surface: ?*gobject.Object = null;
_ = value.init(gobject.ext.typeFor(?*Surface)); ghostty_window.as(gobject.Object).get("active-surface", &surface, @as(?*anyopaque, null));
ghostty_window.as(gobject.Object).getProperty("active-surface", &value);
const surface: ?*Surface = @ptrCast(@alignCast(value.getObject()));
if (surface) |s| { if (surface) |s| {
s.grabFocus(); const surface_obj = gobject.ext.cast(Surface, s) orelse return false;
surface_obj.grabFocus();
return true; return true;
} }