summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-08-02 09:42:06 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-08-02 09:42:14 -0400
commit0e462d5f5a2c65a25129683a0ded817c7de39902 (patch)
tree259e82b2a74c2688a86717b9d59fa3f26cf55776
parent868e3308b12c6279a9ea46d3a5670375251c796e (diff)
genlist: rework the focus model for performance
Summary: the focus model before was more meant for simplicity and not for performance, this now is more made for performance. The performance boost is achived by not using composition anymore, but rather register realized items by hand. This keeps the amount of items bound to the size of the viewport. Additionally item realization that is followed by unrealization immediately is not resulting in focus calls. This solves the performance issue from T6580 in regards of focus. perf results after this: http://www.enlightenment.org/ss/e-5b61b50657f3c3.82619729.png Reviewers: ManMower, zmike Reviewed By: zmike Subscribers: cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6720
-rw-r--r--src/lib/elementary/elm_genlist.c99
-rw-r--r--src/lib/elementary/elm_genlist.eo3
-rw-r--r--src/lib/elementary/elm_widget_genlist.h1
3 files changed, 80 insertions, 23 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index ced92b59f2..9523017b35 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -400,7 +400,8 @@ _item_content_realize(Elm_Gen_Item *it,
400 Evas_Object *target, 400 Evas_Object *target,
401 Eina_List **contents, 401 Eina_List **contents,
402 const char *src, 402 const char *src,
403 const char *parts) 403 const char *parts,
404 Eina_Bool calc)
404{ 405{
405 Evas_Object *content; 406 Evas_Object *content;
406 char buf[256]; 407 char buf[256];
@@ -469,7 +470,8 @@ _item_content_realize(Elm_Gen_Item *it,
469 470
470 if (elm_widget_is(content)) 471 if (elm_widget_is(content))
471 { 472 {
472 _elm_widget_full_eval(content); 473 if (!calc)
474 _elm_widget_full_eval(content);
473 } 475 }
474 } 476 }
475 *contents = eina_list_append(*contents, content); 477 *contents = eina_list_append(*contents, content);
@@ -739,8 +741,19 @@ _item_block_unrealize(Item_Block *itb)
739 } 741 }
740 if (!dragging) 742 if (!dragging)
741 { 743 {
744 Eina_List *n;
745
742 itb->realized = EINA_FALSE; 746 itb->realized = EINA_FALSE;
743 itb->want_unrealize = EINA_TRUE; 747 itb->want_unrealize = EINA_TRUE;
748
749 efl_ui_focus_manager_calc_unregister(itb->sd->obj, itb->adapter);
750 efl_del(itb->adapter);
751 itb->adapter = NULL;
752
753 EINA_LIST_FOREACH(itb->items, n, it)
754 {
755 efl_ui_focus_manager_calc_unregister(itb->sd->obj, EO_OBJ(it));
756 }
744 } 757 }
745 else 758 else
746 itb->want_unrealize = EINA_FALSE; 759 itb->want_unrealize = EINA_FALSE;
@@ -1339,11 +1352,11 @@ _elm_genlist_item_state_update(Elm_Gen_Item *it)
1339} 1352}
1340 1353
1341static void 1354static void
1342_view_inflate(Evas_Object *view, Elm_Gen_Item *it, Eina_List **sources, Eina_List **contents) 1355_view_inflate(Evas_Object *view, Elm_Gen_Item *it, Eina_List **sources, Eina_List **contents, Eina_Bool calc)
1343{ 1356{
1344 if (!view) return; 1357 if (!view) return;
1345 if (sources) _item_text_realize(it, view, sources, NULL); 1358 if (sources) _item_text_realize(it, view, sources, NULL);
1346 if (contents) _item_content_realize(it, view, contents, "contents", NULL); 1359 if (contents) _item_content_realize(it, view, contents, "contents", NULL, calc);
1347 _item_state_realize(it, view, NULL); 1360 _item_state_realize(it, view, NULL);
1348} 1361}
1349 1362
@@ -1432,7 +1445,7 @@ _decorate_all_item_realize(Elm_Gen_Item *it,
1432 if (it->flipped) 1445 if (it->flipped)
1433 edje_object_signal_emit 1446 edje_object_signal_emit
1434 (it->deco_all_view, SIGNAL_FLIP_ENABLED, "elm"); 1447 (it->deco_all_view, SIGNAL_FLIP_ENABLED, "elm");
1435 _view_inflate(it->deco_all_view, it, NULL, &(it->item->deco_all_contents)); 1448 _view_inflate(it->deco_all_view, it, NULL, &(it->item->deco_all_contents), EINA_FALSE);
1436 edje_object_part_swallow 1449 edje_object_part_swallow
1437 (it->deco_all_view, "elm.swallow.decorate.content", VIEW(it)); 1450 (it->deco_all_view, "elm.swallow.decorate.content", VIEW(it));
1438 1451
@@ -1898,7 +1911,7 @@ _item_realize(Elm_Gen_Item *it, const int index, Eina_Bool calc)
1898 ERR_ABORT("If you see this error, please notify us and we" 1911 ERR_ABORT("If you see this error, please notify us and we"
1899 "will fix it"); 1912 "will fix it");
1900 1913
1901 _view_inflate(VIEW(it), it, &it->texts, &it->contents); 1914 _view_inflate(VIEW(it), it, &it->texts, &it->contents, calc);
1902 if (it->has_contents != (!!it->contents)) 1915 if (it->has_contents != (!!it->contents))
1903 it->item->mincalcd = EINA_FALSE; 1916 it->item->mincalcd = EINA_FALSE;
1904 it->has_contents = !!it->contents; 1917 it->has_contents = !!it->contents;
@@ -1906,7 +1919,7 @@ _item_realize(Elm_Gen_Item *it, const int index, Eina_Bool calc)
1906 { 1919 {
1907 edje_object_signal_emit(VIEW(it), SIGNAL_FLIP_ENABLED, "elm"); 1920 edje_object_signal_emit(VIEW(it), SIGNAL_FLIP_ENABLED, "elm");
1908 _item_content_realize(it, VIEW(it), &it->item->flip_contents, 1921 _item_content_realize(it, VIEW(it), &it->item->flip_contents,
1909 "flips", NULL); 1922 "flips", NULL, EINA_FALSE);
1910 } 1923 }
1911 1924
1912 /* access: unregister item which have no text and content */ 1925 /* access: unregister item which have no text and content */
@@ -2496,13 +2509,43 @@ _item_block_position(Item_Block *itb, const int blk_idx)
2496 evas_event_thaw_eval(evas_object_evas_get((itb->sd)->obj)); 2509 evas_event_thaw_eval(evas_object_evas_get((itb->sd)->obj));
2497} 2510}
2498 2511
2512static inline void
2513_flush_block_order(Elm_Genlist_Data *sd)
2514{
2515 Item_Block *itb;
2516 Eina_List *blocks = NULL;
2517
2518 EINA_INLIST_FOREACH(sd->blocks, itb)
2519 {
2520 if (itb->adapter)
2521 blocks = eina_list_append(blocks, itb->adapter);
2522 }
2523
2524 efl_ui_focus_manager_calc_update_order(sd->obj, sd->obj, blocks);
2525}
2526
2499static void 2527static void
2500_item_block_realize(Item_Block *itb) 2528_item_block_realize(Item_Block *itb)
2501{ 2529{
2530 Elm_Gen_Item *it;
2531 Eina_List *n;
2532
2502 if (itb->realized) return; 2533 if (itb->realized) return;
2503 2534
2504 itb->realized = EINA_TRUE; 2535 itb->realized = EINA_TRUE;
2505 itb->want_unrealize = EINA_FALSE; 2536 itb->want_unrealize = EINA_FALSE;
2537
2538 if (!itb->adapter)
2539 {
2540 itb->adapter = efl_add(EFL_UI_FOCUS_COMPOSITION_ADAPTER_CLASS, itb->sd->obj);
2541 efl_ui_focus_manager_calc_register_logical(itb->sd->obj, itb->adapter, itb->sd->obj, NULL);
2542 _flush_block_order(itb->sd);
2543 }
2544
2545 EINA_LIST_FOREACH(itb->items, n, it)
2546 {
2547 efl_ui_focus_manager_calc_register_logical(itb->sd->obj, EO_OBJ(it), itb->adapter, NULL);
2548 }
2506} 2549}
2507 2550
2508static Eina_Bool 2551static Eina_Bool
@@ -4314,6 +4357,24 @@ _item_block_new(Elm_Genlist_Data *sd,
4314 return itb; 4357 return itb;
4315} 4358}
4316 4359
4360static void
4361_update_block_registration(Item_Block *itb, Elm_Gen_Item *element)
4362{
4363 Elm_Gen_Item *it = NULL;
4364 Eina_List *order = NULL;
4365
4366 if (!itb->realized) return;
4367
4368 efl_ui_focus_manager_calc_register_logical(itb->sd->obj, EO_OBJ(element), itb->adapter, NULL);
4369
4370 EINA_INLIST_FOREACH(itb->items, it)
4371 {
4372 order = eina_list_append(order, EO_OBJ(it));
4373 }
4374
4375 efl_ui_focus_manager_calc_update_order(itb->sd->obj, itb->adapter, order);
4376}
4377
4317/** 4378/**
4318 * @internal 4379 * @internal
4319 * 4380 *
@@ -4343,6 +4404,7 @@ newblock:
4343 sd->blocks = 4404 sd->blocks =
4344 eina_inlist_append(sd->blocks, EINA_INLIST_GET(itb)); 4405 eina_inlist_append(sd->blocks, EINA_INLIST_GET(itb));
4345 itb->items = eina_list_append(itb->items, it); 4406 itb->items = eina_list_append(itb->items, it);
4407 _update_block_registration(itb, it);
4346 itb->position_update = EINA_TRUE; 4408 itb->position_update = EINA_TRUE;
4347 it->position = eina_list_count(itb->items); 4409 it->position = eina_list_count(itb->items);
4348 it->position_update = EINA_TRUE; 4410 it->position_update = EINA_TRUE;
@@ -4415,7 +4477,7 @@ newblock:
4415 if (!itb) return EINA_FALSE; 4477 if (!itb) return EINA_FALSE;
4416 } 4478 }
4417 itb->items = eina_list_prepend(itb->items, it); 4479 itb->items = eina_list_prepend(itb->items, it);
4418 4480 _update_block_registration(itb, it);
4419 _item_position_update(itb->items, 0); 4481 _item_position_update(itb->items, 0);
4420 } 4482 }
4421 // item move_after, append, insert_after, sorted_insert without before 4483 // item move_after, append, insert_after, sorted_insert without before
@@ -4436,6 +4498,7 @@ newblock:
4436 if (!itb) return EINA_FALSE; 4498 if (!itb) return EINA_FALSE;
4437 } 4499 }
4438 itb->items = eina_list_append(itb->items, it); 4500 itb->items = eina_list_append(itb->items, it);
4501 _update_block_registration(itb, it);
4439 it->position = eina_list_count(itb->items); 4502 it->position = eina_list_count(itb->items);
4440 } 4503 }
4441 } 4504 }
@@ -4467,12 +4530,14 @@ newblock:
4467 if (it->item->before) 4530 if (it->item->before)
4468 { 4531 {
4469 itb->items = eina_list_prepend_relative_list(itb->items, it, tmp); 4532 itb->items = eina_list_prepend_relative_list(itb->items, it, tmp);
4533 _update_block_registration(itb, it);
4470 _item_position_update 4534 _item_position_update
4471 (eina_list_prev(tmp), it->item->rel->position); 4535 (eina_list_prev(tmp), it->item->rel->position);
4472 } 4536 }
4473 else 4537 else
4474 { 4538 {
4475 itb->items = eina_list_append_relative_list(itb->items, it, tmp); 4539 itb->items = eina_list_append_relative_list(itb->items, it, tmp);
4540 _update_block_registration(itb, it);
4476 _item_position_update 4541 _item_position_update
4477 (eina_list_next(tmp), it->item->rel->position + 1); 4542 (eina_list_next(tmp), it->item->rel->position + 1);
4478 } 4543 }
@@ -4666,8 +4731,6 @@ _queue_process(Elm_Genlist_Data *sd)
4666 4731
4667 t0 = ecore_time_get(); 4732 t0 = ecore_time_get();
4668 4733
4669 if (sd->queue) efl_ui_focus_composition_prepare(sd->obj);
4670
4671 for (n = 0; (sd->queue) && (n < ITEM_QUEUE_MAX); n++) 4734 for (n = 0; (sd->queue) && (n < ITEM_QUEUE_MAX); n++)
4672 { 4735 {
4673 Elm_Gen_Item *it; 4736 Elm_Gen_Item *it;
@@ -5478,7 +5541,7 @@ _decorate_item_realize(Elm_Gen_Item *it)
5478 it); 5541 it);
5479 5542
5480 _view_inflate(it->item->deco_it_view, it, &it->item->deco_it_texts, 5543 _view_inflate(it->item->deco_it_view, it, &it->item->deco_it_texts,
5481 &it->item->deco_it_contents); 5544 &it->item->deco_it_contents, EINA_FALSE);
5482 edje_object_part_swallow 5545 edje_object_part_swallow
5483 (it->item->deco_it_view, 5546 (it->item->deco_it_view,
5484 edje_object_data_get(it->item->deco_it_view, "mode_part"), VIEW(it)); 5547 edje_object_data_get(it->item->deco_it_view, "mode_part"), VIEW(it));
@@ -5804,9 +5867,6 @@ _elm_genlist_efl_object_constructor(Eo *obj, Elm_Genlist_Data *sd)
5804 efl_ui_focus_parent_provider_gen_container_set(efl_added, obj), 5867 efl_ui_focus_parent_provider_gen_container_set(efl_added, obj),
5805 efl_ui_focus_parent_provider_gen_content_item_map_set(efl_added, sd->content_item_map)); 5868 efl_ui_focus_parent_provider_gen_content_item_map_set(efl_added, sd->content_item_map));
5806 5869
5807 efl_ui_focus_composition_custom_manager_set(obj, obj);
5808 efl_ui_focus_composition_logical_mode_set(obj, EINA_TRUE);
5809
5810 sd->obj = obj; 5870 sd->obj = obj;
5811 5871
5812 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); 5872 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
@@ -6197,8 +6257,6 @@ _elm_genlist_item_new(Elm_Genlist_Data *sd,
6197 it->item->expanded_depth = depth; 6257 it->item->expanded_depth = depth;
6198 sd->item_count++; 6258 sd->item_count++;
6199 6259
6200 efl_ui_focus_composition_dirty(sd->obj);
6201
6202 return it; 6260 return it;
6203} 6261}
6204 6262
@@ -7234,23 +7292,23 @@ _elm_genlist_item_fields_update(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
7234 } 7292 }
7235 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_CONTENT)) 7293 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_CONTENT))
7236 { 7294 {
7237 _item_content_realize(it, VIEW(it), &it->contents, "contents", parts); 7295 _item_content_realize(it, VIEW(it), &it->contents, "contents", parts, EINA_FALSE);
7238 if (it->flipped) 7296 if (it->flipped)
7239 { 7297 {
7240 _item_content_realize(it, VIEW(it), &it->item->flip_contents, 7298 _item_content_realize(it, VIEW(it), &it->item->flip_contents,
7241 "flips", parts); 7299 "flips", parts, EINA_FALSE);
7242 } 7300 }
7243 if (it->item->deco_it_view) 7301 if (it->item->deco_it_view)
7244 { 7302 {
7245 _item_content_realize(it, it->item->deco_it_view, 7303 _item_content_realize(it, it->item->deco_it_view,
7246 &it->item->deco_it_contents, 7304 &it->item->deco_it_contents,
7247 "contents", parts); 7305 "contents", parts, EINA_FALSE);
7248 } 7306 }
7249 if (it->item->wsd->decorate_all_mode) 7307 if (it->item->wsd->decorate_all_mode)
7250 { 7308 {
7251 _item_content_realize(it, it->deco_all_view, 7309 _item_content_realize(it, it->deco_all_view,
7252 &it->item->deco_all_contents, 7310 &it->item->deco_all_contents,
7253 "contents", parts); 7311 "contents", parts, EINA_FALSE);
7254 } 7312 }
7255 if (it->has_contents != (!!it->contents)) 7313 if (it->has_contents != (!!it->contents))
7256 it->item->mincalcd = EINA_FALSE; 7314 it->item->mincalcd = EINA_FALSE;
@@ -8754,7 +8812,6 @@ _elm_genlist_efl_ui_focus_composition_prepare(Eo *obj, Elm_Genlist_Data *pd)
8754 8812
8755 efl_ui_focus_object_prepare_logical(item->base->eo_obj); 8813 efl_ui_focus_object_prepare_logical(item->base->eo_obj);
8756 } 8814 }
8757
8758} 8815}
8759 8816
8760EOLIAN static void 8817EOLIAN static void
diff --git a/src/lib/elementary/elm_genlist.eo b/src/lib/elementary/elm_genlist.eo
index e4ff2d218b..c1317ae62d 100644
--- a/src/lib/elementary/elm_genlist.eo
+++ b/src/lib/elementary/elm_genlist.eo
@@ -1,6 +1,6 @@
1import elm_general; 1import elm_general;
2 2
3class Elm.Genlist (Efl.Ui.Layout.Object, Efl.Ui.Focus.Composition, Elm.Interface_Scrollable, Efl.Ui.Clickable, 3class Elm.Genlist (Efl.Ui.Layout.Object, Elm.Interface_Scrollable, Efl.Ui.Clickable,
4 Efl.Access.Widget.Action, Efl.Access.Selection, 4 Efl.Access.Widget.Action, Efl.Access.Selection,
5 Efl.Ui.Selectable, Efl.Ui.Legacy) 5 Efl.Ui.Selectable, Efl.Ui.Legacy)
6{ 6{
@@ -553,7 +553,6 @@ class Elm.Genlist (Efl.Ui.Layout.Object, Efl.Ui.Focus.Composition, Elm.Interface
553 Efl.Access.Selection.is_child_selected; 553 Efl.Access.Selection.is_child_selected;
554 Efl.Access.Selection.all_children_select; 554 Efl.Access.Selection.all_children_select;
555 Efl.Access.Selection.access_selection_clear; 555 Efl.Access.Selection.access_selection_clear;
556 Efl.Ui.Focus.Composition.prepare;
557 Efl.Ui.Widget.focus_state_apply; 556 Efl.Ui.Widget.focus_state_apply;
558 Efl.Ui.Focus.Manager.setup_on_first_touch; 557 Efl.Ui.Focus.Manager.setup_on_first_touch;
559 } 558 }
diff --git a/src/lib/elementary/elm_widget_genlist.h b/src/lib/elementary/elm_widget_genlist.h
index c6454c8720..613f258af0 100644
--- a/src/lib/elementary/elm_widget_genlist.h
+++ b/src/lib/elementary/elm_widget_genlist.h
@@ -268,6 +268,7 @@ struct _Item_Block
268 Evas_Coord x, y, w, h, minw, minh; 268 Evas_Coord x, y, w, h, minw, minh;
269 int position; 269 int position;
270 int item_position_stamp; 270 int item_position_stamp;
271 Eo *adapter;
271 272
272 Eina_Bool position_update : 1; 273 Eina_Bool position_update : 1;
273 Eina_Bool want_unrealize : 1; 274 Eina_Bool want_unrealize : 1;