apprt/gtk-ng: template callbacks can't return bool, must be c_int (#8186)

This fixes the tab bar showing the window controls sometimes.
This commit is contained in:
Mitchell Hashimoto
2025-08-08 13:39:46 -07:00
committed by GitHub
2 changed files with 8 additions and 3 deletions

View File

@@ -222,6 +222,11 @@ pub fn Common(
if (func_ti != .@"fn") {
@compileError("bound function must be a function pointer");
}
if (func_ti.@"fn".return_type == bool) {
// glib booleans are ints and returning a Zig bool type
// I think uses a byte and causes ABI issues.
@compileError("bound function must return c_int instead of bool");
}
}
gtk.Widget.Class.bindTemplateCallbackFull(

View File

@@ -1054,11 +1054,11 @@ pub const Window = extern struct {
fn closureTitlebarStyleIsTab(
_: *Self,
value: TitlebarStyle,
) callconv(.c) bool {
return switch (value) {
) callconv(.c) c_int {
return @intFromBool(switch (value) {
.native => false,
.tabs => true,
};
});
}
//---------------------------------------------------------------