mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
Use helper function to set correct env variables
GTK4 version 4.16 split the environment variable `GDK_DEBUG` into `GDK_DEBUG` and `GDK_DISABLE`. This is being done by using the helper function `atLeast` to handle certain versions accordingly. `GSK_RENDERER` also only needs to be set in later GTK versions (>=1.14.0).
This commit is contained in:
@ -28,6 +28,7 @@ const Window = @import("Window.zig");
|
|||||||
const ConfigErrorsWindow = @import("ConfigErrorsWindow.zig");
|
const ConfigErrorsWindow = @import("ConfigErrorsWindow.zig");
|
||||||
const ClipboardConfirmationWindow = @import("ClipboardConfirmationWindow.zig");
|
const ClipboardConfirmationWindow = @import("ClipboardConfirmationWindow.zig");
|
||||||
const c = @import("c.zig").c;
|
const c = @import("c.zig").c;
|
||||||
|
const version = @import("version.zig");
|
||||||
const inspector = @import("inspector.zig");
|
const inspector = @import("inspector.zig");
|
||||||
const key = @import("key.zig");
|
const key = @import("key.zig");
|
||||||
const x11 = @import("x11.zig");
|
const x11 = @import("x11.zig");
|
||||||
@ -85,17 +86,24 @@ quit_timer: union(enum) {
|
|||||||
pub fn init(core_app: *CoreApp, opts: Options) !App {
|
pub fn init(core_app: *CoreApp, opts: Options) !App {
|
||||||
_ = opts;
|
_ = opts;
|
||||||
|
|
||||||
// We need to export GDK_DEBUG to run on Wayland after GTK 4.14.
|
if (version.atLeast(4, 16, 0)) {
|
||||||
// Older versions of GTK do not support these values so it is safe
|
// From gtk 4.16, GDK_DEBUG is split into GDK_DEBUG and GDK_DISABLE
|
||||||
// to always set this. Forwards versions are uncertain so we'll have to
|
_ = internal_os.setenv("GDK_DISABLE", "gles-api");
|
||||||
// reassess...
|
_ = internal_os.setenv("GDK_DEBUG", "opengl");
|
||||||
//
|
} else if (version.atLeast(4, 14, 0)) {
|
||||||
// Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589
|
// We need to export GDK_DEBUG to run on Wayland after GTK 4.14.
|
||||||
_ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles");
|
// Older versions of GTK do not support these values so it is safe
|
||||||
// From gtk 4.16, GDK_DEBUG is split into GDK_DEBUG and GDK_DISABLE
|
// to always set this. Forwards versions are uncertain so we'll have to
|
||||||
_ = internal_os.setenv("GDK_DISABLE", "gles-api");
|
// reassess...
|
||||||
// We need to export GSK_RENDERER to opengl because GTK uses ngl by default after 4.14
|
//
|
||||||
_ = internal_os.setenv("GSK_RENDERER", "opengl");
|
// Upstream issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/6589
|
||||||
|
_ = internal_os.setenv("GDK_DEBUG", "opengl,gl-disable-gles");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version.atLeast(4, 14, 0)) {
|
||||||
|
// We need to export GSK_RENDERER to opengl because GTK uses ngl by default after 4.14
|
||||||
|
_ = internal_os.setenv("GSK_RENDERER", "opengl");
|
||||||
|
}
|
||||||
|
|
||||||
// Load our configuration
|
// Load our configuration
|
||||||
var config = try Config.load(core_app.alloc);
|
var config = try Config.load(core_app.alloc);
|
||||||
|
Reference in New Issue
Block a user