summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-03-23 23:29:16 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-03-23 23:29:16 +0900
commit90e094d5d69c32ad23acb995bceff41123cd8dcb (patch)
tree276a11aa16bba97f5accd67498a14ef82bfea672
parentef1f2e3c0aba8f1cdfaf7d1afb1bbec6dac0d75a (diff)
list/genlist/gengrid: Internal refactoring of item_focused/unfocused
codes. - Added a check for focus highlight enable status before calling focus signal to edje. - Used obj instead of WIDGET(it) because that is used many times.
-rw-r--r--src/lib/elm_gengrid.c18
-rw-r--r--src/lib/elm_genlist.c16
-rw-r--r--src/lib/elm_list.c14
3 files changed, 26 insertions, 22 deletions
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 3895be1bd..deffc7351 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -1505,7 +1505,7 @@ static void
1505_elm_gengrid_item_focused(Elm_Gen_Item *it) 1505_elm_gengrid_item_focused(Elm_Gen_Item *it)
1506{ 1506{
1507 Evas_Object *obj = WIDGET(it); 1507 Evas_Object *obj = WIDGET(it);
1508 Elm_Gengrid_Smart_Data *sd = GG_IT(it)->wsd; 1508 ELM_GENGRID_DATA_GET(obj, sd);
1509 const char *focus_raise; 1509 const char *focus_raise;
1510 1510
1511 if (it->generation < sd->generation) 1511 if (it->generation < sd->generation)
@@ -1530,14 +1530,14 @@ _elm_gengrid_item_focused(Elm_Gen_Item *it)
1530 focus_raise = edje_object_data_get(VIEW(it), "focusraise"); 1530 focus_raise = edje_object_data_get(VIEW(it), "focusraise");
1531 if ((focus_raise) && (!strcmp(focus_raise, "on"))) 1531 if ((focus_raise) && (!strcmp(focus_raise, "on")))
1532 evas_object_raise(VIEW(it)); 1532 evas_object_raise(VIEW(it));
1533 evas_object_smart_callback_call 1533 evas_object_smart_callback_call(obj, SIG_ITEM_FOCUSED, it);
1534 (WIDGET(it), SIG_ITEM_FOCUSED, it);
1535} 1534}
1536 1535
1537static void 1536static void
1538_elm_gengrid_item_unfocused(Elm_Gen_Item *it) 1537_elm_gengrid_item_unfocused(Elm_Gen_Item *it)
1539{ 1538{
1540 Elm_Gengrid_Smart_Data *sd = GG_IT(it)->wsd; 1539 Evas_Object *obj = WIDGET(it);
1540 ELM_GENGRID_DATA_GET(obj, sd);
1541 1541
1542 if (it->generation < sd->generation) 1542 if (it->generation < sd->generation)
1543 return; 1543 return;
@@ -1552,12 +1552,14 @@ _elm_gengrid_item_unfocused(Elm_Gen_Item *it)
1552 1552
1553 sd->prev_focused_item = (Elm_Object_Item *)it; 1553 sd->prev_focused_item = (Elm_Object_Item *)it;
1554 1554
1555 edje_object_signal_emit 1555 if (elm_widget_focus_highlight_enabled_get(obj))
1556 (VIEW(sd->focused_item), "elm,state,unfocused", "elm"); 1556 {
1557 edje_object_signal_emit
1558 (VIEW(sd->focused_item), "elm,state,unfocused", "elm");
1559 }
1557 1560
1558 sd->focused_item = NULL; 1561 sd->focused_item = NULL;
1559 evas_object_smart_callback_call 1562 evas_object_smart_callback_call(obj, SIG_ITEM_UNFOCUSED, it);
1560 (WIDGET(it), SIG_ITEM_UNFOCUSED, it);
1561} 1563}
1562 1564
1563/* NOTE: this code will be used later when the item selection on key press 1565/* NOTE: this code will be used later when the item selection on key press
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 4158f593e..567c586c1 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2440,7 +2440,7 @@ static void
2440_elm_genlist_item_focused(Elm_Gen_Item *it) 2440_elm_genlist_item_focused(Elm_Gen_Item *it)
2441{ 2441{
2442 Evas_Object *obj = WIDGET(it); 2442 Evas_Object *obj = WIDGET(it);
2443 Elm_Genlist_Smart_Data *sd = GL_IT(it)->wsd; 2443 ELM_GENLIST_DATA_GET(obj, sd);
2444 const char *focus_raise; 2444 const char *focus_raise;
2445 2445
2446 if (it->generation < sd->generation) 2446 if (it->generation < sd->generation)
@@ -2464,14 +2464,14 @@ _elm_genlist_item_focused(Elm_Gen_Item *it)
2464 focus_raise = edje_object_data_get(VIEW(it), "focusraise"); 2464 focus_raise = edje_object_data_get(VIEW(it), "focusraise");
2465 if ((focus_raise) && (!strcmp(focus_raise, "on"))) 2465 if ((focus_raise) && (!strcmp(focus_raise, "on")))
2466 evas_object_raise(VIEW(it)); 2466 evas_object_raise(VIEW(it));
2467 evas_object_smart_callback_call 2467 evas_object_smart_callback_call(obj, SIG_ITEM_FOCUSED, it);
2468 (WIDGET(it), SIG_ITEM_FOCUSED, it);
2469} 2468}
2470 2469
2471static void 2470static void
2472_elm_genlist_item_unfocused(Elm_Gen_Item *it) 2471_elm_genlist_item_unfocused(Elm_Gen_Item *it)
2473{ 2472{
2474 Elm_Genlist_Smart_Data *sd = GL_IT(it)->wsd; 2473 Evas_Object *obj = WIDGET(it);
2474 ELM_GENLIST_DATA_GET(obj, sd);
2475 2475
2476 if (it->generation < sd->generation) 2476 if (it->generation < sd->generation)
2477 return; 2477 return;
@@ -2486,12 +2486,12 @@ _elm_genlist_item_unfocused(Elm_Gen_Item *it)
2486 2486
2487 sd->prev_focused_item = (Elm_Object_Item *)it; 2487 sd->prev_focused_item = (Elm_Object_Item *)it;
2488 2488
2489 edje_object_signal_emit 2489 if (elm_widget_focus_highlight_enabled_get(obj))
2490 (VIEW(sd->focused_item), "elm,state,unfocused", "elm"); 2490 edje_object_signal_emit
2491 (VIEW(sd->focused_item), "elm,state,unfocused", "elm");
2491 2492
2492 sd->focused_item = NULL; 2493 sd->focused_item = NULL;
2493 evas_object_smart_callback_call 2494 evas_object_smart_callback_call(obj, SIG_ITEM_UNFOCUSED, it);
2494 (WIDGET(it), SIG_ITEM_UNFOCUSED, it);
2495} 2495}
2496 2496
2497/* NOTE: this code will be used later when the item selection on key press 2497/* NOTE: this code will be used later when the item selection on key press
diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index a89b1545d..447ce9d7f 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -1036,7 +1036,8 @@ _elm_list_item_focused(Elm_List_Item *it)
1036static void 1036static void
1037_elm_list_item_unfocused(Elm_List_Item *it) 1037_elm_list_item_unfocused(Elm_List_Item *it)
1038{ 1038{
1039 ELM_LIST_DATA_GET(WIDGET(it), sd); 1039 Evas_Object *obj = WIDGET(it);
1040 ELM_LIST_DATA_GET(obj, sd);
1040 1041
1041 if ((!sd) || (!sd->focused_item) || 1042 if ((!sd) || (!sd->focused_item) ||
1042 (it != (Elm_List_Item *)sd->focused_item)) 1043 (it != (Elm_List_Item *)sd->focused_item))
@@ -1046,13 +1047,14 @@ _elm_list_item_unfocused(Elm_List_Item *it)
1046 if (sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) 1047 if (sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
1047 return; 1048 return;
1048 1049
1049 if (elm_widget_focus_highlight_enabled_get(WIDGET(sd->focused_item))) 1050 if (elm_widget_focus_highlight_enabled_get(obj))
1050 edje_object_signal_emit 1051 {
1051 (VIEW(sd->focused_item), "elm,state,unfocused", "elm"); 1052 edje_object_signal_emit
1053 (VIEW(sd->focused_item), "elm,state,unfocused", "elm");
1054 }
1052 1055
1053 sd->focused_item = NULL; 1056 sd->focused_item = NULL;
1054 evas_object_smart_callback_call 1057 evas_object_smart_callback_call(obj, SIG_ITEM_UNFOCUSED, it);
1055 (WIDGET(it), SIG_ITEM_UNFOCUSED, it);
1056} 1058}
1057 1059
1058/* 1060/*