Add a new API to set key repeat
authorJengHyun Kang <jhyuni.kang@samsung.com>
Mon, 25 Apr 2016 09:05:46 +0000 (18:05 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 21 Dec 2023 23:40:34 +0000 (08:40 +0900)
Change-Id: If1644c4c6575b4eb7cadb8c1e11147651013d8ef

include/xkbcommon/xkbcommon.h
src/keymap.c

index dbc39b91523de99b056807d3b260d57ab020de4a..2c1eb1281faa3554e2ec2abacaf473d758e8ae1d 100644 (file)
@@ -1304,6 +1304,10 @@ xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap,
 int
 xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key);
 
+int
+xkb_keymap_key_set_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc, int enable);
+
+
 /** @} */
 
 /**
index 0291aedbb11c3c7c173aa04d25b26924b7c9360b..5aed2a6cd37446518c107a5b97e4ce9be5261a63 100644 (file)
@@ -583,3 +583,17 @@ xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc)
 
     return key->repeats;
 }
+
+XKB_EXPORT int
+xkb_keymap_key_set_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc, int enable)
+{
+    struct xkb_key *key = XkbKey(keymap, kc);
+
+    if (!key)
+        return 0;
+
+    key->repeats = !!enable;
+    key->explicit |= EXPLICIT_REPEAT;
+
+    return 1;
+}