From f2b1f312a97a6ef3f909109161db25d1d3b3f1d5 Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Mon, 5 Aug 2019 08:48:04 -0400 Subject: [PATCH] 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 --- src/bin/elementary/test_events.c | 2 +- src/bin/eolian_mono/eolian/mono/blacklist.hh | 13 ++----------- src/lib/elementary/elc_fileselector.c | 2 +- src/lib/elementary/elm_code_widget.c | 2 +- src/lib/evas/canvas/efl_input_key.c | 4 ++-- src/lib/evas/canvas/efl_input_key.eo | 2 +- src/tests/elementary/efl_ui_test_win.c | 2 +- 7 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/bin/elementary/test_events.c b/src/bin/elementary/test_events.c index 4b36bf4b35..e1438db3cb 100644 --- a/src/bin/elementary/test_events.c +++ b/src/bin/elementary/test_events.c @@ -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)); diff --git a/src/bin/eolian_mono/eolian/mono/blacklist.hh b/src/bin/eolian_mono/eolian/mono/blacklist.hh index 02cda670d9..733592e239 100644 --- a/src/bin/eolian_mono/eolian/mono/blacklist.hh +++ b/src/bin/eolian_mono/eolian/mono/blacklist.hh @@ -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 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); } diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index a3ef342e61..39f1a7cd3d 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -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))) { diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index 4a953e2130..17ee786791 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -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; diff --git a/src/lib/evas/canvas/efl_input_key.c b/src/lib/evas/canvas/efl_input_key.c index 8a55da6b7d..07d5a63776 100644 --- a/src/lib/evas/canvas/efl_input_key.c +++ b/src/lib/evas/canvas/efl_input_key.c @@ -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; } diff --git a/src/lib/evas/canvas/efl_input_key.eo b/src/lib/evas/canvas/efl_input_key.eo index 062d02e91f..f75d2b1666 100644 --- a/src/lib/evas/canvas/efl_input_key.eo +++ b/src/lib/evas/canvas/efl_input_key.eo @@ -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 diff --git a/src/tests/elementary/efl_ui_test_win.c b/src/tests/elementary/efl_ui_test_win.c index aecd1362d0..4e61e5bff2 100644 --- a/src/tests/elementary/efl_ui_test_win.c +++ b/src/tests/elementary/efl_ui_test_win.c @@ -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);