efl_input_key: replace key property name with key_sym

Summary:
Sorry to touch stable eo classes. there is name conflict issue between class and
property when binding language is generated from eo. for example in C#, compiler
error occurs.

```
src/bindings/mono/efl_input_key.eo.cs(272,26): error CS0542:
`Efl.Input.Key.Key': member names cannot be the same as their enclosing type
```

This patch changes Efl.Input.Key.GetKey/SetKey method to
Efl.Input.Key.GetKeySym/SetKeySym and generates Efl.Input.Key.KeySym
property.

Note that CAPI is not changed.

ref T8093

Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=true

Reviewers: lauromoura, woohyun, zmike, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: bu5hm4n, cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8093

Differential Revision: https://phab.enlightenment.org/D9483

zmike note: this class was not released at the point of this patch, the class
was only recently marked as stable
This commit is contained in:
Yeongjong Lee 2019-08-05 08:48:04 -04:00 committed by Mike Blumenkrantz
parent fb023ee6d2
commit f2b1f312a9
7 changed files with 9 additions and 18 deletions

View File

@ -56,7 +56,7 @@ _key_down(void *data, const Efl_Event *ev)
// 2. ecore_evas -> evas -> focused obj (elm_win) -> here
sprintf(str, "key=%s keyname=%s string=%s compose=%s",
efl_input_key_get(ev->info),
efl_input_key_sym_get(ev->info),
efl_input_key_name_get(ev->info),
efl_input_key_string_get(ev->info),
efl_input_key_compose_string_get(ev->info));

View File

@ -114,8 +114,7 @@ inline bool is_alias_blacklisted(attributes::alias_def const& alias)
inline bool is_property_blacklisted(std::string const& name)
{
return name == "Efl.Input.Key.Key"
|| name == "Efl.Input.Hold.Hold"
return name == "Efl.Input.Hold.Hold"
|| name == "Efl.IText.Text";
}
@ -135,17 +134,9 @@ inline bool is_property_blacklisted(attributes::property_def const& property, Co
template<typename Context>
inline bool is_property_blacklisted(attributes::property_def const& property,
attributes::klass_def const& implementing_class,
EINA_UNUSED attributes::klass_def const& implementing_class,
Context const& context)
{
std::string property_name = name_helpers::property_managed_name(property);
std::string klass_name = name_helpers::klass_concrete_or_interface_name(implementing_class);
// This property wrapper is invalidated as it would clash with the implementing
// class constructor. CS
if (property_name == klass_name)
return true;
return is_property_blacklisted(property, context);
}

View File

@ -1537,7 +1537,7 @@ _files_key_down(void *data, const Efl_Event *event)
if (!searchbar) return;
key = efl_input_key_get(ev);
key = efl_input_key_sym_get(ev);
string = efl_input_key_string_get(ev);
if (string && *(string) && (isalpha(*string) || isdigit(*string)))
{

View File

@ -1891,7 +1891,7 @@ _elm_code_widget_efl_ui_widget_widget_input_event_handler(Eo *obj EINA_UNUSED, E
if (eo_event->desc != EFL_EVENT_KEY_DOWN) return EINA_FALSE;
// FIXME: This should use key bindings and the standard implementation!
if (eina_streq(efl_input_key_get(ev), "BackSpace"))
if (eina_streq(efl_input_key_sym_get(ev), "BackSpace"))
{
efl_input_processed_set(ev, EINA_TRUE);
return EINA_TRUE;

View File

@ -95,13 +95,13 @@ _efl_input_key_key_name_get(const Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd)
}
EOLIAN static void
_efl_input_key_key_set(Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd, const char *val)
_efl_input_key_key_sym_set(Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd, const char *val)
{
eina_stringshare_replace(&pd->key, val);
}
EOLIAN static const char *
_efl_input_key_key_get(const Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd)
_efl_input_key_key_sym_get(const Eo *obj EINA_UNUSED, Efl_Input_Key_Data *pd)
{
return pd->key;
}

View File

@ -15,7 +15,7 @@ class Efl.Input.Key extends Efl.Object implements Efl.Input.Event, Efl.Input.Sta
val: string; [[Key name]]
}
}
@property key {
@property key_sym {
[[Logical key.
Eg. Shift + 1 = exclamation

View File

@ -139,7 +139,7 @@ _check_key_event(void *data, const Efl_Event *ev)
ck_assert_int_eq(efl_input_timestamp_get(ev->info), TIMESTAMP);
ck_assert_str_eq(efl_input_key_name_get(ev->info), "odiaeresis");
ck_assert_str_eq(efl_input_key_get(ev->info), "ö");
ck_assert_str_eq(efl_input_key_sym_get(ev->info), "ö");
ck_assert_str_eq(efl_input_key_string_get(ev->info), "Ö");
ck_assert_str_eq(efl_input_key_compose_string_get(ev->info), "Ö");
ck_assert_int_eq(efl_input_key_code_get(ev->info), 0xffe1);