padOsd: Replace Gtk accelerator API usage with Mutter

In order to drop the direct dependency of GTK from Mutter in a Wayland
only build.
The consumer and the producer of the events must be Mutter

Depends on https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2575>
This commit is contained in:
Bilal Elmoussaoui 2022-12-06 12:38:48 +00:00 committed by Bilal Elmoussaoui
parent e1dad503b5
commit 1da29b04ef

View File

@ -3,7 +3,7 @@
const { const {
Atk, Clutter, GDesktopEnums, Gio, Atk, Clutter, GDesktopEnums, Gio,
GLib, GObject, Gtk, Meta, Pango, Rsvg, St, GLib, GObject, Meta, Pango, Rsvg, St,
} = imports.gi; } = imports.gi;
const Signals = imports.misc.signals; const Signals = imports.misc.signals;
@ -104,10 +104,9 @@ var KeybindingEntry = GObject.registerClass({
if (event.type() != Clutter.EventType.KEY_PRESS) if (event.type() != Clutter.EventType.KEY_PRESS)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
let str = Gtk.accelerator_name_with_keycode(null, const str = Meta.accelerator_name(
event.get_key_symbol(), event.get_state(), event.get_key_symbol());
event.get_key_code(),
event.get_state());
this.set_text(str); this.set_text(str);
this.emit('keybinding-edited', str); this.emit('keybinding-edited', str);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;