diff options
-rw-r--r-- | libcaribou/key-model.vala | 11 | ||||
-rw-r--r-- | libcaribou/keyboard-model.vala | 10 |
2 files changed, 15 insertions, 6 deletions
diff --git a/libcaribou/key-model.vala b/libcaribou/key-model.vala index e989f34..32ed771 100644 --- a/libcaribou/key-model.vala +++ b/libcaribou/key-model.vala @@ -19,10 +19,8 @@ namespace Caribou { internal set { _scan_selected = value; - if (_scan_selected) { - press (); - GLib.Timeout.add(200, () => { release (); return false; }); - } + if (_scan_selected) + activate (); } } @@ -95,5 +93,10 @@ namespace Caribou { public IKeyboardObject[] get_children () { return (IKeyboardObject[]) extended_keys.to_array (); } + + public void activate () { + press (); + GLib.Timeout.add(100, () => { release (); return false; }); + } } }
\ No newline at end of file diff --git a/libcaribou/keyboard-model.vala b/libcaribou/keyboard-model.vala index 9fca05d..e34a3a3 100644 --- a/libcaribou/keyboard-model.vala +++ b/libcaribou/keyboard-model.vala @@ -5,8 +5,9 @@ namespace Caribou { public string active_group { get; private set; default = ""; } public string keyboard_type { get; construct; } - XAdapter xadapter; - Gee.HashMap<string, GroupModel> groups; + private XAdapter xadapter; + private Gee.HashMap<string, GroupModel> groups; + private KeyModel last_activated_key; construct { uint grpid; @@ -40,6 +41,11 @@ namespace Caribou { } private void on_key_activated (KeyModel key) { + if (key.name == "Caribou_Repeat") + last_activated_key.activate (); + else + last_activated_key = key; + key_activated (key); } |