double timestamp;
};
+static inline const char *
+_efl_input_modifier_to_string(Efl_Input_Modifier mod)
+{
+ switch (mod)
+ {
+ default:
+ case EFL_INPUT_MODIFIER_NONE: return NULL;
+ case EFL_INPUT_MODIFIER_ALT: return "Alt";
+ case EFL_INPUT_MODIFIER_CONTROL: return "Control";
+ case EFL_INPUT_MODIFIER_SHIFT: return "Shift";
+ case EFL_INPUT_MODIFIER_META: return "Meta";
+ case EFL_INPUT_MODIFIER_ALTGR: return "AltGr";
+ case EFL_INPUT_MODIFIER_HYPER: return "Hyper";
+ case EFL_INPUT_MODIFIER_SUPER: return "Super";
+ }
+}
+
+static inline const char *
+_efl_input_lock_to_string(Efl_Input_Lock lock)
+{
+ switch (lock)
+ {
+ default:
+ case EFL_INPUT_LOCK_NONE: return NULL;
+ case EFL_INPUT_LOCK_NUM: return "Num";
+ case EFL_INPUT_LOCK_CAPS: return "Caps";
+ case EFL_INPUT_LOCK_SCROLL: return "Scroll";
+ case EFL_INPUT_LOCK_SHIFT: return "Shift";
+ }
+}
+
static inline Eina_Bool
_efl_input_value_has(const Efl_Input_Pointer_Data *pd, Efl_Input_Value key)
{
}
EOLIAN static Eina_Bool
-_efl_ui_win_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd, const char *name)
+_efl_ui_win_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd, Efl_Input_Modifier mod)
{
const Evas_Modifier *m = evas_key_modifier_get(pd->evas);
+ const char *name = _efl_input_modifier_to_string(mod);
return evas_key_modifier_is_set(m, name);
}
EOLIAN static Eina_Bool
-_efl_ui_win_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd, const char *name)
+_efl_ui_win_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd, Efl_Input_Lock lock)
{
const Evas_Lock *m = evas_key_lock_get(pd->evas);
+ const char *name = _efl_input_lock_to_string(lock);
return evas_key_lock_is_set(m, name);
}
}
EOLIAN static Eina_Bool
-_efl_input_key_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd, const char * name)
+_efl_input_key_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd, Efl_Input_Modifier mod)
{
Efl_Input_Device *seat;
+ const char *name;
if (!pd->modifiers) return EINA_FALSE;
seat = efl_input_device_seat_get(pd->device);
if (!seat) return EINA_FALSE;
+ name = _efl_input_modifier_to_string(mod);
+ if (!name) return EINA_FALSE;
return evas_seat_key_modifier_is_set(pd->modifiers, name, seat);
}
EOLIAN static Eina_Bool
-_efl_input_key_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd, const char * name)
+_efl_input_key_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd, Efl_Input_Lock lock)
{
Efl_Input_Device *seat;
+ const char *name;
+
if (!pd->locks) return EINA_FALSE;
seat = efl_input_device_seat_get(pd->device);
if (!seat) return EINA_FALSE;
+ name = _efl_input_lock_to_string(lock);
+ if (!name) return EINA_FALSE;
return evas_seat_key_lock_is_set(pd->locks, name, seat);
}
}
EOLIAN static Eina_Bool
-_efl_input_pointer_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, const char *name)
+_efl_input_pointer_efl_input_state_modifier_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, Efl_Input_Modifier mod)
{
Efl_Input_Device *seat;
+ const char *name;
if (!pd->modifiers) return EINA_FALSE;
seat = efl_input_device_seat_get(pd->device);
if (!seat) return EINA_FALSE;
+ name = _efl_input_modifier_to_string(mod);
+ if (!name) return EINA_FALSE;
return evas_seat_key_modifier_is_set(pd->modifiers, name, seat);
}
EOLIAN static Eina_Bool
-_efl_input_pointer_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, const char *name)
+_efl_input_pointer_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, Efl_Input_Lock lock)
{
Efl_Input_Device *seat;
+ const char *name;
if (!pd->locks) return EINA_FALSE;
seat = efl_input_device_seat_get(pd->device);
if (!seat) return EINA_FALSE;
+ name = _efl_input_lock_to_string(lock);
+ if (!name) return EINA_FALSE;
return evas_seat_key_lock_is_set(pd->locks, name, seat);
}
+import efl_input_types;
+
interface Efl.Input.State ()
{
[[Efl input state interface]]
eo_prefix: efl_input;
methods {
@property modifier_enabled {
- [[Indicates whether a key modifier is on, such as Ctrl, Shift,...]]
+ [[Indicates whether a key modifier is on, such as Ctrl, Shift, ...]]
get {}
keys {
- name: string; [[Key name]]
+ mod: Efl.Input.Modifier; [[The modifier key to test.]]
}
values {
is_set: bool; [[$true if the key modifier is pressed.]]
[[Indicates whether a key lock is on, such as NumLock, CapsLock, ...]]
get {}
keys {
- name: string; [[Lock name]]
+ lock: Efl.Input.Lock; [[The lock key to test.]]
}
values {
is_set: bool; [[$true if the key lock is on.]]
#include "evas_common_private.h"
#include "evas_private.h"
+#define EFL_INTERNAL_UNSTABLE
+#include "interfaces/efl_common_internal.h"
+
/* private calls */
/* FIXME: this is not optimal, but works. i should have a hash of keys per */
}
}
-// Matching function between legacy (used throughout EFL) and EO enums
-
-static const struct {
- const char *keyname;
- Efl_Input_Modifier mod;
-} _modifier_match[] = {
- { "Alt", EFL_INPUT_MODIFIER_ALT },
- { "Control", EFL_INPUT_MODIFIER_CONTROL },
- { "Shift", EFL_INPUT_MODIFIER_SHIFT },
- { "Meta", EFL_INPUT_MODIFIER_META },
- { "AltGr", EFL_INPUT_MODIFIER_ALTGR },
- { "Hyper", EFL_INPUT_MODIFIER_HYPER },
- { "Super", EFL_INPUT_MODIFIER_SUPER },
- { NULL, EFL_INPUT_MODIFIER_NONE }
-};
-
static inline Evas_Modifier_Mask
_efl_input_modifier_to_evas_modifier_mask(Evas_Public_Data *e, Efl_Input_Modifier in)
{
Evas_Modifier_Mask out = 0;
- int i;
-
- for (i = 0; _modifier_match[i].keyname; i++)
- {
- if (in & _modifier_match[i].mod)
- out |= evas_key_modifier_mask_get(e->evas, _modifier_match[i].keyname);
- }
+ size_t i;
+
+ static const Efl_Input_Modifier mods[] = {
+ EFL_INPUT_MODIFIER_ALT,
+ EFL_INPUT_MODIFIER_CONTROL,
+ EFL_INPUT_MODIFIER_SHIFT,
+ EFL_INPUT_MODIFIER_META,
+ EFL_INPUT_MODIFIER_ALTGR,
+ EFL_INPUT_MODIFIER_HYPER,
+ EFL_INPUT_MODIFIER_SUPER
+ };
+
+ for (i = 0; i < EINA_C_ARRAY_LENGTH(mods); i++)
+ if (in & mods[i])
+ {
+ out |= evas_key_modifier_mask_get
+ (e->evas, _efl_input_modifier_to_string(mods[i]));
+ }
return out;
}