mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-05 09:26:32 +00:00
gtk(wayland): fallback when on-demand mode isn't supported
This shouldn't be a real problem anymore since as of now (May 2025) all major compositors support at least version 4, but let's do this just in case.
This commit is contained in:
@@ -27,6 +27,10 @@ pub fn isSupported() bool {
|
||||
return c.gtk_layer_is_supported() != 0;
|
||||
}
|
||||
|
||||
pub fn getProtocolVersion() c_uint {
|
||||
return c.gtk_layer_get_protocol_version();
|
||||
}
|
||||
|
||||
pub fn initForWindow(window: *gtk.Window) void {
|
||||
c.gtk_layer_init_for_window(@ptrCast(window));
|
||||
}
|
||||
|
@@ -369,7 +369,13 @@ pub const Window = struct {
|
||||
window,
|
||||
switch (config.quick_terminal_keyboard_interactivity) {
|
||||
.none => .none,
|
||||
.@"on-demand" => .on_demand,
|
||||
.@"on-demand" => on_demand: {
|
||||
if (gtk4_layer_shell.getProtocolVersion() < 4) {
|
||||
log.warn("your compositor does not support on-demand keyboard access; falling back to exclusive access", .{});
|
||||
break :on_demand .exclusive;
|
||||
}
|
||||
break :on_demand .on_demand;
|
||||
},
|
||||
.exclusive => .exclusive,
|
||||
},
|
||||
);
|
||||
|
Reference in New Issue
Block a user