mirror of
https://github.com/elementary/gala.git
synced 2024-12-18 14:51:51 +03:00
KeyboardManager: get backend from context (#1605)
This commit is contained in:
parent
de41984e90
commit
7eae3c1137
@ -9,12 +9,14 @@ public class Gala.KeyboardManager : Object {
|
||||
private static VariantType sources_variant_type;
|
||||
private static GLib.Settings settings;
|
||||
|
||||
public unowned Meta.Display display { construct; private get; }
|
||||
|
||||
public static void init (Meta.Display display) {
|
||||
if (instance != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
instance = new KeyboardManager ();
|
||||
instance = new KeyboardManager (display);
|
||||
|
||||
display.modifiers_accelerator_activated.connect ((display) => KeyboardManager.handle_modifiers_accelerator_activated (display, false));
|
||||
}
|
||||
@ -36,6 +38,10 @@ public class Gala.KeyboardManager : Object {
|
||||
set_keyboard_layout (settings, "sources"); // Update layouts
|
||||
}
|
||||
|
||||
private KeyboardManager (Meta.Display display) {
|
||||
Object (display: display);
|
||||
}
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
public static bool handle_modifiers_accelerator_activated (Meta.Display display, bool backward) {
|
||||
display.ungrab_keyboard (display.get_current_time ());
|
||||
@ -89,9 +95,9 @@ public class Gala.KeyboardManager : Object {
|
||||
var variant = string.joinv (",", variants);
|
||||
var options = string.joinv (",", xkb_options);
|
||||
|
||||
Meta.Backend.get_backend ().set_keymap (layout, variant, options);
|
||||
display.get_context ().get_backend ().set_keymap (layout, variant, options);
|
||||
} else if (key == "current") {
|
||||
Meta.Backend.get_backend ().lock_layout_group (settings.get_uint ("current"));
|
||||
display.get_context ().get_backend ().lock_layout_group (settings.get_uint ("current"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user