mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00
gtk: add config option to control GSK_RENDERER env var
This commit is contained in:
@ -209,9 +209,16 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
||||
}
|
||||
|
||||
if (version.runtimeAtLeast(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");
|
||||
switch (config.@"gtk-gsk-renderer") {
|
||||
.default => {},
|
||||
else => |renderer| {
|
||||
// Force the GSK renderer to a specific value. After GTK 4.14 the
|
||||
// `ngl` renderer is used by default which causes artifacts when
|
||||
// used with Ghostty so it should be avoided.
|
||||
log.warn("setting GSK_RENDERER={s}", .{@tagName(renderer)});
|
||||
_ = internal_os.setenv("GSK_RENDERER", @tagName(renderer));
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
c.gtk_init();
|
||||
|
@ -1984,6 +1984,14 @@ keybind: Keybinds = .{},
|
||||
/// - `ReleaseFast`: `false`
|
||||
@"gtk-opengl-debug": bool = build_config.slow_runtime_safety,
|
||||
|
||||
/// After GTK 4.14.0, we need to force the GSK renderer to OpenGL as the default
|
||||
/// GSK renderer is broken on some systems. If you would like to override
|
||||
/// that bekavior, set `gtk-gsk-renderer=default` and either use your system's
|
||||
/// default GSK renderer, or set the GSK_RENDERER environment variable to your
|
||||
/// renderer of choice before launching Ghostty. This setting has no effect when
|
||||
/// using versions of GTK earlier than 4.14.0.
|
||||
@"gtk-gsk-renderer": GtkGskRenderer = .opengl,
|
||||
|
||||
/// If `true`, the Ghostty GTK application will run in single-instance mode:
|
||||
/// each new `ghostty` process launched will result in a new window if there is
|
||||
/// already a running process.
|
||||
@ -6167,6 +6175,12 @@ pub const WindowPadding = struct {
|
||||
}
|
||||
};
|
||||
|
||||
/// See the `gtk-gsk-renderer` config.
|
||||
pub const GtkGskRenderer = enum {
|
||||
default,
|
||||
opengl,
|
||||
};
|
||||
|
||||
test "parse duration" {
|
||||
inline for (Duration.units) |unit| {
|
||||
var buf: [16]u8 = undefined;
|
||||
|
Reference in New Issue
Block a user