I attached a patch file again.
Thanks.
Daniel Juyung Seo.
-----Original Message-----
From: Daniel Juyung Seo [mailto:seojuyu...@gmail.com]
Sent: Wednesday, December 01, 2010 3:35 AM
To: enlightenment-devel@lists.sourceforge.net
Subject: [E-devel] [Patch] elm_genlist and elm_list patch.
Dear all, I have a patch for some issues.
Anybody can review this patch and apply this to upstream?
[Genlist]
1. fixed elm_genlist_item_display_only_set() API bug.
"elm,state,selected" signal should not be emitted when display_only is
set.
display_only was not set properly when it->block did not exist.
2. Add a macro for SWIPE_TIMEOUT
Instead of using constant "0.4" for swipe timer in the middle of code, I
added a macro SWIPE_TIMEOUT.
3. Indentation and space fix.
I fixed indentations for item cache and some other lines.
I removed some unnecessary spaces.
[List]
1. Add macros for SWIPE_TIMEOUT and LONGPRESS_TIMEOUT
Instead of using constants in the middle of code, I added macros.
Thanks.
Daniel Juyung Seo.
Index: elm_genlist.c
===================================================================
--- elm_genlist.c (revision 55090)
+++ elm_genlist.c (working copy)
@@ -3,6 +3,7 @@
#include "elm_priv.h"
#define SWIPE_MOVES 12
+#define SWIPE_TIMEOUT 0.4
#define MAX_ITEMS_PER_BLOCK 32
#define LONGPRESS_TIMEOUT 1.0
@@ -776,7 +777,7 @@ static void
_item_hilight(Elm_Genlist_Item *it)
{
const char *selectraise;
- if ((it->wd->no_select) || (it->delete_me) || (it->hilighted)) return;
+ if ((it->wd->no_select) || (it->delete_me) || (it->hilighted) ||
(it->display_only)) return;
edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
selectraise = edje_object_data_get(it->base.view, "selectraise");
if ((selectraise) && (!strcmp(selectraise, "on")))
@@ -981,7 +982,7 @@ _mouse_move(void *data, Evas *evas __UNUSED__, Eva
return;
}
if (!it->display_only)
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+ elm_coords_finger_size_adjust(1, &minw, 1, &minh);
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
x = ev->cur.canvas.x - x;
y = ev->cur.canvas.y - y;
@@ -1104,7 +1105,7 @@ _mouse_down(void *data, Evas *evas __UNUSED__, Eva
evas_object_smart_callback_call(it->base.widget, "clicked", it);
if (it->long_timer) ecore_timer_del(it->long_timer);
if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
- it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
+ it->swipe_timer = ecore_timer_add(SWIPE_TIMEOUT, _swipe_cancel, it);
if (it->realized)
it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
it);
else
@@ -1229,123 +1230,122 @@ _signal_contract(void *data, Evas_Object *obj __UN
evas_object_smart_callback_call(it->base.widget, "contract,request", it);
}
-
static void
_item_cache_clean(Widget_Data *wd)
{
- while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
- {
- Item_Cache *itc;
-
- itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
- wd->item_cache = eina_inlist_remove(wd->item_cache,
- wd->item_cache->last);
- wd->item_cache_count--;
- if (itc->spacer) evas_object_del(itc->spacer);
- if (itc->base_view) evas_object_del(itc->base_view);
- if (itc->item_style) eina_stringshare_del(itc->item_style);
- free(itc);
- }
+ while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
+ {
+ Item_Cache *itc;
+
+ itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
+ wd->item_cache = eina_inlist_remove(wd->item_cache,
+ wd->item_cache->last);
+ wd->item_cache_count--;
+ if (itc->spacer) evas_object_del(itc->spacer);
+ if (itc->base_view) evas_object_del(itc->base_view);
+ if (itc->item_style) eina_stringshare_del(itc->item_style);
+ free(itc);
+ }
}
static void
_item_cache_zero(Widget_Data *wd)
{
- int pmax = wd->item_cache_max;
- wd->item_cache_max = 0;
- _item_cache_clean(wd);
- wd->item_cache_max = pmax;
+ int pmax = wd->item_cache_max;
+ wd->item_cache_max = 0;
+ _item_cache_clean(wd);
+ wd->item_cache_max = pmax;
}
static void
_item_cache_add(Elm_Genlist_Item *it)
{
- Item_Cache *itc;
+ Item_Cache *itc;
- if (it->wd->item_cache_max <= 0)
- {
- evas_object_del(it->base.view);
- it->base.view = NULL;
- evas_object_del(it->spacer);
- it->spacer = NULL;
- return;
- }
-
- it->wd->item_cache_count++;
- itc = calloc(1, sizeof(Item_Cache));
- it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
EINA_INLIST_GET(itc));
- itc->spacer = it->spacer;
- it->spacer = NULL;
- itc->base_view = it->base.view;
- it->base.view = NULL;
- evas_object_hide(itc->base_view);
- evas_object_move(itc->base_view, -9999, -9999);
- itc->item_style = eina_stringshare_add(it->itc->item_style);
- if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
- itc->compress = (it->wd->compress);
- itc->odd = (it->order_num_in & 0x1);
- itc->selected = it->selected;
- itc->disabled = it->disabled;
- itc->expanded = it->expanded;
- if (it->long_timer)
- {
- ecore_timer_del(it->long_timer);
- it->long_timer = NULL;
- }
- if (it->swipe_timer)
- {
- ecore_timer_del(it->swipe_timer);
- it->swipe_timer = NULL;
- }
- // FIXME: other callbacks?
- edje_object_signal_callback_del_full(itc->base_view,
"elm,action,expand,toggle",
- "elm", _signal_expand_toggle, it);
- edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
"elm",
- _signal_expand, it);
- edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
- "elm", _signal_contract, it);
- evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
- _mouse_down, it);
- evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
- _mouse_up, it);
- evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
- _mouse_move, it);
- _item_cache_clean(it->wd);
+ if (it->wd->item_cache_max <= 0)
+ {
+ evas_object_del(it->base.view);
+ it->base.view = NULL;
+ evas_object_del(it->spacer);
+ it->spacer = NULL;
+ return;
+ }
+
+ it->wd->item_cache_count++;
+ itc = calloc(1, sizeof(Item_Cache));
+ it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
EINA_INLIST_GET(itc));
+ itc->spacer = it->spacer;
+ it->spacer = NULL;
+ itc->base_view = it->base.view;
+ it->base.view = NULL;
+ evas_object_hide(itc->base_view);
+ evas_object_move(itc->base_view, -9999, -9999);
+ itc->item_style = eina_stringshare_add(it->itc->item_style);
+ if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
+ itc->compress = (it->wd->compress);
+ itc->odd = (it->order_num_in & 0x1);
+ itc->selected = it->selected;
+ itc->disabled = it->disabled;
+ itc->expanded = it->expanded;
+ if (it->long_timer)
+ {
+ ecore_timer_del(it->long_timer);
+ it->long_timer = NULL;
+ }
+ if (it->swipe_timer)
+ {
+ ecore_timer_del(it->swipe_timer);
+ it->swipe_timer = NULL;
+ }
+ // FIXME: other callbacks?
+ edje_object_signal_callback_del_full(itc->base_view,
"elm,action,expand,toggle",
+ "elm", _signal_expand_toggle, it);
+ edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
"elm",
+ _signal_expand, it);
+ edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
+ "elm", _signal_contract, it);
+ evas_object_event_callback_del_full(itc->base_view,
EVAS_CALLBACK_MOUSE_DOWN,
+ _mouse_down, it);
+ evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
+ _mouse_up, it);
+ evas_object_event_callback_del_full(itc->base_view,
EVAS_CALLBACK_MOUSE_MOVE,
+ _mouse_move, it);
+ _item_cache_clean(it->wd);
}
static Item_Cache *
_item_cache_find(Elm_Genlist_Item *it)
{
- Item_Cache *itc;
- Eina_Bool tree = 0, odd;
-
- if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
- odd = (it->order_num_in & 0x1);
- EINA_INLIST_FOREACH(it->wd->item_cache, itc)
- {
- if ((itc->selected) || (itc->disabled) || (itc->expanded))
- continue;
- if ((itc->tree == tree) &&
- (itc->odd == odd) &&
- (itc->compress == it->wd->compress) &&
- (!strcmp(it->itc->item_style, itc->item_style)))
- {
- it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
- EINA_INLIST_GET(itc));
- it->wd->item_cache_count--;
- return itc;
- }
- }
- return NULL;
+ Item_Cache *itc;
+ Eina_Bool tree = 0, odd;
+
+ if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
+ odd = (it->order_num_in & 0x1);
+ EINA_INLIST_FOREACH(it->wd->item_cache, itc)
+ {
+ if ((itc->selected) || (itc->disabled) || (itc->expanded))
+ continue;
+ if ((itc->tree == tree) &&
+ (itc->odd == odd) &&
+ (itc->compress == it->wd->compress) &&
+ (!strcmp(it->itc->item_style, itc->item_style)))
+ {
+ it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
+ EINA_INLIST_GET(itc));
+ it->wd->item_cache_count--;
+ return itc;
+ }
+ }
+ return NULL;
}
static void
_item_cache_free(Item_Cache *itc)
{
- if (itc->spacer) evas_object_del(itc->spacer);
- if (itc->base_view) evas_object_del(itc->base_view);
- if (itc->item_style) eina_stringshare_del(itc->item_style);
- free(itc);
+ if (itc->spacer) evas_object_del(itc->spacer);
+ if (itc->base_view) evas_object_del(itc->base_view);
+ if (itc->item_style) eina_stringshare_del(itc->item_style);
+ free(itc);
}
static void
@@ -1357,7 +1357,7 @@ _item_realize(Elm_Genlist_Item *it, int in, int ca
char buf[1024];
int depth, tsize = 20;
Item_Cache *itc;
-
+
if ((it->realized) || (it->delete_me)) return;
it->order_num_in = in;
@@ -3279,13 +3279,12 @@ EAPI void
elm_genlist_item_display_only_set(Elm_Genlist_Item *it, Eina_Bool display_only)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- if (!it->block) return;
if (it->display_only == display_only) return;
if (it->delete_me) return;
it->display_only = display_only;
it->mincalcd = EINA_FALSE;
it->updateme = EINA_TRUE;
- it->block->updateme = EINA_TRUE;
+ if (it->block) it->block->updateme = EINA_TRUE;
if (it->wd->update_job) ecore_job_del(it->wd->update_job);
it->wd->update_job = ecore_job_add(_update_job, it->wd);
}
Index: elm_list.c
===================================================================
--- elm_list.c (revision 55090)
+++ elm_list.c (working copy)
@@ -2,6 +2,8 @@
#include "elm_priv.h"
#define SWIPE_MOVES 12
+#define SWIPE_TIMEOUT 0.4
+#define LONGPRESS_TIMEOUT 1.0
/**
* @defgroup List List
@@ -842,9 +844,9 @@ _mouse_down(void *data, Evas *evas __UNUSED__, Eva
_item_hilight(it);
wd->longpressed = EINA_FALSE;
if (it->long_timer) ecore_timer_del(it->long_timer);
- it->long_timer = ecore_timer_add(1.0, _long_press, it);
+ it->long_timer = ecore_timer_add(LONGPRESS_TIMEOUT, _long_press, it);
if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
- it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
+ it->swipe_timer = ecore_timer_add(SWIPE_TIMEOUT, _swipe_cancel, it);
/* Always call the callbacks last - the user may delete our context! */
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
evas_object_smart_callback_call(it->base.widget, "clicked", it);
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel