Add runtimeUntil, fix remove GDK_DEBUG gl-no-fractional

This commit is contained in:
Morgan
2025-04-30 15:47:00 +09:00
parent b3edc88010
commit 5291292047
2 changed files with 18 additions and 3 deletions

View File

@@ -190,7 +190,6 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
// For the remainder of "why" see the 4.14 comment below.
gdk_disable.@"gles-api" = true;
gdk_disable.vulkan = true;
gdk_debug.@"gl-no-fractional" = true;
break :environment;
}
if (gtk_version.runtimeAtLeast(4, 14, 0)) {
@@ -201,8 +200,11 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
//
// Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589
gdk_debug.@"gl-disable-gles" = true;
gdk_debug.@"gl-no-fractional" = true;
gdk_debug.@"vulkan-disable" = true;
if (gtk_version.runtimeUntil(4, 17, 5)) {
gdk_debug.@"gl-no-fractional" = true;
}
break :environment;
}
// Versions prior to 4.14 are a bit of an unknown for Ghostty. It

View File

@@ -87,10 +87,23 @@ pub inline fn runtimeAtLeast(
}) != .lt;
}
pub inline fn runtimeUntil(
comptime major: u16,
comptime minor: u16,
comptime micro: u16,
) bool {
const runtime_version = getRuntimeVersion();
return runtime_version.order(.{
.major = major,
.minor = minor,
.patch = micro,
}) == .lt;
}
test "atLeast" {
const testing = std.testing;
const funs = &.{ atLeast, runtimeAtLeast };
const funs = &.{ atLeast, runtimeAtLeast, runtimeUntil };
inline for (funs) |fun| {
try testing.expect(fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION, c.GTK_MICRO_VERSION));