From b33190131f2d97b98d2daf2d92aebc5e39f135ec Mon Sep 17 00:00:00 2001 From: Severus Date: Wed, 8 May 2024 23:50:08 +0700 Subject: [PATCH 1/3] Add GDK_DEBUG as default environment variable for linux Since gtk 4.14, we need to define driver to run OpenGL as (gtk's issue)[https://gitlab.gnome.org/GNOME/gtk/-/issues/6589] --- src/main_ghostty.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main_ghostty.zig b/src/main_ghostty.zig index ff38b800d..06606eb90 100644 --- a/src/main_ghostty.zig +++ b/src/main_ghostty.zig @@ -239,6 +239,8 @@ pub const GlobalState = struct { self.logging = .{ .disabled = {} }; } + // We need to export GDK_DEBUG to run on wayland after gtk 4.14 + if (builtin.target.os.tag == .linux) _ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles"); // I don't love the env var name but I don't have it in my heart // to parse CLI args 3 times (once for actions, once for config, // maybe once for logging) so for now this is an easy way to do From 245aaa34bf0dfbe0453b5614c7916c43780cce4e Mon Sep 17 00:00:00 2001 From: Severus Date: Thu, 9 May 2024 00:00:14 +0700 Subject: [PATCH 2/3] Add upstream's issue --- src/main_ghostty.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main_ghostty.zig b/src/main_ghostty.zig index 06606eb90..515b3e1fb 100644 --- a/src/main_ghostty.zig +++ b/src/main_ghostty.zig @@ -240,7 +240,9 @@ pub const GlobalState = struct { } // We need to export GDK_DEBUG to run on wayland after gtk 4.14 + // Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589 if (builtin.target.os.tag == .linux) _ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles"); + // I don't love the env var name but I don't have it in my heart // to parse CLI args 3 times (once for actions, once for config, // maybe once for logging) so for now this is an easy way to do From e81f525101ab7f83d917ca9d8dd0946ec7ca5de5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 8 May 2024 21:04:50 -0700 Subject: [PATCH 3/3] apprt/gtk: set GDK_DEBUG --- src/apprt/gtk/App.zig | 8 ++++++++ src/main_ghostty.zig | 4 ---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index 6da314c56..7e7c50900 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -64,6 +64,14 @@ x11_xkb: ?x11.Xkb = null, pub fn init(core_app: *CoreApp, opts: Options) !App { _ = opts; + // We need to export GDK_DEBUG to run on Wayland after GTK 4.14. + // Older versions of GTK do not support these values so it is safe + // to always set this. Forwards versions are uncertain so we'll have to + // reassess... + // + // Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589 + _ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles"); + // Load our configuration var config = try Config.load(core_app.alloc); errdefer config.deinit(); diff --git a/src/main_ghostty.zig b/src/main_ghostty.zig index 515b3e1fb..ff38b800d 100644 --- a/src/main_ghostty.zig +++ b/src/main_ghostty.zig @@ -239,10 +239,6 @@ pub const GlobalState = struct { self.logging = .{ .disabled = {} }; } - // We need to export GDK_DEBUG to run on wayland after gtk 4.14 - // Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589 - if (builtin.target.os.tag == .linux) _ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles"); - // I don't love the env var name but I don't have it in my heart // to parse CLI args 3 times (once for actions, once for config, // maybe once for logging) so for now this is an easy way to do