mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +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)) {
|
if (version.runtimeAtLeast(4, 14, 0)) {
|
||||||
// We need to export GSK_RENDERER to opengl because GTK uses ngl by
|
switch (config.@"gtk-gsk-renderer") {
|
||||||
// default after 4.14
|
.default => {},
|
||||||
_ = internal_os.setenv("GSK_RENDERER", "opengl");
|
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();
|
c.gtk_init();
|
||||||
|
@ -1984,6 +1984,14 @@ keybind: Keybinds = .{},
|
|||||||
/// - `ReleaseFast`: `false`
|
/// - `ReleaseFast`: `false`
|
||||||
@"gtk-opengl-debug": bool = build_config.slow_runtime_safety,
|
@"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:
|
/// 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
|
/// each new `ghostty` process launched will result in a new window if there is
|
||||||
/// already a running process.
|
/// 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" {
|
test "parse duration" {
|
||||||
inline for (Duration.units) |unit| {
|
inline for (Duration.units) |unit| {
|
||||||
var buf: [16]u8 = undefined;
|
var buf: [16]u8 = undefined;
|
||||||
|
Reference in New Issue
Block a user