Fix removed GDK_DEBUG gl-no-fractional (#7233)

`gl-no-fractional` is removed from GTK v4.17.5
This commit is contained in:
Mitchell Hashimoto
2025-05-06 07:17:28 -07:00
committed by GitHub
2 changed files with 20 additions and 3 deletions

View File

@@ -159,6 +159,7 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
opengl: bool = false, opengl: bool = false,
/// disable GLES, Ghostty can't use GLES /// disable GLES, Ghostty can't use GLES
@"gl-disable-gles": bool = false, @"gl-disable-gles": bool = false,
// GTK's new renderer can cause blurry font when using fractional scaling.
@"gl-no-fractional": bool = false, @"gl-no-fractional": bool = false,
/// Disabling Vulkan can improve startup times by hundreds of /// Disabling Vulkan can improve startup times by hundreds of
/// milliseconds on some systems. We don't use Vulkan so we can just /// milliseconds on some systems. We don't use Vulkan so we can just
@@ -190,7 +191,6 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
// For the remainder of "why" see the 4.14 comment below. // For the remainder of "why" see the 4.14 comment below.
gdk_disable.@"gles-api" = true; gdk_disable.@"gles-api" = true;
gdk_disable.vulkan = true; gdk_disable.vulkan = true;
gdk_debug.@"gl-no-fractional" = true;
break :environment; break :environment;
} }
if (gtk_version.runtimeAtLeast(4, 14, 0)) { if (gtk_version.runtimeAtLeast(4, 14, 0)) {
@@ -201,8 +201,12 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
// //
// Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589 // Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589
gdk_debug.@"gl-disable-gles" = true; gdk_debug.@"gl-disable-gles" = true;
gdk_debug.@"gl-no-fractional" = true;
gdk_debug.@"vulkan-disable" = true; gdk_debug.@"vulkan-disable" = true;
if (gtk_version.runtimeUntil(4, 17, 5)) {
// Removed at GTK v4.17.5
gdk_debug.@"gl-no-fractional" = true;
}
break :environment; break :environment;
} }
// Versions prior to 4.14 are a bit of an unknown for Ghostty. It // 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; }) != .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" { test "atLeast" {
const testing = std.testing; const testing = std.testing;
const funs = &.{ atLeast, runtimeAtLeast }; const funs = &.{ atLeast, runtimeAtLeast, runtimeUntil };
inline for (funs) |fun| { inline for (funs) |fun| {
try testing.expect(fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION, c.GTK_MICRO_VERSION)); try testing.expect(fun(c.GTK_MAJOR_VERSION, c.GTK_MINOR_VERSION, c.GTK_MICRO_VERSION));