summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-05-12 01:04:25 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-05-12 01:25:43 +0900
commitad089ad6fea5b5be94258bdaaeff4c17a2a6b38e (patch)
tree58ae13f05973e3d4727c6a6e070c154f7607d6d0
parent2864a94b80d4ecb22d12cbb9a72f354f42578e67 (diff)
focus: update the focus in_theme status on each item's focus set.
As widget and widget item can have different in_theme value (since 30cada369), we need to update in_theme value whenever the widget or widget item get the focus. Applied this logic to genlist, gengrid, toolbar first. List focus is not working well at the moment. This fixes small focus highlight on the left top corner of genlist when the genlist scroller is clicked before the genlist is focused. Special thanks to zmike for the report.
-rw-r--r--src/lib/elm_gengrid.c5
-rw-r--r--src/lib/elm_genlist.c6
-rw-r--r--src/lib/elm_toolbar.c3
-rw-r--r--src/lib/elm_widget.c12
-rw-r--r--src/lib/elm_widget.h2
-rw-r--r--src/lib/elm_win.c7
6 files changed, 30 insertions, 5 deletions
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 3eebaf430..9402164fc 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -911,8 +911,6 @@ _item_realize(Elm_Gen_Item *it)
911 if (it->mouse_cursor) 911 if (it->mouse_cursor)
912 elm_widget_item_cursor_set(it, it->mouse_cursor); 912 elm_widget_item_cursor_set(it, it->mouse_cursor);
913 913
914 _elm_widget_item_highlight_in_theme(WIDGET(it), (Elm_Object_Item *)it);
915
916 it->realized = EINA_TRUE; 914 it->realized = EINA_TRUE;
917 it->want_unrealize = EINA_FALSE; 915 it->want_unrealize = EINA_FALSE;
918} 916}
@@ -2917,6 +2915,9 @@ _item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused)
2917 if (sd->focused_item) 2915 if (sd->focused_item)
2918 _elm_gengrid_item_unfocused((Elm_Gen_Item *)sd->focused_item); 2916 _elm_gengrid_item_unfocused((Elm_Gen_Item *)sd->focused_item);
2919 _elm_gengrid_item_focused((Elm_Gen_Item *)it); 2917 _elm_gengrid_item_focused((Elm_Gen_Item *)it);
2918
2919 _elm_widget_item_highlight_in_theme(obj, (Elm_Object_Item *)it);
2920 _elm_widget_highlight_in_theme_update(obj);
2920 _elm_widget_focus_highlight_start(obj); 2921 _elm_widget_focus_highlight_start(obj);
2921 } 2922 }
2922 } 2923 }
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index c524d1a05..640b618fd 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -1754,9 +1754,6 @@ _item_realize(Elm_Gen_Item *it,
1754 1754
1755 if (it->decorate_it_set) _decorate_item_set(it); 1755 if (it->decorate_it_set) _decorate_item_set(it);
1756 1756
1757 if (!calc)
1758 _elm_widget_item_highlight_in_theme(WIDGET(it), (Elm_Object_Item *)it);
1759
1760 edje_object_message_signal_process(VIEW(it)); 1757 edje_object_message_signal_process(VIEW(it));
1761} 1758}
1762 1759
@@ -5655,6 +5652,9 @@ _item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused)
5655 if (sd->focused_item) 5652 if (sd->focused_item)
5656 _elm_genlist_item_unfocused((Elm_Gen_Item *)sd->focused_item); 5653 _elm_genlist_item_unfocused((Elm_Gen_Item *)sd->focused_item);
5657 _elm_genlist_item_focused((Elm_Gen_Item *)it); 5654 _elm_genlist_item_focused((Elm_Gen_Item *)it);
5655
5656 _elm_widget_item_highlight_in_theme(obj, (Elm_Object_Item *)it);
5657 _elm_widget_highlight_in_theme_update(obj);
5658 _elm_widget_focus_highlight_start(obj); 5658 _elm_widget_focus_highlight_start(obj);
5659 } 5659 }
5660 } 5660 }
diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index 5ad643a36..a4e257f25 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.c
@@ -820,6 +820,9 @@ _item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused)
820 if (it) 820 if (it)
821 _elm_toolbar_item_unfocused((Elm_Toolbar_Item *)it); 821 _elm_toolbar_item_unfocused((Elm_Toolbar_Item *)it);
822 } 822 }
823
824 _elm_widget_item_highlight_in_theme(obj, (Elm_Object_Item *)it);
825 _elm_widget_highlight_in_theme_update(obj);
823 _elm_widget_focus_highlight_start(obj); 826 _elm_widget_focus_highlight_start(obj);
824} 827}
825 828
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index 47f185550..57f05743f 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -1387,6 +1387,18 @@ _elm_widget_highlight_in_theme_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *s
1387 /* FIXME: if focused, it should switch from one mode to the other */ 1387 /* FIXME: if focused, it should switch from one mode to the other */
1388} 1388}
1389 1389
1390void
1391_elm_widget_highlight_in_theme_update(Eo *obj)
1392{
1393 Evas_Object *top = elm_widget_top_get(obj);
1394
1395 if (top && eo_isa(top, ELM_OBJ_WIN_CLASS))
1396 {
1397 _elm_win_focus_highlight_in_theme_update(
1398 top, elm_widget_highlight_in_theme_get(obj));
1399 }
1400}
1401
1390EOLIAN static Eina_Bool 1402EOLIAN static Eina_Bool
1391_elm_widget_highlight_in_theme_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) 1403_elm_widget_highlight_in_theme_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
1392{ 1404{
diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h
index cdca30808..808b6eda6 100644
--- a/src/lib/elm_widget.h
+++ b/src/lib/elm_widget.h
@@ -521,7 +521,9 @@ void _elm_access_widget_item_access_order_set(Elm_Widget_Item *
521const Eina_List *_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item); 521const Eina_List *_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item);
522void _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item); 522void _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item);
523void _elm_widget_focus_highlight_start(const Evas_Object *obj); 523void _elm_widget_focus_highlight_start(const Evas_Object *obj);
524void _elm_widget_highlight_in_theme_update(Eo *obj);
524void _elm_win_focus_highlight_start(Evas_Object *obj); 525void _elm_win_focus_highlight_start(Evas_Object *obj);
526void _elm_win_focus_highlight_in_theme_update(Evas_Object *obj, Eina_Bool in_theme);
525 527
526EAPI void _elm_access_clear(Elm_Access_Info *ac); 528EAPI void _elm_access_clear(Elm_Access_Info *ac);
527EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text); 529EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text);
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index aa80b2b93..5976315c7 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -4745,6 +4745,13 @@ _elm_win_window_id_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
4745} 4745}
4746 4746
4747void 4747void
4748_elm_win_focus_highlight_in_theme_update(Evas_Object *obj, Eina_Bool in_theme)
4749{
4750 ELM_WIN_DATA_GET(obj, sd);
4751 sd->focus_highlight.cur.in_theme = !!in_theme;
4752}
4753
4754void
4748_elm_win_focus_highlight_start(Evas_Object *obj) 4755_elm_win_focus_highlight_start(Evas_Object *obj)
4749{ 4756{
4750 ELM_WIN_DATA_GET(obj, sd); 4757 ELM_WIN_DATA_GET(obj, sd);