summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-02-27 14:27:24 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-02-27 16:26:41 +0900
commit726994d175fb758b0b904418dbce13efd7f0cef6 (patch)
tree19a8021a70406e134520600cac601ee8e23ca465 /src/lib/elementary
parent3574eb8c07b3ea04ba25d7ae9f6bf1df05c5b7d6 (diff)
genlist: Final fix for odd/even styles issue
The key was to emit & process the signal to the edje objects (item views) at the same time as we move them, ie. from the loop in _item_block_position(). Also the proper counting must be used at all times. Hidden items should not be counted. Tree effect may still have issues but otherwise there is no more blinking, double odd or even rows, etc... It all looks good (as long as there is no tree effect!). Fixes T3086 @fix
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/elm_genlist.c60
1 files changed, 25 insertions, 35 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index bd1219c3e0..09a9c7abe8 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -1186,6 +1186,7 @@ _elm_genlist_item_position_state_update(Elm_Gen_Item *it)
1186{ 1186{
1187 unsigned idx = it->item->order_num_in; 1187 unsigned idx = it->item->order_num_in;
1188 1188
1189 if (!VIEW(it) && !it->deco_all_view) return;
1189 ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); 1190 ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
1190 1191
1191 if (!it->item->nostacking) 1192 if (!it->item->nostacking)
@@ -1277,25 +1278,12 @@ _elm_genlist_item_position_state_update(Elm_Gen_Item *it)
1277} 1278}
1278 1279
1279static void 1280static void
1280_item_order_update(Elm_Gen_Item *it_base, const int start) 1281_item_order_update(Elm_Gen_Item *it, int index, Eina_Bool process)
1281{ 1282{
1282 Elm_Gen_Item *it; 1283 it->item->order_num_in = index;
1283 Item_Block *itb_base; 1284 _elm_genlist_item_position_state_update(it);
1284 int index = start;
1285 1285
1286 itb_base = it_base->item->block; 1286 if (process) edje_object_message_signal_process(VIEW(it));
1287 EINA_INLIST_FOREACH(EINA_INLIST_GET(it_base), it)
1288 {
1289 if (it->hide) continue;
1290 if (it->item->block != itb_base)
1291 {
1292 if (it->item->block && (it->item->block->num != index))
1293 it->item->block->changed = EINA_TRUE;
1294 break;
1295 }
1296 it->item->order_num_in = index++;
1297 _elm_genlist_item_position_state_update(it);
1298 }
1299} 1287}
1300 1288
1301static void 1289static void
@@ -1796,7 +1784,7 @@ _item_realize(Elm_Gen_Item *it, const int index, Eina_Bool calc)
1796 { 1784 {
1797 if (it->item->order_num_in != in) 1785 if (it->item->order_num_in != in)
1798 { 1786 {
1799 _item_order_update(it, in); 1787 _item_order_update(it, in, EINA_TRUE);
1800 _elm_genlist_item_index_update(it); 1788 _elm_genlist_item_index_update(it);
1801 } 1789 }
1802 return; 1790 return;
@@ -1813,7 +1801,7 @@ _item_realize(Elm_Gen_Item *it, const int index, Eina_Bool calc)
1813 /* access */ 1801 /* access */
1814 if (_elm_config->access_mode) _access_widget_item_register(it); 1802 if (_elm_config->access_mode) _access_widget_item_register(it);
1815 1803
1816 _item_order_update(it, in); 1804 _item_order_update(it, in, EINA_FALSE);
1817 1805
1818 if (sd->reorder_mode) 1806 if (sd->reorder_mode)
1819 edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_MODE_SET, "elm"); 1807 edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_MODE_SET, "elm");
@@ -2111,7 +2099,7 @@ _tree_effect_animator_cb(void *data, const Efl_Event *event EINA_UNUSED)
2111 2099
2112 if (!it->realized && !it->item->queued) 2100 if (!it->realized && !it->item->queued)
2113 _item_realize(it, in, 0); 2101 _item_realize(it, in, 0);
2114 in++; 2102 if (!it->hide) in++;
2115 2103
2116 if (it != expanded_next_it) 2104 if (it != expanded_next_it)
2117 { 2105 {
@@ -2303,8 +2291,7 @@ _reorder_item_space_get(Elm_Gen_Item *it)
2303} 2291}
2304 2292
2305static void 2293static void
2306_item_block_position(Item_Block *itb, 2294_item_block_position(Item_Block *itb, const int blk_idx)
2307 int in)
2308{ 2295{
2309 Elm_Gen_Item *it; 2296 Elm_Gen_Item *it;
2310 Elm_Gen_Item *git; 2297 Elm_Gen_Item *git;
@@ -2312,6 +2299,7 @@ _item_block_position(Item_Block *itb,
2312 Eina_Bool vis = EINA_FALSE; 2299 Eina_Bool vis = EINA_FALSE;
2313 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh; 2300 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2314 Elm_Genlist_Data *sd = NULL; 2301 Elm_Genlist_Data *sd = NULL;
2302 int vis_count = 0;
2315 2303
2316 evas_event_freeze(evas_object_evas_get((itb->sd)->obj)); 2304 evas_event_freeze(evas_object_evas_get((itb->sd)->obj));
2317 evas_object_geometry_get(itb->sd->pan_obj, &ox, &oy, &ow, &oh); 2305 evas_object_geometry_get(itb->sd->pan_obj, &ox, &oy, &ow, &oh);
@@ -2343,7 +2331,11 @@ _item_block_position(Item_Block *itb,
2343 { 2331 {
2344 if ((itb->realized) && (!it->realized)) 2332 if ((itb->realized) && (!it->realized))
2345 { 2333 {
2346 if (vis) _item_realize(it, in, EINA_FALSE); 2334 if (vis) _item_realize(it, blk_idx + vis_count, EINA_FALSE);
2335 }
2336 if ((blk_idx + vis_count) != it->item->order_num_in)
2337 {
2338 _item_order_update(it, blk_idx + vis_count, EINA_TRUE);
2347 } 2339 }
2348 if (it->realized) 2340 if (it->realized)
2349 { 2341 {
@@ -2416,7 +2408,7 @@ _item_block_position(Item_Block *itb,
2416 if (vis) it->item->want_realize = EINA_TRUE; 2408 if (vis) it->item->want_realize = EINA_TRUE;
2417 } 2409 }
2418 y += it->item->h; 2410 y += it->item->h;
2419 in++; 2411 vis_count++;
2420 } 2412 }
2421 evas_event_thaw(evas_object_evas_get((itb->sd)->obj)); 2413 evas_event_thaw(evas_object_evas_get((itb->sd)->obj));
2422 evas_event_thaw_eval(evas_object_evas_get((itb->sd)->obj)); 2414 evas_event_thaw_eval(evas_object_evas_get((itb->sd)->obj));
@@ -5202,9 +5194,7 @@ _item_unrealize(Elm_Gen_Item *it)
5202} 5194}
5203 5195
5204static Eina_Bool 5196static Eina_Bool
5205_item_block_recalc(Item_Block *itb, 5197_item_block_recalc(Item_Block *itb, const int blk_idx, Eina_Bool qadd)
5206 int in,
5207 Eina_Bool qadd)
5208{ 5198{
5209 const Eina_List *l; 5199 const Eina_List *l;
5210 Elm_Gen_Item *it; 5200 Elm_Gen_Item *it;
@@ -5214,7 +5204,7 @@ _item_block_recalc(Item_Block *itb,
5214 Item_Size *size = NULL; 5204 Item_Size *size = NULL;
5215 int vis_count = 0; 5205 int vis_count = 0;
5216 5206
5217 itb->num = in; 5207 itb->num = blk_idx;
5218 EINA_LIST_FOREACH(itb->items, l, it) 5208 EINA_LIST_FOREACH(itb->items, l, it)
5219 { 5209 {
5220 show_me |= it->item->show_me; 5210 show_me |= it->item->show_me;
@@ -5225,7 +5215,6 @@ _item_block_recalc(Item_Block *itb,
5225 if (it->realized) evas_object_hide(VIEW(it)); 5215 if (it->realized) evas_object_hide(VIEW(it));
5226 continue; 5216 continue;
5227 } 5217 }
5228 vis_count++;
5229 if (!itb->realized) 5218 if (!itb->realized)
5230 { 5219 {
5231 if (itb->sd->homogeneous && 5220 if (itb->sd->homogeneous &&
@@ -5238,7 +5227,7 @@ _item_block_recalc(Item_Block *itb,
5238 { 5227 {
5239 if (!size || (it->item->expanded_depth != size->expanded_depth)) 5228 if (!size || (it->item->expanded_depth != size->expanded_depth))
5240 { 5229 {
5241 _item_realize(it, in, EINA_TRUE); 5230 _item_realize(it, blk_idx + vis_count, EINA_TRUE);
5242 _elm_genlist_item_unrealize(it, EINA_TRUE); 5231 _elm_genlist_item_unrealize(it, EINA_TRUE);
5243 } 5232 }
5244 else 5233 else
@@ -5261,7 +5250,7 @@ _item_block_recalc(Item_Block *itb,
5261 } 5250 }
5262 else 5251 else
5263 { 5252 {
5264 _item_realize(it, in, EINA_TRUE); 5253 _item_realize(it, blk_idx + vis_count, EINA_TRUE);
5265 _elm_genlist_item_unrealize(it, EINA_TRUE); 5254 _elm_genlist_item_unrealize(it, EINA_TRUE);
5266 } 5255 }
5267 } 5256 }
@@ -5269,11 +5258,11 @@ _item_block_recalc(Item_Block *itb,
5269 else 5258 else
5270 { 5259 {
5271 if (!it->item->mincalcd) changed = EINA_TRUE; 5260 if (!it->item->mincalcd) changed = EINA_TRUE;
5272 _item_realize(it, in, EINA_FALSE); 5261 _item_realize(it, blk_idx + vis_count, EINA_FALSE);
5273 } 5262 }
5274 minh += it->item->minh; 5263 minh += it->item->minh;
5275 if (minw < it->item->minw) minw = it->item->minw; 5264 if (minw < it->item->minw) minw = it->item->minw;
5276 in++; 5265 vis_count++;
5277 it->x = 0; 5266 it->x = 0;
5278 it->y = y; 5267 it->y = y;
5279 y += it->item->h; 5268 y += it->item->h;
@@ -5308,9 +5297,9 @@ _update_job(void *data)
5308 5297
5309 if (!itb->updateme) 5298 if (!itb->updateme)
5310 { 5299 {
5311 num += itb->count;
5312 if (position) 5300 if (position)
5313 _item_block_position(itb, num); 5301 _item_block_position(itb, num);
5302 num += itb->vis_count;
5314 continue; 5303 continue;
5315 } 5304 }
5316 num0 = num; 5305 num0 = num;
@@ -5337,7 +5326,7 @@ _update_job(void *data)
5337 if ((it->item->minw != itminw) || (it->item->minh != itminh)) 5326 if ((it->item->minw != itminw) || (it->item->minh != itminh))
5338 recalc = EINA_TRUE; 5327 recalc = EINA_TRUE;
5339 } 5328 }
5340 num++; 5329 if (!it->hide) num++;
5341 } 5330 }
5342 itb->updateme = EINA_FALSE; 5331 itb->updateme = EINA_FALSE;
5343 if (recalc) 5332 if (recalc)
@@ -6171,6 +6160,7 @@ _elm_genlist_item_new(Elm_Genlist_Data *sd,
6171 it->item = ELM_NEW(Elm_Gen_Item_Type); 6160 it->item = ELM_NEW(Elm_Gen_Item_Type);
6172 it->item->wsd = sd; 6161 it->item->wsd = sd;
6173 it->item->type = type; 6162 it->item->type = type;
6163 it->item->order_num_in = -1;
6174 6164
6175 if (it->parent) 6165 if (it->parent)
6176 { 6166 {