summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_spin_button.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-05 18:08:02 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-08 19:56:38 +0200
commit1414b8a921cb150c48adaa3e0bbe3eb1edd17d8d (patch)
treedf0657acd3db26748d5a74d876f632c9f021175e /src/lib/elementary/efl_ui_spin_button.c
parenteaeb67e5718dbb5b8cef471fc08204968c5736a2 (diff)
efl_ui_spin_button: this can also be done with the focus callback
this makes the code more readable, and reduces the amount of events we are subscribing to. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9227
Diffstat (limited to 'src/lib/elementary/efl_ui_spin_button.c')
-rw-r--r--src/lib/elementary/efl_ui_spin_button.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c
index ebdf2ca..aff27f9 100644
--- a/src/lib/elementary/efl_ui_spin_button.c
+++ b/src/lib/elementary/efl_ui_spin_button.c
@@ -438,17 +438,10 @@ _entry_activated_cb(void *data, const Efl_Event *event EINA_UNUSED)
438static void 438static void
439_entry_focus_changed_cb(void *data, const Efl_Event *event) 439_entry_focus_changed_cb(void *data, const Efl_Event *event)
440{ 440{
441 if (!efl_ui_focus_object_focus_get(event->object))
442 _toggle_entry(data);
443}
444
445static void
446_text_button_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED)
447{
448 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS); 441 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
449 442
450 if (sd->entry_visible) return; 443 if (efl_ui_focus_object_focus_get(event->object) && sd->entry_visible) return;
451 _toggle_entry(data); 444 _toggle_entry(data);
452} 445}
453 446
454static Eina_Bool 447static Eina_Bool
@@ -743,8 +736,6 @@ _efl_ui_spin_button_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Button_Data *sd)
743 736
744 sd->text_button = efl_add(EFL_UI_BUTTON_CLASS, obj, 737 sd->text_button = efl_add(EFL_UI_BUTTON_CLASS, obj,
745 elm_widget_element_update(obj, efl_added, PART_NAME_TEXT_BUTTON), 738 elm_widget_element_update(obj, efl_added, PART_NAME_TEXT_BUTTON),
746 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
747 _text_button_clicked_cb, obj),
748 efl_event_callback_add(efl_added, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, 739 efl_event_callback_add(efl_added, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED,
749 _text_button_focus_changed_cb, obj), 740 _text_button_focus_changed_cb, obj),
750 efl_content_set(efl_part(obj, "efl.text_button"), efl_added)); 741 efl_content_set(efl_part(obj, "efl.text_button"), efl_added));