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)
downloadelementary-ad089ad6fea5b5be94258bdaaeff4c17a2a6b38e.tar.gz
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)
if (it->mouse_cursor)
elm_widget_item_cursor_set(it, it->mouse_cursor);
- _elm_widget_item_highlight_in_theme(WIDGET(it), (Elm_Object_Item *)it);
-
it->realized = EINA_TRUE;
it->want_unrealize = EINA_FALSE;
}
@@ -2917,6 +2915,9 @@ _item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused)
if (sd->focused_item)
_elm_gengrid_item_unfocused((Elm_Gen_Item *)sd->focused_item);
_elm_gengrid_item_focused((Elm_Gen_Item *)it);
+
+ _elm_widget_item_highlight_in_theme(obj, (Elm_Object_Item *)it);
+ _elm_widget_highlight_in_theme_update(obj);
_elm_widget_focus_highlight_start(obj);
}
}
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,
if (it->decorate_it_set) _decorate_item_set(it);
- if (!calc)
- _elm_widget_item_highlight_in_theme(WIDGET(it), (Elm_Object_Item *)it);
-
edje_object_message_signal_process(VIEW(it));
}
@@ -5655,6 +5652,9 @@ _item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused)
if (sd->focused_item)
_elm_genlist_item_unfocused((Elm_Gen_Item *)sd->focused_item);
_elm_genlist_item_focused((Elm_Gen_Item *)it);
+
+ _elm_widget_item_highlight_in_theme(obj, (Elm_Object_Item *)it);
+ _elm_widget_highlight_in_theme_update(obj);
_elm_widget_focus_highlight_start(obj);
}
}
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)
if (it)
_elm_toolbar_item_unfocused((Elm_Toolbar_Item *)it);
}
+
+ _elm_widget_item_highlight_in_theme(obj, (Elm_Object_Item *)it);
+ _elm_widget_highlight_in_theme_update(obj);
_elm_widget_focus_highlight_start(obj);
}
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
/* FIXME: if focused, it should switch from one mode to the other */
}
+void
+_elm_widget_highlight_in_theme_update(Eo *obj)
+{
+ Evas_Object *top = elm_widget_top_get(obj);
+
+ if (top && eo_isa(top, ELM_OBJ_WIN_CLASS))
+ {
+ _elm_win_focus_highlight_in_theme_update(
+ top, elm_widget_highlight_in_theme_get(obj));
+ }
+}
+
EOLIAN static Eina_Bool
_elm_widget_highlight_in_theme_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
{
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 *
const Eina_List *_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item);
void _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item);
void _elm_widget_focus_highlight_start(const Evas_Object *obj);
+void _elm_widget_highlight_in_theme_update(Eo *obj);
void _elm_win_focus_highlight_start(Evas_Object *obj);
+void _elm_win_focus_highlight_in_theme_update(Evas_Object *obj, Eina_Bool in_theme);
EAPI void _elm_access_clear(Elm_Access_Info *ac);
EAPI 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)
}
void
+_elm_win_focus_highlight_in_theme_update(Evas_Object *obj, Eina_Bool in_theme)
+{
+ ELM_WIN_DATA_GET(obj, sd);
+ sd->focus_highlight.cur.in_theme = !!in_theme;
+}
+
+void
_elm_win_focus_highlight_start(Evas_Object *obj)
{
ELM_WIN_DATA_GET(obj, sd);