summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2016-01-24 14:35:49 +0100
committerDave Andreoli <dave@gurumeditation.it>2016-01-24 14:35:49 +0100
commit7072fe56c4ca386e6d68e65a1d6ee454362d76af (patch)
treeeb11d3468da26107cf8b3fa88b20f49a202ff8ce /src
parente0b40113b43569da26c8a218153059a5e850332e (diff)
Add a test to reveal a focus bug in Genlist/Gengrid
To reproduce: * elm_test -to "GenGrid Focus" * turn on the "Focus Highlight" checkbox * double-click an item to show a popup that should have the focus As you can see the mouse-up event on the gengrid item steal the focus from the popup. When, instead, the item is activated with the keyboard the popup correctly keep the focus. I have this problem in both genlist and gengrid, so probably the error is not in the gengrid code, but somewhere else that I cannot find. ...any help appreciated
Diffstat (limited to 'src')
-rw-r--r--src/bin/test_gengrid.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/bin/test_gengrid.c b/src/bin/test_gengrid.c
index bd74e5b8d..18ab97c27 100644
--- a/src/bin/test_gengrid.c
+++ b/src/bin/test_gengrid.c
@@ -1568,6 +1568,8 @@ test_gengrid_speed(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
1568 evas_object_show(win); 1568 evas_object_show(win);
1569} 1569}
1570 1570
1571
1572/*** Gengrid Focus *********************************************************/
1571static void 1573static void
1572_gengrid_focus_item_cb(void *data, Evas_Object *obj EINA_UNUSED, 1574_gengrid_focus_item_cb(void *data, Evas_Object *obj EINA_UNUSED,
1573 void *event_info) 1575 void *event_info)
@@ -1576,6 +1578,31 @@ _gengrid_focus_item_cb(void *data, Evas_Object *obj EINA_UNUSED,
1576} 1578}
1577 1579
1578static void 1580static void
1581_gengrid_focus_popup_close_cb(void *data, Evas_Object *obj EINA_UNUSED,
1582 void *event_info EINA_UNUSED)
1583{
1584 evas_object_del(data);
1585}
1586
1587static void
1588_gengrid_focus_item_activated_cb(void *data, Evas_Object *obj EINA_UNUSED,
1589 void *event_info EINA_UNUSED)
1590{
1591 Evas_Object *popup, *btn;
1592
1593 popup = elm_popup_add(data);
1594 elm_object_text_set(popup, "This Popup must have the focus");
1595
1596 btn = elm_button_add(popup);
1597 elm_object_text_set(btn, "Close");
1598 elm_object_part_content_set(popup, "button1", btn);
1599 evas_object_smart_callback_add(btn, "clicked",
1600 _gengrid_focus_popup_close_cb, popup);
1601
1602 evas_object_show(popup);
1603}
1604
1605static void
1579_gengrid_focus_key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, 1606_gengrid_focus_key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
1580 Evas_Object *obj EINA_UNUSED, void *event_info) 1607 Evas_Object *obj EINA_UNUSED, void *event_info)
1581{ 1608{
@@ -1727,9 +1754,10 @@ test_gengrid_focus(void *data EINA_UNUSED,
1727 evas_object_smart_callback_add(gengrid, "item,unfocused", _gengrid_focus_item_cb, "item,unfocused"); 1754 evas_object_smart_callback_add(gengrid, "item,unfocused", _gengrid_focus_item_cb, "item,unfocused");
1728 evas_object_smart_callback_add(gengrid, "selected", _gengrid_focus_item_cb, "selected"); 1755 evas_object_smart_callback_add(gengrid, "selected", _gengrid_focus_item_cb, "selected");
1729 evas_object_smart_callback_add(gengrid, "unselected", _gengrid_focus_item_cb, "unselected"); 1756 evas_object_smart_callback_add(gengrid, "unselected", _gengrid_focus_item_cb, "unselected");
1730 evas_object_smart_callback_add(gengrid, "activated", _gengrid_focus_item_cb, "activated");
1731 evas_object_smart_callback_add(gengrid, "highlighted", _gengrid_focus_item_cb, "highlighted"); 1757 evas_object_smart_callback_add(gengrid, "highlighted", _gengrid_focus_item_cb, "highlighted");
1732 evas_object_smart_callback_add(gengrid, "unhighlighted", _gengrid_focus_item_cb, "unhighlighted"); 1758 evas_object_smart_callback_add(gengrid, "unhighlighted", _gengrid_focus_item_cb, "unhighlighted");
1759 evas_object_smart_callback_add(gengrid, "activated", _gengrid_focus_item_cb, "activated");
1760 evas_object_smart_callback_add(gengrid, "activated", _gengrid_focus_item_activated_cb, win);
1733 evas_object_event_callback_add(gengrid, EVAS_CALLBACK_KEY_DOWN, _gengrid_focus_key_down_cb, NULL); 1761 evas_object_event_callback_add(gengrid, EVAS_CALLBACK_KEY_DOWN, _gengrid_focus_key_down_cb, NULL);
1734 1762
1735 gengrid2 = elm_gengrid_add(in_bx); 1763 gengrid2 = elm_gengrid_add(in_bx);
@@ -1745,9 +1773,10 @@ test_gengrid_focus(void *data EINA_UNUSED,
1745 evas_object_smart_callback_add(gengrid2, "item,unfocused", _gengrid_focus_item_cb, "item,unfocused"); 1773 evas_object_smart_callback_add(gengrid2, "item,unfocused", _gengrid_focus_item_cb, "item,unfocused");
1746 evas_object_smart_callback_add(gengrid2, "selected", _gengrid_focus_item_cb, "selected"); 1774 evas_object_smart_callback_add(gengrid2, "selected", _gengrid_focus_item_cb, "selected");
1747 evas_object_smart_callback_add(gengrid2, "unselected", _gengrid_focus_item_cb, "unselected"); 1775 evas_object_smart_callback_add(gengrid2, "unselected", _gengrid_focus_item_cb, "unselected");
1748 evas_object_smart_callback_add(gengrid2, "activated", _gengrid_focus_item_cb, "activated");
1749 evas_object_smart_callback_add(gengrid2, "highlighted", _gengrid_focus_item_cb, "highlighted"); 1776 evas_object_smart_callback_add(gengrid2, "highlighted", _gengrid_focus_item_cb, "highlighted");
1750 evas_object_smart_callback_add(gengrid2, "unhighlighted", _gengrid_focus_item_cb, "unhighlighted"); 1777 evas_object_smart_callback_add(gengrid2, "unhighlighted", _gengrid_focus_item_cb, "unhighlighted");
1778 evas_object_smart_callback_add(gengrid2, "activated", _gengrid_focus_item_cb, "activated");
1779 evas_object_smart_callback_add(gengrid2, "activated", _gengrid_focus_item_activated_cb, win);
1751 evas_object_event_callback_add(gengrid2, EVAS_CALLBACK_KEY_DOWN, _gengrid_focus_key_down_cb, NULL); 1780 evas_object_event_callback_add(gengrid2, EVAS_CALLBACK_KEY_DOWN, _gengrid_focus_key_down_cb, NULL);
1752 1781
1753 btn = elm_button_add(bx); 1782 btn = elm_button_add(bx);