From 1baf3ba772aced5c49a45cba6db73fcd3f0174c7 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Thu, 2 May 2019 19:48:29 +0200 Subject: [PATCH] efl_ui_autorepeat: get rid of supported property the property should not exist. if something is not supported then do not inherit from this interface. If something wants to use the button theme, then this can be easily used via API. In legacy we already have the situation that things inherit from the button class. To solve this, the enabled call is disabled on those widgets, and disable every time it is called. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D8805 --- src/lib/efl/interfaces/efl_ui_autorepeat.eo | 8 ---- src/lib/elementary/efl_ui_button.c | 44 +++---------------- src/lib/elementary/efl_ui_button.eo | 1 - src/lib/elementary/elc_combobox.c | 14 +++--- src/lib/elementary/elc_fileselector_button.c | 9 ++-- src/lib/elementary/elc_hoversel.c | 9 ++-- .../elementary/elm_fileselector_button_eo.c | 2 +- src/lib/elementary/elm_hoversel_eo.c | 2 +- 8 files changed, 29 insertions(+), 60 deletions(-) diff --git a/src/lib/efl/interfaces/efl_ui_autorepeat.eo b/src/lib/efl/interfaces/efl_ui_autorepeat.eo index 1c374a5172..163c9c8f7c 100644 --- a/src/lib/efl/interfaces/efl_ui_autorepeat.eo +++ b/src/lib/efl/interfaces/efl_ui_autorepeat.eo @@ -43,13 +43,5 @@ interface @beta Efl.Ui.Autorepeat { on: bool; [[A bool to turn on/off the event]] } } - @property autorepeat_supported { - [[Whether the button supports autorepeat.]] - get { - } - values { - ret: bool; [[$true if autorepeat is supported, $false otherwise]] - } - } } } diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index a3c1c4dbfc..28bfc8680c 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -279,61 +279,29 @@ _efl_ui_button_efl_ui_autorepeat_autorepeat_enabled_set(Eo *obj EINA_UNUSED, Efl sd->repeating = EINA_FALSE; } -#define _AR_CAPABLE(obj) \ - (_internal_efl_ui_button_autorepeat_supported_get(obj)) - -static Eina_Bool -_internal_efl_ui_button_autorepeat_supported_get(const Evas_Object *obj) -{ - Eina_Bool ret = EINA_FALSE; - ret = efl_ui_autorepeat_supported_get(obj); - return ret; -} - EOLIAN static Eina_Bool -_efl_ui_button_efl_ui_autorepeat_autorepeat_supported_get(const Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *_pd EINA_UNUSED) +_efl_ui_button_efl_ui_autorepeat_autorepeat_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *sd) { - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_efl_ui_button_efl_ui_autorepeat_autorepeat_enabled_get(const Eo *obj, Efl_Ui_Button_Data *sd) -{ - return (_AR_CAPABLE(obj) & sd->autorepeat); + return (sd->autorepeat); } EOLIAN static void -_efl_ui_button_efl_ui_autorepeat_autorepeat_initial_timeout_set(Eo *obj, Efl_Ui_Button_Data *sd, double t) +_efl_ui_button_efl_ui_autorepeat_autorepeat_initial_timeout_set(Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *sd, double t) { - if (!_AR_CAPABLE(obj)) - { - ERR("this widget does not support auto repetition of clicks."); - return; - } - if (EINA_DBL_EQ(sd->ar_initial_timeout, t)) return; ELM_SAFE_FREE(sd->timer, ecore_timer_del); sd->ar_initial_timeout = t; } EOLIAN static double -_efl_ui_button_efl_ui_autorepeat_autorepeat_initial_timeout_get(const Eo *obj, Efl_Ui_Button_Data *sd) +_efl_ui_button_efl_ui_autorepeat_autorepeat_initial_timeout_get(const Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *sd) { - if (!_AR_CAPABLE(obj)) - return 0.0; - else - return sd->ar_initial_timeout; + return sd->ar_initial_timeout; } EOLIAN static void -_efl_ui_button_efl_ui_autorepeat_autorepeat_gap_timeout_set(Eo *obj, Efl_Ui_Button_Data *sd, double t) +_efl_ui_button_efl_ui_autorepeat_autorepeat_gap_timeout_set(Eo *obj EINA_UNUSED, Efl_Ui_Button_Data *sd, double t) { - if (!_AR_CAPABLE(obj)) - { - ERR("this widget does not support auto repetition of clicks."); - return; - } - if (EINA_DBL_EQ(sd->ar_gap_timeout, t)) return; sd->ar_gap_timeout = t; diff --git a/src/lib/elementary/efl_ui_button.eo b/src/lib/elementary/efl_ui_button.eo index b126588179..7bf7f17f04 100644 --- a/src/lib/elementary/efl_ui_button.eo +++ b/src/lib/elementary/efl_ui_button.eo @@ -13,7 +13,6 @@ class @beta Efl.Ui.Button extends Efl.Ui.Layout_Base implements Efl.Ui.Clickable Efl.Ui.Autorepeat.autorepeat_initial_timeout { set; get; } Efl.Ui.Autorepeat.autorepeat_gap_timeout { set; get; } Efl.Ui.Autorepeat.autorepeat_enabled { set; get; } - Efl.Ui.Autorepeat.autorepeat_supported { get;} Efl.Ui.Widget.on_access_activate; Efl.Ui.Widget.widget_input_event_handler; Efl.Access.Widget.Action.elm_actions { get; } diff --git a/src/lib/elementary/elc_combobox.c b/src/lib/elementary/elc_combobox.c index 71e581f18b..2318fe719f 100644 --- a/src/lib/elementary/elc_combobox.c +++ b/src/lib/elementary/elc_combobox.c @@ -364,11 +364,14 @@ _elm_combobox_efl_gfx_entity_visible_set(Eo *obj, Elm_Combobox_Data *sd, Eina_Bo } } -EOLIAN static Eina_Bool -_elm_combobox_efl_ui_autorepeat_autorepeat_supported_get(const Eo *obj EINA_UNUSED, - Elm_Combobox_Data *sd EINA_UNUSED) +EOLIAN static void +_elm_combobox_efl_ui_autorepeat_autorepeat_enabled_set(const Eo *obj EINA_UNUSED, + Elm_Combobox_Data *sd EINA_UNUSED, + Eina_Bool enabled) { - return EINA_FALSE; + if (enabled) + ERR("You cannot enable autorepeat on this object"); + efl_ui_autorepeat_enabled_set(efl_super(obj, MY_CLASS), EINA_FALSE); } EAPI Evas_Object * @@ -389,6 +392,7 @@ _elm_combobox_efl_object_constructor(Eo *obj, Elm_Combobox_Data *sd) sd->first_filter = EINA_TRUE; + efl_ui_autorepeat_enabled_set(obj, EINA_FALSE); efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); efl_access_object_role_set(obj, EFL_ACCESS_ROLE_GLASS_PANE); @@ -609,7 +613,7 @@ _elm_combobox_class_initializer(Efl_Class *klass) EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_combobox_efl_ui_widget_theme_apply), EFL_OBJECT_OP_FUNC(efl_ui_l10n_translation_update, _elm_combobox_efl_ui_l10n_translation_update), EFL_OBJECT_OP_FUNC(efl_ui_widget_input_event_handler, _elm_combobox_efl_ui_widget_widget_input_event_handler), - EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_supported_get, _elm_combobox_efl_ui_autorepeat_autorepeat_supported_get), + EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_enabled_set, _elm_combobox_efl_ui_autorepeat_autorepeat_enabled_set), EFL_OBJECT_OP_FUNC(elm_obj_genlist_filter_set, _elm_combobox_elm_genlist_filter_set), EFL_OBJECT_OP_FUNC(efl_access_widget_action_elm_actions_get, _elm_combobox_efl_access_widget_action_elm_actions_get), EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_combobox) diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c index 30aa8b225f..dfc8df2cc9 100644 --- a/src/lib/elementary/elc_fileselector_button.c +++ b/src/lib/elementary/elc_fileselector_button.c @@ -254,10 +254,12 @@ _elm_fileselector_button_efl_canvas_group_group_del(Eo *obj, Elm_Fileselector_Bu efl_canvas_group_del(efl_super(obj, MY_CLASS)); } -EOLIAN static Eina_Bool -_elm_fileselector_button_efl_ui_autorepeat_autorepeat_supported_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd EINA_UNUSED) +EOLIAN static void +_elm_fileselector_button_efl_ui_autorepeat_autorepeat_enabled_set(const Eo *obj EINA_UNUSED, Elm_Fileselector_Button_Data *sd EINA_UNUSED, Eina_Bool enabled) { - return EINA_FALSE; + if (enabled) + ERR("You cannot enable autorepeat on this object"); + efl_ui_autorepeat_enabled_set(efl_super(obj, MY_CLASS), EINA_FALSE); } EAPI Evas_Object * @@ -273,6 +275,7 @@ _elm_fileselector_button_efl_object_constructor(Eo *obj, Elm_Fileselector_Button obj = efl_constructor(efl_super(obj, MY_CLASS)); sd->obj = obj; + efl_ui_autorepeat_enabled_set(obj, EINA_FALSE); efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PUSH_BUTTON); diff --git a/src/lib/elementary/elc_hoversel.c b/src/lib/elementary/elc_hoversel.c index bf5cb4ab8e..e06c107338 100644 --- a/src/lib/elementary/elc_hoversel.c +++ b/src/lib/elementary/elc_hoversel.c @@ -681,10 +681,12 @@ _elm_hoversel_efl_gfx_entity_visible_set(Eo *obj, Elm_Hoversel_Data *sd, Eina_Bo efl_gfx_entity_visible_set(sd->hover, vis); } -EOLIAN static Eina_Bool -_elm_hoversel_efl_ui_autorepeat_autorepeat_supported_get(const Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd EINA_UNUSED) +EOLIAN static void +_elm_hoversel_efl_ui_autorepeat_autorepeat_enabled_set(const Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd EINA_UNUSED, Eina_Bool enabled) { - return EINA_FALSE; + if (enabled) + ERR("You cannot enable autorepeat on this object"); + efl_ui_autorepeat_enabled_set(efl_super(obj, MY_CLASS), EINA_FALSE); } EAPI Evas_Object * @@ -698,6 +700,7 @@ EOLIAN static Eo * _elm_hoversel_efl_object_constructor(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED) { obj = efl_constructor(efl_super(obj, MY_CLASS)); + efl_ui_autorepeat_enabled_set(obj, EINA_FALSE); efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PUSH_BUTTON); diff --git a/src/lib/elementary/elm_fileselector_button_eo.c b/src/lib/elementary/elm_fileselector_button_eo.c index 36436bbbde..7857efe04e 100644 --- a/src/lib/elementary/elm_fileselector_button_eo.c +++ b/src/lib/elementary/elm_fileselector_button_eo.c @@ -102,7 +102,7 @@ _elm_fileselector_button_class_initializer(Efl_Class *klass) EFL_OPS_DEFINE(ops, EFL_OBJECT_OP_FUNC(efl_constructor, _elm_fileselector_button_efl_object_constructor), EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_fileselector_button_efl_ui_widget_theme_apply), - EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_supported_get, _elm_fileselector_button_efl_ui_autorepeat_autorepeat_supported_get), + EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_enabled_set, _elm_fileselector_button_efl_ui_autorepeat_autorepeat_enabled_set), EFL_OBJECT_OP_FUNC(elm_interface_fileselector_selected_models_get, _elm_fileselector_button_elm_interface_fileselector_selected_models_get), EFL_OBJECT_OP_FUNC(elm_interface_fileselector_expandable_set, _elm_fileselector_button_elm_interface_fileselector_expandable_set), EFL_OBJECT_OP_FUNC(elm_interface_fileselector_expandable_get, _elm_fileselector_button_elm_interface_fileselector_expandable_get), diff --git a/src/lib/elementary/elm_hoversel_eo.c b/src/lib/elementary/elm_hoversel_eo.c index a9a04effc4..fb108263a1 100644 --- a/src/lib/elementary/elm_hoversel_eo.c +++ b/src/lib/elementary/elm_hoversel_eo.c @@ -160,7 +160,7 @@ _elm_hoversel_class_initializer(Efl_Class *klass) EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_hoversel_efl_ui_widget_theme_apply), EFL_OBJECT_OP_FUNC(efl_ui_l10n_translation_update, _elm_hoversel_efl_ui_l10n_translation_update), EFL_OBJECT_OP_FUNC(efl_ui_widget_input_event_handler, _elm_hoversel_efl_ui_widget_widget_input_event_handler), - EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_supported_get, _elm_hoversel_efl_ui_autorepeat_autorepeat_supported_get), + EFL_OBJECT_OP_FUNC(efl_ui_autorepeat_enabled_set, _elm_hoversel_efl_ui_autorepeat_autorepeat_enabled_set), EFL_OBJECT_OP_FUNC(efl_access_widget_action_elm_actions_get, _elm_hoversel_efl_access_widget_action_elm_actions_get), EFL_OBJECT_OP_FUNC(efl_access_object_access_children_get, _elm_hoversel_efl_access_object_access_children_get), ELM_HOVERSEL_EXTRA_OPS