From f660ec8bd2d08f3b0c1bbde0167241cd1cb5dd10 Mon Sep 17 00:00:00 2001 From: Ofir Levitan Date: Wed, 5 Feb 2025 16:04:53 +0200 Subject: [PATCH 1/6] GTK: disable color management --- src/apprt/gtk/App.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index df74cefb2..251cbdceb 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -146,6 +146,9 @@ pub fn init(core_app: *CoreApp, opts: Options) !App { var gdk_disable: struct { @"gles-api": bool = false, + /// current gtk implementation for color management is not good enough. + /// see: https://bugs.kde.org/show_bug.cgi?id=495647 + @"color-mgmt": bool = true, /// Disabling Vulkan can improve startup times by hundreds of /// milliseconds on some systems. We don't use Vulkan so we can just /// disable it. From d87bfdff1ab1e6b39e8cac8caa613d15456cb4c4 Mon Sep 17 00:00:00 2001 From: eifr Date: Wed, 5 Feb 2025 22:48:28 +0200 Subject: [PATCH 2/6] move color-mgmt to config --- src/apprt/gtk/App.zig | 8 ++++---- src/config/Config.zig | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index 251cbdceb..c9096ee01 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -146,14 +146,14 @@ pub fn init(core_app: *CoreApp, opts: Options) !App { var gdk_disable: struct { @"gles-api": bool = false, - /// current gtk implementation for color management is not good enough. - /// see: https://bugs.kde.org/show_bug.cgi?id=495647 - @"color-mgmt": bool = true, + @"color-mgmt": bool, /// Disabling Vulkan can improve startup times by hundreds of /// milliseconds on some systems. We don't use Vulkan so we can just /// disable it. vulkan: bool = false, - } = .{}; + } = .{ + .@"color-mgmt" = config.@"disable-gtk-color-mgmt", + }; environment: { if (version.runtimeAtLeast(4, 16, 0)) { diff --git a/src/config/Config.zig b/src/config/Config.zig index 3010b87d1..52a1f2885 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1350,6 +1350,10 @@ keybind: Keybinds = .{}, /// Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. @"window-titlebar-foreground": ?Color = null, +/// current gtk implementation for color management is not good enough. +/// see: https://bugs.kde.org/show_bug.cgi?id=495647 +@"disable-gtk-color-mgmt": bool = false, + /// This controls when resize overlays are shown. Resize overlays are a /// transient popup that shows the size of the terminal while the surfaces are /// being resized. The possible options are: From 1ce23c079ec5d78f6b98e5a8e5aa5b115c4fc18f Mon Sep 17 00:00:00 2001 From: eifr Date: Wed, 5 Feb 2025 23:35:12 +0200 Subject: [PATCH 3/6] expand comment + rename --- src/apprt/gtk/App.zig | 4 +++- src/config/Config.zig | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index c9096ee01..4781b0ac3 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -146,13 +146,15 @@ pub fn init(core_app: *CoreApp, opts: Options) !App { var gdk_disable: struct { @"gles-api": bool = false, + /// current gtk implementation for color management is not good enough. + /// see: https://bugs.kde.org/show_bug.cgi?id=495647 @"color-mgmt": bool, /// Disabling Vulkan can improve startup times by hundreds of /// milliseconds on some systems. We don't use Vulkan so we can just /// disable it. vulkan: bool = false, } = .{ - .@"color-mgmt" = config.@"disable-gtk-color-mgmt", + .@"color-mgmt" = config.@"gtk-gdk-disable-color-mgmt", }; environment: { diff --git a/src/config/Config.zig b/src/config/Config.zig index 52a1f2885..6d09fc9ce 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1350,9 +1350,18 @@ keybind: Keybinds = .{}, /// Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. @"window-titlebar-foreground": ?Color = null, -/// current gtk implementation for color management is not good enough. -/// see: https://bugs.kde.org/show_bug.cgi?id=495647 -@"disable-gtk-color-mgmt": bool = false, +/// Controls whether to disable GDK color management in GTK applications. +/// +/// By default this is set to `false`, meaning color management is enabled. +/// You may want to enable this setting (set to `true`) if you experience: +/// - Incorrect or washed out colors in your terminal +/// - Color inconsistencies between GTK applications +/// - Performance issues related to color management +/// +/// This is a workaround for known issues with GTK's color management implementation, +/// particularly affecting applications running under Wayland. +/// See: https://bugs.kde.org/show_bug.cgi?id=495647 +@"gtk-gdk-disable-color-mgmt": bool = false, /// This controls when resize overlays are shown. Resize overlays are a /// transient popup that shows the size of the terminal while the surfaces are From cbe04785724f14626ef9cfd2dadf94eb059385b9 Mon Sep 17 00:00:00 2001 From: eifr Date: Thu, 6 Feb 2025 10:19:23 +0200 Subject: [PATCH 4/6] remove config --- src/apprt/gtk/App.zig | 10 ++++++---- src/config/Config.zig | 13 ------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index 4781b0ac3..e8bb98914 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -148,16 +148,18 @@ pub fn init(core_app: *CoreApp, opts: Options) !App { @"gles-api": bool = false, /// current gtk implementation for color management is not good enough. /// see: https://bugs.kde.org/show_bug.cgi?id=495647 - @"color-mgmt": bool, + @"color-mgmt": bool = true, /// Disabling Vulkan can improve startup times by hundreds of /// milliseconds on some systems. We don't use Vulkan so we can just /// disable it. vulkan: bool = false, - } = .{ - .@"color-mgmt" = config.@"gtk-gdk-disable-color-mgmt", - }; + } = .{}; environment: { + if (version.runtimeAtLeast(4, 17, 0)) { + gdk_disable.@"color-mgmt" = false; + } + if (version.runtimeAtLeast(4, 16, 0)) { // From gtk 4.16, GDK_DEBUG is split into GDK_DEBUG and GDK_DISABLE. // For the remainder of "why" see the 4.14 comment below. diff --git a/src/config/Config.zig b/src/config/Config.zig index 6d09fc9ce..3010b87d1 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1350,19 +1350,6 @@ keybind: Keybinds = .{}, /// Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. @"window-titlebar-foreground": ?Color = null, -/// Controls whether to disable GDK color management in GTK applications. -/// -/// By default this is set to `false`, meaning color management is enabled. -/// You may want to enable this setting (set to `true`) if you experience: -/// - Incorrect or washed out colors in your terminal -/// - Color inconsistencies between GTK applications -/// - Performance issues related to color management -/// -/// This is a workaround for known issues with GTK's color management implementation, -/// particularly affecting applications running under Wayland. -/// See: https://bugs.kde.org/show_bug.cgi?id=495647 -@"gtk-gdk-disable-color-mgmt": bool = false, - /// This controls when resize overlays are shown. Resize overlays are a /// transient popup that shows the size of the terminal while the surfaces are /// being resized. The possible options are: From 76cf58915be20ba002fd49dc1db75bf254753843 Mon Sep 17 00:00:00 2001 From: eifr Date: Thu, 6 Feb 2025 10:25:26 +0200 Subject: [PATCH 5/6] add comments --- src/apprt/gtk/App.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index e8bb98914..a3290f783 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -148,6 +148,7 @@ pub fn init(core_app: *CoreApp, opts: Options) !App { @"gles-api": bool = false, /// current gtk implementation for color management is not good enough. /// see: https://bugs.kde.org/show_bug.cgi?id=495647 + /// gtk issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6864 @"color-mgmt": bool = true, /// Disabling Vulkan can improve startup times by hundreds of /// milliseconds on some systems. We don't use Vulkan so we can just From 5d6c021e267183190815b7871c72739d96af3aab Mon Sep 17 00:00:00 2001 From: eifr Date: Fri, 7 Feb 2025 18:00:08 +0200 Subject: [PATCH 6/6] update gtk version --- src/apprt/gtk/App.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index a3290f783..ed27f8394 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -157,7 +157,7 @@ pub fn init(core_app: *CoreApp, opts: Options) !App { } = .{}; environment: { - if (version.runtimeAtLeast(4, 17, 0)) { + if (version.runtimeAtLeast(4, 18, 0)) { gdk_disable.@"color-mgmt" = false; }