aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-07-22 13:23:59 +0900
committerHermet Park <hermetpark@gmail.com>2019-07-22 13:23:59 +0900
commit05a50dc2ebca015fcb0ceb2dbac99ad028d42efa (patch)
tree1d2b21ad9162a404082824987920a8a87279e829 /src/lib/elementary
parentMerge branch 'master' into devs/hermet/lottie (diff)
parentecore wl2 - fall back to shm if dmabuf fails in buf init (diff)
downloadefl-devs/hermet/lottie.tar.gz
Merge branch 'master' into devs/hermet/lottiedevs/hermet/lottie
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/Efl_Ui.h1
-rw-r--r--src/lib/elementary/efl_ui_scroll_manager.c3
-rw-r--r--src/lib/elementary/efl_ui_table.c5
-rw-r--r--src/lib/elementary/efl_ui_table_layout.c45
-rw-r--r--src/lib/elementary/efl_ui_table_private.h2
5 files changed, 50 insertions, 6 deletions
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h
index 09204faad1..6ef6a65049 100644
--- a/src/lib/elementary/Efl_Ui.h
+++ b/src/lib/elementary/Efl_Ui.h
@@ -249,6 +249,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
# include <efl_ui_format.eo.h>
# include <efl_ui_spin.eo.h>
# include <efl_ui_spin_button.eo.h>
+# include <efl_ui_slider.eo.h>
/**
* Initialize Elementary
diff --git a/src/lib/elementary/efl_ui_scroll_manager.c b/src/lib/elementary/efl_ui_scroll_manager.c
index dd924ed0b8..83794319bd 100644
--- a/src/lib/elementary/efl_ui_scroll_manager.c
+++ b/src/lib/elementary/efl_ui_scroll_manager.c
@@ -1232,7 +1232,8 @@ static inline double
_scroll_manager_animation_duration_get(Evas_Coord dx, Evas_Coord dy)
{
double dist = 0.0, vel = 0.0, dur = 0.0;
- dist = sqrt(dx * dx + dy *dy);
+ uint64_t x = abs(dx), y = abs(dy);
+ dist = sqrt(x * x + y * y);
vel = _elm_config->thumbscroll_friction_standard / _elm_config->thumbscroll_friction;
dur = dist / vel;
dur = (dur > _elm_config->thumbscroll_friction) ? _elm_config->thumbscroll_friction : dur;
diff --git a/src/lib/elementary/efl_ui_table.c b/src/lib/elementary/efl_ui_table.c
index fd7ee11e4c..6655573231 100644
--- a/src/lib/elementary/efl_ui_table.c
+++ b/src/lib/elementary/efl_ui_table.c
@@ -174,7 +174,7 @@ EOLIAN static void
_efl_ui_table_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Table_Data *_pd EINA_UNUSED, Eina_Size2D sz)
{
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
- efl_canvas_group_change(obj);
+ efl_pack_layout_request(obj);
}
EOLIAN static void
@@ -508,8 +508,9 @@ _efl_ui_table_efl_pack_unpack_all(Eo *obj, Efl_Ui_Table_Data *pd)
}
EOLIAN static void
-_efl_ui_table_efl_pack_layout_layout_request(Eo *obj, Efl_Ui_Table_Data *pd EINA_UNUSED)
+_efl_ui_table_efl_pack_layout_layout_request(Eo *obj, Efl_Ui_Table_Data *pd)
{
+ pd->full_recalc = EINA_TRUE;
efl_canvas_group_need_recalculate_set(obj, EINA_TRUE);
}
diff --git a/src/lib/elementary/efl_ui_table_layout.c b/src/lib/elementary/efl_ui_table_layout.c
index 391878019e..a0307f52e0 100644
--- a/src/lib/elementary/efl_ui_table_layout.c
+++ b/src/lib/elementary/efl_ui_table_layout.c
@@ -218,6 +218,27 @@ _efl_ui_table_regular_item_size_get(Table_Calc *table_calc, Item_Calc *item, Ein
- item->hints[axis].margin[0] - item->hints[axis].margin[1];
}
+/* this function performs a simplified layout when the table has changed position
+ * but no other changes have occurred, e.g., when a table is being scrolled
+ */
+static void
+_efl_ui_table_layout_simple(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
+{
+ Table_Item *ti;
+ Eina_Position2D pos = efl_gfx_entity_position_get(ui_table);
+
+ EINA_INLIST_FOREACH(EINA_INLIST_GET(pd->items), ti)
+ {
+ Eina_Position2D child_pos = efl_gfx_entity_position_get(ti->object);
+
+ efl_gfx_entity_position_set(ti->object,
+ EINA_POSITION2D(pos.x - pd->last_pos.x + child_pos.x,
+ pos.y - pd->last_pos.y + child_pos.y));
+ }
+ pd->last_pos = pos;
+ efl_event_callback_call(ui_table, EFL_PACK_EVENT_LAYOUT_UPDATED, NULL);
+}
+
void
_efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
{
@@ -228,16 +249,22 @@ _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
int (*_efl_ui_table_item_pos_get[2])(Table_Calc *, Item_Calc *, Eina_Bool);
int (*_efl_ui_table_item_size_get[2])(Table_Calc *, Item_Calc *, Eina_Bool);
Table_Calc table_calc;
+ Eina_Bool do_free;
count = pd->count;
-
if (!count)
{
efl_gfx_hint_size_restricted_min_set(ui_table, EINA_SIZE2D(0, 0));
return;
}
-
+ if (!pd->full_recalc)
+ {
+ _efl_ui_table_layout_simple(ui_table, pd);
+ return;
+ }
_efl_ui_container_layout_init(ui_table, table_calc.layout_calc);
+ pd->last_pos.x = table_calc.layout_calc[0].pos - table_calc.layout_calc[0].margin[0];
+ pd->last_pos.y = table_calc.layout_calc[1].pos - table_calc.layout_calc[1].margin[0];
table_calc.want[0] = table_calc.want[1] = 0;
table_calc.weight_sum[0] = table_calc.weight_sum[1] = 0;
@@ -250,7 +277,17 @@ _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
memset(table_calc.cell_calc[0], 0, cols * sizeof(Cell_Calc));
memset(table_calc.cell_calc[1], 0, rows * sizeof(Cell_Calc));
- items = alloca(count * sizeof(*items));
+ /* Item_Calc struct is currently 152 bytes.
+ * this is pretty big to be allocating a huge number of, and we don't want to explode the stack
+ */
+ do_free = count >= 500;
+ if (do_free)
+ {
+ items = malloc(count * sizeof(*items));
+ EINA_SAFETY_ON_NULL_RETURN(items);
+ }
+ else
+ items = alloca(count * sizeof(*items));
#ifdef DEBUG
memset(items, 0, count * sizeof(*items));
#endif
@@ -380,8 +417,10 @@ _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
+ (table_calc.layout_calc[1].pad *
table_calc.cell_calc[1][rows - 1].index);
+ pd->full_recalc = EINA_FALSE;
efl_gfx_hint_size_restricted_min_set(ui_table,
EINA_SIZE2D(table_calc.want[0],
table_calc.want[1]));
efl_event_callback_call(ui_table, EFL_PACK_EVENT_LAYOUT_UPDATED, NULL);
+ if (do_free) free(items);
}
diff --git a/src/lib/elementary/efl_ui_table_private.h b/src/lib/elementary/efl_ui_table_private.h
index ff261f1fae..47d1cc4cb7 100644
--- a/src/lib/elementary/efl_ui_table_private.h
+++ b/src/lib/elementary/efl_ui_table_private.h
@@ -44,11 +44,13 @@ struct _Efl_Ui_Table_Data
struct {
double h, v;
} align;
+ Eina_Position2D last_pos;
Eina_Bool cols_recalc : 1;
Eina_Bool rows_recalc : 1;
Eina_Bool linear_recalc : 1;
Eina_Bool homogeneoush : 1;
Eina_Bool homogeneousv : 1;
+ Eina_Bool full_recalc : 1; //whether to force full recalc
};
struct _Table_Item_Iterator