spinner: spinner entry reactivate when focus come again.
authorWoochan Lee <wc0917.lee@samsung.com>
Mon, 4 Jul 2016 10:55:53 +0000 (19:55 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Mon, 4 Jul 2016 10:55:53 +0000 (19:55 +0900)
Summary:
When user edit spinner value on entry.
The user want to back on entry to edit spinner value even swiching view(focus out and focus in).

I considered a couple of exception case ( case that entry should not reactivate.)
1. User click spinner button to give focus.
2. User give focus to spinner's object using key action.

Test Plan:
Add sample in elementary_test.
Edit spinner value.
Gives focus to other window.
Back to spinner view.
See the action.

Reviewers: Hermet, woohyun, cedric, jpeg

Subscribers: cedric, jpeg

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

src/lib/elementary/elm_spinner.c
src/lib/elementary/elm_widget_spinner.h

index f128ba8..d2701f5 100644 (file)
@@ -858,6 +858,7 @@ _inc_dec_button_pressed_cb(void *data, const Eo_Event *event)
                             _val_inc_dec_start, data);
 
    if (sd->entry_visible) _entry_value_apply(data);
+   if (sd->entry_reactivate) sd->entry_reactivate = EINA_FALSE;
 }
 
 static void
@@ -920,8 +921,19 @@ _elm_spinner_elm_widget_on_focus(Eo *obj, Elm_Spinner_Data *sd, Elm_Object_Item
         ELM_SAFE_FREE(sd->delay_change_timer, ecore_timer_del);
         ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
 
+        if (sd->entry_visible) sd->entry_reactivate = EINA_TRUE;
+
         _entry_value_apply(obj);
      }
+   else
+     {
+        if (sd->entry_reactivate)
+          {
+             _toggle_entry(obj);
+
+             sd->entry_reactivate = EINA_FALSE;
+          }
+     }
 
    return EINA_TRUE;
 }
@@ -1377,7 +1389,11 @@ _elm_spinner_elm_widget_focus_next(Eo *obj, Elm_Spinner_Data *_pd, Elm_Focus_Dir
         if (_pd->entry_visible)
           items = eina_list_append(items, _pd->ent);
         else
-          items = eina_list_append(items, _pd->text_button);
+          {
+             if (_pd->entry_reactivate) _pd->entry_reactivate = EINA_FALSE;
+
+             items = eina_list_append(items, _pd->text_button);
+          }
 
      }
    return elm_widget_focus_list_next_get
index 85af775..390c63b 100644 (file)
@@ -43,6 +43,7 @@ struct _Elm_Spinner_Data
    Eina_List            *special_values;
 
    Eina_Bool             entry_visible : 1;
+   Eina_Bool             entry_reactivate : 1;
    Eina_Bool             dragging : 1;
    Eina_Bool             editable : 1;
    Eina_Bool             wrap : 1;