summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_key_grab.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-05-16 16:48:58 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-05-16 20:47:48 +0900
commit054aa012c4fb6e4782c4af5cec6ed6596651dc7c (patch)
tree28feba0c1f86b8519a730286c52c473aa57805be /src/lib/evas/canvas/evas_key_grab.c
parent64b90fd22e537994745b0cc4df05691286283fa4 (diff)
evas: Use enum instead of string in Efl.Input.State
Ref T5312
Diffstat (limited to 'src/lib/evas/canvas/evas_key_grab.c')
-rw-r--r--src/lib/evas/canvas/evas_key_grab.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/lib/evas/canvas/evas_key_grab.c b/src/lib/evas/canvas/evas_key_grab.c
index 9e5f10f..7d856d2 100644
--- a/src/lib/evas/canvas/evas_key_grab.c
+++ b/src/lib/evas/canvas/evas_key_grab.c
@@ -1,6 +1,9 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#include "evas_private.h" 2#include "evas_private.h"
3 3
4#define EFL_INTERNAL_UNSTABLE
5#include "interfaces/efl_common_internal.h"
6
4/* private calls */ 7/* private calls */
5 8
6/* FIXME: this is not optimal, but works. i should have a hash of keys per */ 9/* FIXME: this is not optimal, but works. i should have a hash of keys per */
@@ -194,33 +197,28 @@ _object_key_ungrab(Eo *eo_obj, Evas_Object_Protected_Data *obj, const char *keyn
194 } 197 }
195} 198}
196 199
197// Matching function between legacy (used throughout EFL) and EO enums
198
199static const struct {
200 const char *keyname;
201 Efl_Input_Modifier mod;
202} _modifier_match[] = {
203 { "Alt", EFL_INPUT_MODIFIER_ALT },
204 { "Control", EFL_INPUT_MODIFIER_CONTROL },
205 { "Shift", EFL_INPUT_MODIFIER_SHIFT },
206 { "Meta", EFL_INPUT_MODIFIER_META },
207 { "AltGr", EFL_INPUT_MODIFIER_ALTGR },
208 { "Hyper", EFL_INPUT_MODIFIER_HYPER },
209 { "Super", EFL_INPUT_MODIFIER_SUPER },
210 { NULL, EFL_INPUT_MODIFIER_NONE }
211};
212
213static inline Evas_Modifier_Mask 200static inline Evas_Modifier_Mask
214_efl_input_modifier_to_evas_modifier_mask(Evas_Public_Data *e, Efl_Input_Modifier in) 201_efl_input_modifier_to_evas_modifier_mask(Evas_Public_Data *e, Efl_Input_Modifier in)
215{ 202{
216 Evas_Modifier_Mask out = 0; 203 Evas_Modifier_Mask out = 0;
217 int i; 204 size_t i;
218 205
219 for (i = 0; _modifier_match[i].keyname; i++) 206 static const Efl_Input_Modifier mods[] = {
220 { 207 EFL_INPUT_MODIFIER_ALT,
221 if (in & _modifier_match[i].mod) 208 EFL_INPUT_MODIFIER_CONTROL,
222 out |= evas_key_modifier_mask_get(e->evas, _modifier_match[i].keyname); 209 EFL_INPUT_MODIFIER_SHIFT,
223 } 210 EFL_INPUT_MODIFIER_META,
211 EFL_INPUT_MODIFIER_ALTGR,
212 EFL_INPUT_MODIFIER_HYPER,
213 EFL_INPUT_MODIFIER_SUPER
214 };
215
216 for (i = 0; i < EINA_C_ARRAY_LENGTH(mods); i++)
217 if (in & mods[i])
218 {
219 out |= evas_key_modifier_mask_get
220 (e->evas, _efl_input_modifier_to_string(mods[i]));
221 }
224 222
225 return out; 223 return out;
226} 224}