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.pull/7477/head
parent
4d18c06804
commit
6fac355363
|
|
@ -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,
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue