summaryrefslogtreecommitdiff
path: root/src/lib/elput
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-05-27 09:17:46 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-05-27 09:17:46 -0400
commit20f418b8d7010aa3a4b9d174780a1dec8e76ef4e (patch)
tree76d5321f67efeefe1affd91bc5270a523f2e460f /src/lib/elput
parent65cfdaa3ddf17f0d5b3d8750e5ae2da026098b20 (diff)
elput: Add API function to support caching of existing keymap
@feature Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib/elput')
-rw-r--r--src/lib/elput/Elput.h11
-rw-r--r--src/lib/elput/elput_evdev.c3
-rw-r--r--src/lib/elput/elput_input.c9
-rw-r--r--src/lib/elput/elput_private.h1
4 files changed, 23 insertions, 1 deletions
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index f64943f853..4595f58e61 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -390,6 +390,17 @@ EAPI Eina_Bool elput_input_key_remap_set(Elput_Manager *manager, int *from_keys,
390 */ 390 */
391EAPI void elput_input_keyboard_cached_context_set(Elput_Manager *manager, void *context); 391EAPI void elput_input_keyboard_cached_context_set(Elput_Manager *manager, void *context);
392 392
393/**
394 * Set a cached keymap to be used for keyboards
395 *
396 * @param manager
397 * @param keymap
398 *
399 * @ingroup Elput_Input_Group
400 * @since 1.18
401 */
402EAPI void elput_input_keyboard_cached_keymap_set(Elput_Manager *manager, void *keymap);
403
393# endif 404# endif
394 405
395# undef EAPI 406# undef EAPI
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 79386af902..8704a2ee9b 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -165,9 +165,10 @@ _keyboard_info_destroy(Elput_Keyboard_Info *info, Eina_Bool external)
165{ 165{
166 if (--info->refs > 0) return; 166 if (--info->refs > 0) return;
167 167
168 xkb_keymap_unref(info->keymap.map);
169
168 if (!external) 170 if (!external)
169 { 171 {
170 xkb_keymap_unref(info->keymap.map);
171 if (info->keymap.area) munmap(info->keymap.area, info->keymap.size); 172 if (info->keymap.area) munmap(info->keymap.area, info->keymap.size);
172 if (info->keymap.fd >= 0) close(info->keymap.fd); 173 if (info->keymap.fd >= 0) close(info->keymap.fd);
173 } 174 }
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index 464f69f226..1918216565 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -585,3 +585,12 @@ elput_input_keyboard_cached_context_set(Elput_Manager *manager, void *context)
585 if ((context) && (manager->cached.context == context)) return; 585 if ((context) && (manager->cached.context == context)) return;
586 manager->cached.context = context; 586 manager->cached.context = context;
587} 587}
588
589EAPI void
590elput_input_keyboard_cached_keymap_set(Elput_Manager *manager, void *keymap)
591{
592 EINA_SAFETY_ON_NULL_RETURN(manager);
593
594 if ((keymap) && (manager->cached.keymap == keymap)) return;
595 manager->cached.keymap = keymap;
596}
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index 7a57e2f159..cda235e49d 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -249,6 +249,7 @@ struct _Elput_Manager
249 249
250 struct 250 struct
251 { 251 {
252 struct xkb_keymap *keymap;
252 struct xkb_context *context; 253 struct xkb_context *context;
253 } cached; 254 } cached;
254 255