summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2014-07-22 15:11:17 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-07-22 15:11:18 +0900
commit658138ff2bd7b7a6b3147105639789809ea8a71b (patch)
tree4e972dd8befe48fe5967e93730c6a5e58497793b
parentcfdaffb8cf65ab0a934de2efb513e66989b4bad6 (diff)
genlist : Add item looping on flag.
Summary: When item looping feature is on and press up or down key, screen seems to be frozen. Test Plan: elementary_test -to "genlist focus" -> click item looing enable -> move list up and down Reviewers: anand.km, seoz, woohyun Subscribers: singh.amitesh Differential Revision: https://phab.enlightenment.org/D1193
-rw-r--r--src/lib/elm_genlist.c22
-rw-r--r--src/lib/elm_list.c40
-rw-r--r--src/lib/elm_widget_genlist.h1
-rw-r--r--src/lib/elm_widget_list.h1
4 files changed, 56 insertions, 8 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 7857d37d0..e874dc7cd 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2636,14 +2636,20 @@ _key_action_move_dir(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool multi)
2636 2636
2637 focus_only = _elm_config->item_select_on_focus_disable && elm_widget_focus_highlight_enabled_get(obj); 2637 focus_only = _elm_config->item_select_on_focus_disable && elm_widget_focus_highlight_enabled_get(obj);
2638 // handle item loop feature 2638 // handle item loop feature
2639 if (sd->item_loop_enable) 2639 if (sd->item_loop_enable && !sd->item_looping_on)
2640 { 2640 {
2641 if (min > v) 2641 if (min > v)
2642 { 2642 {
2643 if (dir == ELM_FOCUS_UP) 2643 if (dir == ELM_FOCUS_UP)
2644 elm_layout_signal_emit(obj, "elm,action,looping,up", "elm"); 2644 {
2645 elm_layout_signal_emit(obj, "elm,action,looping,up", "elm");
2646 sd->item_looping_on = EINA_TRUE;
2647 }
2645 else if (dir == ELM_FOCUS_DOWN) 2648 else if (dir == ELM_FOCUS_DOWN)
2646 elm_layout_signal_emit(obj, "elm,action,looping,down", "elm"); 2649 {
2650 elm_layout_signal_emit(obj, "elm,action,looping,down", "elm");
2651 sd->item_looping_on = EINA_TRUE;
2652 }
2647 } 2653 }
2648 else 2654 else
2649 { 2655 {
@@ -2659,6 +2665,8 @@ _key_action_move_dir(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool multi)
2659 } 2665 }
2660 return EINA_TRUE; 2666 return EINA_TRUE;
2661 } 2667 }
2668 else if (sd->item_looping_on)
2669 return EINA_TRUE;
2662 2670
2663 return EINA_FALSE; 2671 return EINA_FALSE;
2664} 2672}
@@ -5185,12 +5193,16 @@ _elm_genlist_looping_up_cb(void *data,
5185 const char *source EINA_UNUSED) 5193 const char *source EINA_UNUSED)
5186{ 5194{
5187 Evas_Object *genlist = data; 5195 Evas_Object *genlist = data;
5196
5197 ELM_GENLIST_DATA_GET(genlist, sd);
5198
5188 Elm_Object_Item *it = elm_genlist_last_item_get(genlist); 5199 Elm_Object_Item *it = elm_genlist_last_item_get(genlist);
5189 if (!_elm_config->item_select_on_focus_disable) 5200 if (!_elm_config->item_select_on_focus_disable)
5190 elm_genlist_item_selected_set(it, EINA_TRUE); 5201 elm_genlist_item_selected_set(it, EINA_TRUE);
5191 else 5202 else
5192 elm_object_item_focus_set(it, EINA_TRUE); 5203 elm_object_item_focus_set(it, EINA_TRUE);
5193 elm_layout_signal_emit(genlist, "elm,action,looping,up,end", "elm"); 5204 elm_layout_signal_emit(genlist, "elm,action,looping,up,end", "elm");
5205 sd->item_looping_on = EINA_FALSE;
5194} 5206}
5195 5207
5196static void 5208static void
@@ -5200,12 +5212,16 @@ _elm_genlist_looping_down_cb(void *data,
5200 const char *source EINA_UNUSED) 5212 const char *source EINA_UNUSED)
5201{ 5213{
5202 Evas_Object *genlist = data; 5214 Evas_Object *genlist = data;
5215
5216 ELM_GENLIST_DATA_GET(genlist, sd);
5217
5203 Elm_Object_Item *it = elm_genlist_first_item_get(genlist); 5218 Elm_Object_Item *it = elm_genlist_first_item_get(genlist);
5204 if (!_elm_config->item_select_on_focus_disable) 5219 if (!_elm_config->item_select_on_focus_disable)
5205 elm_genlist_item_selected_set(it, EINA_TRUE); 5220 elm_genlist_item_selected_set(it, EINA_TRUE);
5206 else 5221 else
5207 elm_object_item_focus_set(it, EINA_TRUE); 5222 elm_object_item_focus_set(it, EINA_TRUE);
5208 elm_layout_signal_emit(genlist, "elm,action,looping,down,end", "elm"); 5223 elm_layout_signal_emit(genlist, "elm,action,looping,down,end", "elm");
5224 sd->item_looping_on = EINA_FALSE;
5209} 5225}
5210 5226
5211 5227
diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index fa9c03acd..bf20b911f 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -392,18 +392,30 @@ _elm_list_elm_widget_event_direction(Evas_Object *obj, Elm_Focus_Direction dir,
392 return EINA_TRUE; 392 return EINA_TRUE;
393 393
394 // handle item loop feature 394 // handle item loop feature
395 if (sd->item_loop_enable) 395 if (sd->item_loop_enable && !sd->item_looping_on)
396 { 396 {
397 if (min > v) 397 if (min > v)
398 { 398 {
399 if (dir == ELM_FOCUS_LEFT) 399 if (dir == ELM_FOCUS_LEFT)
400 elm_layout_signal_emit(obj, "elm,action,looping,left", "elm"); 400 {
401 elm_layout_signal_emit(obj, "elm,action,looping,left", "elm");
402 sd->item_looping_on = EINA_TRUE;
403 }
401 else if (dir == ELM_FOCUS_RIGHT) 404 else if (dir == ELM_FOCUS_RIGHT)
402 elm_layout_signal_emit(obj, "elm,action,looping,right", "elm"); 405 {
406 elm_layout_signal_emit(obj, "elm,action,looping,right", "elm");
407 sd->item_looping_on = EINA_TRUE;
408 }
403 else if (dir == ELM_FOCUS_UP) 409 else if (dir == ELM_FOCUS_UP)
404 elm_layout_signal_emit(obj, "elm,action,looping,up", "elm"); 410 {
411 elm_layout_signal_emit(obj, "elm,action,looping,up", "elm");
412 sd->item_looping_on = EINA_TRUE;
413 }
405 else if (dir == ELM_FOCUS_DOWN) 414 else if (dir == ELM_FOCUS_DOWN)
406 elm_layout_signal_emit(obj, "elm,action,looping,down", "elm"); 415 {
416 elm_layout_signal_emit(obj, "elm,action,looping,down", "elm");
417 sd->item_looping_on = EINA_TRUE;
418 }
407 } 419 }
408 else 420 else
409 { 421 {
@@ -419,6 +431,8 @@ _elm_list_elm_widget_event_direction(Evas_Object *obj, Elm_Focus_Direction dir,
419 } 431 }
420 return EINA_TRUE; 432 return EINA_TRUE;
421 } 433 }
434 else if (sd->item_looping_on)
435 return EINA_TRUE;
422 436
423 return EINA_FALSE; 437 return EINA_FALSE;
424} 438}
@@ -1719,12 +1733,16 @@ _elm_list_looping_left_cb(void *data,
1719 const char *source EINA_UNUSED) 1733 const char *source EINA_UNUSED)
1720{ 1734{
1721 Evas_Object *list = data; 1735 Evas_Object *list = data;
1736
1737 ELM_LIST_DATA_GET(list, sd);
1738
1722 Elm_List_Item *it = (Elm_List_Item *)elm_list_last_item_get(list); 1739 Elm_List_Item *it = (Elm_List_Item *)elm_list_last_item_get(list);
1723 if (!_elm_config->item_select_on_focus_disable) 1740 if (!_elm_config->item_select_on_focus_disable)
1724 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE); 1741 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
1725 else 1742 else
1726 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE); 1743 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
1727 elm_layout_signal_emit(list, "elm,action,looping,left,end", "elm"); 1744 elm_layout_signal_emit(list, "elm,action,looping,left,end", "elm");
1745 sd->item_looping_on = EINA_FALSE;
1728} 1746}
1729 1747
1730static void 1748static void
@@ -1734,12 +1752,16 @@ _elm_list_looping_right_cb(void *data,
1734 const char *source EINA_UNUSED) 1752 const char *source EINA_UNUSED)
1735{ 1753{
1736 Evas_Object *list = data; 1754 Evas_Object *list = data;
1755
1756 ELM_LIST_DATA_GET(list, sd);
1757
1737 Elm_List_Item *it = (Elm_List_Item *)elm_list_first_item_get(list); 1758 Elm_List_Item *it = (Elm_List_Item *)elm_list_first_item_get(list);
1738 if (!_elm_config->item_select_on_focus_disable) 1759 if (!_elm_config->item_select_on_focus_disable)
1739 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE); 1760 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
1740 else 1761 else
1741 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE); 1762 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
1742 elm_layout_signal_emit(list, "elm,action,looping,right,end", "elm"); 1763 elm_layout_signal_emit(list, "elm,action,looping,right,end", "elm");
1764 sd->item_looping_on = EINA_FALSE;
1743} 1765}
1744 1766
1745static void 1767static void
@@ -1749,12 +1771,16 @@ _elm_list_looping_up_cb(void *data,
1749 const char *source EINA_UNUSED) 1771 const char *source EINA_UNUSED)
1750{ 1772{
1751 Evas_Object *list = data; 1773 Evas_Object *list = data;
1774
1775 ELM_LIST_DATA_GET(list, sd);
1776
1752 Elm_List_Item *it = (Elm_List_Item *)elm_list_last_item_get(list); 1777 Elm_List_Item *it = (Elm_List_Item *)elm_list_last_item_get(list);
1753 if (!_elm_config->item_select_on_focus_disable) 1778 if (!_elm_config->item_select_on_focus_disable)
1754 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE); 1779 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
1755 else 1780 else
1756 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE); 1781 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
1757 elm_layout_signal_emit(list, "elm,action,looping,up,end", "elm"); 1782 elm_layout_signal_emit(list, "elm,action,looping,up,end", "elm");
1783 sd->item_looping_on = EINA_FALSE;
1758} 1784}
1759 1785
1760static void 1786static void
@@ -1764,12 +1790,16 @@ _elm_list_looping_down_cb(void *data,
1764 const char *source EINA_UNUSED) 1790 const char *source EINA_UNUSED)
1765{ 1791{
1766 Evas_Object *list = data; 1792 Evas_Object *list = data;
1793
1794 ELM_LIST_DATA_GET(list, sd);
1795
1767 Elm_List_Item *it = (Elm_List_Item *)elm_list_first_item_get(list); 1796 Elm_List_Item *it = (Elm_List_Item *)elm_list_first_item_get(list);
1768 if (!_elm_config->item_select_on_focus_disable) 1797 if (!_elm_config->item_select_on_focus_disable)
1769 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE); 1798 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
1770 else 1799 else
1771 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE); 1800 elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
1772 elm_layout_signal_emit(list, "elm,action,looping,down,end", "elm"); 1801 elm_layout_signal_emit(list, "elm,action,looping,down,end", "elm");
1802 sd->item_looping_on = EINA_FALSE;
1773} 1803}
1774 1804
1775static void 1805static void
diff --git a/src/lib/elm_widget_genlist.h b/src/lib/elm_widget_genlist.h
index ab0945bbf..098914ee1 100644
--- a/src/lib/elm_widget_genlist.h
+++ b/src/lib/elm_widget_genlist.h
@@ -185,6 +185,7 @@ struct _Elm_Genlist_Data
185 Eina_Bool swipe : 1; 185 Eina_Bool swipe : 1;
186 /**< value whether item loop feature is enabled or not. */ 186 /**< value whether item loop feature is enabled or not. */
187 Eina_Bool item_loop_enable : 1; 187 Eina_Bool item_loop_enable : 1;
188 Eina_Bool item_looping_on : 1;
188}; 189};
189 190
190typedef struct _Item_Block Item_Block; 191typedef struct _Item_Block Item_Block;
diff --git a/src/lib/elm_widget_list.h b/src/lib/elm_widget_list.h
index 0ee0d8791..51d14e68f 100644
--- a/src/lib/elm_widget_list.h
+++ b/src/lib/elm_widget_list.h
@@ -54,6 +54,7 @@ struct _Elm_List_Data
54 Eina_Bool delete_me : 1; 54 Eina_Bool delete_me : 1;
55 Eina_Bool mouse_down : 1; /**< a flag that mouse is down on the list at the moment. this flag is set to true on mouse and reset to false on mouse up */ 55 Eina_Bool mouse_down : 1; /**< a flag that mouse is down on the list at the moment. this flag is set to true on mouse and reset to false on mouse up */
56 Eina_Bool item_loop_enable : 1; /**< value whether item loop feature is enabled or not. */ 56 Eina_Bool item_loop_enable : 1; /**< value whether item loop feature is enabled or not. */
57 Eina_Bool item_looping_on : 1;
57}; 58};
58 59
59typedef struct _Elm_List_Item Elm_List_Item; 60typedef struct _Elm_List_Item Elm_List_Item;