aboutsummaryrefslogtreecommitdiff
blob: 56d99a0b9478eba38ecc67a6f1512db7c24b9d2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
index dbb6da8..54ccb4c 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -224,7 +224,7 @@
       <applyto>/desktop/ibus/general/use_system_keyboard_layout</applyto>
       <owner>ibus</owner>
       <type>bool</type>
-      <default>true</default>
+      <default>false</default>
       <locale name="C">
         <short>Use system keyboard layout</short>
 	    <long>Use system keyboard (XKB) layout</long>
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index 24e6b2e..18ef5c0 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -48,6 +48,7 @@ class Panel : IBus.PanelService {
     private Gtk.AboutDialog m_about_dialog;
     private Gtk.CssProvider m_css_provider;
     private int m_switcher_delay_time = 400;
+    private bool m_use_system_keyboard_layout = false;
     private const string ACCELERATOR_SWITCH_IME_FOREWARD = "<Control>space";
 
     private GLib.List<Keybinding> m_keybindings = new GLib.List<Keybinding>();
@@ -265,6 +266,22 @@ class Panel : IBus.PanelService {
         }
     }
 
+    private void set_use_system_keyboard_layout(Variant? variant) {
+        Variant var_use_system_kbd_layout = variant;
+
+        if (var_use_system_kbd_layout == null) {
+            var_use_system_kbd_layout = m_config.get_value(
+                    "general",
+                    "use_system_keyboard_layout");
+        }
+
+        if (var_use_system_kbd_layout == null) {
+            return;
+        }
+
+        m_use_system_keyboard_layout = var_use_system_kbd_layout.get_boolean();
+    }
+
     public void set_config(IBus.Config config) {
         if (m_config != null) {
             m_config.value_changed.disconnect(config_value_changed_cb);
@@ -278,9 +295,13 @@ class Panel : IBus.PanelService {
             m_config.watch("general", "preload_engines");
             m_config.watch("general", "engines_order");
             m_config.watch("general", "switcher_delay_time");
+            m_config.watch("general", "use_system_keyboard_layout");
             m_config.watch("general/hotkey", "triggers");
             m_config.watch("panel", "custom_font");
             m_config.watch("panel", "use_custom_font");
+            // Update m_use_system_keyboard_layout before update_engines()
+            // is called.
+            set_use_system_keyboard_layout(null);
             update_engines(m_config.get_value("general", "preload_engines"),
                            m_config.get_value("general", "engines_order"));
             unbind_switch_shortcut();
@@ -352,7 +373,9 @@ class Panel : IBus.PanelService {
             return;
         }
         // set xkb layout
-        exec_setxkbmap(engine);
+        if (!m_use_system_keyboard_layout) {
+            exec_setxkbmap(engine);
+        }
     }
 
     private void config_value_changed_cb(IBus.Config config,
@@ -380,6 +403,11 @@ class Panel : IBus.PanelService {
             set_switcher_delay_time(variant);
             return;
         }
+
+        if (section == "general" && name == "use_system_keyboard_layout") {
+            set_use_system_keyboard_layout(variant);
+            return;
+        }
     }
 
     private void handle_engine_switch(Gdk.Event event, bool revert) {