This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efl.
View the commit online.
commit 7de18fbff7252c7def131545aebc4ff27a158fb3
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 15 20:48:14 2026 -0600
elementary: exact_model: total width follows the widest row narrowing
A row measured again with a smaller width left the total width at the
old widest, which only a removal looked for again. It is now looked for
again the same way, and only when the row that was the widest is the one
that changed. Every slot is stored first, as the shift of the rows does,
as the widths that are only in a slot are not in the blocks that are
scanned.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/elementary/efl_ui_exact_model.c | 26 +++++++++++++++++-
src/tests/elementary/efl_ui_model.c | 47 +++++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/src/lib/elementary/efl_ui_exact_model.c b/src/lib/elementary/efl_ui_exact_model.c
index 5cfe9c9624..12c9cce8a6 100644
--- a/src/lib/elementary/efl_ui_exact_model.c
+++ b/src/lib/elementary/efl_ui_exact_model.c
@@ -682,7 +682,7 @@ _efl_ui_exact_model_efl_model_property_set(Eo *obj, Efl_Ui_Exact_Model_Data *pd,
{
if (eina_streq(property, _efl_model_property_selfw))
{
- unsigned int index, size;
+ unsigned int index, size, old_value;
unsigned char found;
index = efl_composite_model_index_get(obj);
@@ -692,12 +692,36 @@ _efl_ui_exact_model_efl_model_property_set(Eo *obj, Efl_Ui_Exact_Model_Data *pd,
found = _efl_ui_exact_model_slot_find(pd->parent, index, EINA_TRUE, EINA_FALSE);
if (!eina_value_uint_convert(value, &size) || (size & EFL_UI_EXACT_MODEL_MEASURED))
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
+ old_value = pd->parent->slot[found].width[index % EFL_UI_EXACT_MODEL_CONTENT];
pd->parent->slot[found].width[index % EFL_UI_EXACT_MODEL_CONTENT] =
size | EFL_UI_EXACT_MODEL_MEASURED;
pd->parent->slot[found].dirty.width = EINA_TRUE;
// We succeeded so let's update the max total size width (As we only handle vertical list case at the moment)
if (pd->parent->total_size.width < size)
pd->parent->total_size.width = size;
+ // The widest row that gets narrower: the total is looked for again, as when it leaves
+ // (the sizes are in the blocks for that, and it is only done for that row)
+ else if ((old_value & EFL_UI_EXACT_MODEL_MEASURED) &&
+ ((old_value & ~EFL_UI_EXACT_MODEL_MEASURED) >= pd->parent->total_size.width) &&
+ (size < pd->parent->total_size.width))
+ {
+ unsigned char i;
+ Eina_Bool ok = EINA_TRUE;
+
+ // Every slot that was written to is stored first, as _shift does: the widths
+ // that are only in a slot are not in the blocks that are scanned
+ // (a slot that could not be stored forgets everything, the total with it)
+ for (i = 0; ok && (i < EINA_C_ARRAY_LENGTH(pd->parent->slot)); i++)
+ {
+ ok = _efl_ui_exact_model_slot_commit(pd->parent, i);
+ }
+ if (ok)
+ {
+ pd->parent->total_size.width =
+ _efl_ui_exact_model_width_max(pd->parent->compressed.width,
+ pd->parent->total_size.width);
+ }
+ }
return efl_loop_future_resolved(obj, eina_value_uint_init(size));
}
if (eina_streq(property, _efl_model_property_selfh))
diff --git a/src/tests/elementary/efl_ui_model.c b/src/tests/elementary/efl_ui_model.c
index 5ae2ac9d38..922764bfe5 100644
--- a/src/tests/elementary/efl_ui_model.c
+++ b/src/tests/elementary/efl_ui_model.c
@@ -1253,6 +1253,23 @@ EFL_START_TEST(efl_ui_exact_model_remove_widest)
}
EFL_END_TEST
+// The widest row gets narrower while another widest one is only in a slot
+// that was not stored: the total is the width of that one.
+EFL_START_TEST(efl_ui_exact_model_narrow_widest_other_slot)
+{
+ Shift_Rows *sr = _shift_new(1100);
+
+ _uint_set(sr->cur[0], "self.width", 300);
+ _uint_set(sr->cur[1050], "self.width", 300);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 300);
+ _uint_set(sr->cur[0], "self.width", 100);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 300);
+ _uint_set(sr->cur[1050], "self.width", 50);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 100);
+ _shift_free(sr);
+}
+EFL_END_TEST
+
// What cannot be stored when the sizes move is lost, and no row is then
// said to have a size that is not its own: every size is forgotten, and the
// totals with them.
@@ -1708,6 +1725,34 @@ EFL_START_TEST(efl_ui_average_model_remove_after_stopped)
}
EFL_END_TEST
+// The widest row gets narrower: the total width is the widest that is left, as when it
+// is removed.
+EFL_START_TEST(efl_ui_exact_model_narrower_widest)
+{
+ Shift_Rows *sr = _shift_new(2100);
+
+ _uint_set(sr->cur[3], "self.width", 60);
+ _uint_set(sr->cur[1500], "self.width", 100);
+ _uint_set(sr->cur[2000], "self.width", 100);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 100);
+ // another one is as wide: the total is the same
+ _uint_set(sr->cur[1500], "self.width", 70);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 100);
+ // the last of them
+ _uint_set(sr->cur[2000], "self.width", 20);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 70);
+ // not the widest: nothing to look for
+ _uint_set(sr->cur[3], "self.width", 10);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 70);
+ _uint_set(sr->cur[1500], "self.width", 5);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 20);
+ // and wider again
+ _uint_set(sr->cur[3], "self.width", 90);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 90);
+ _shift_free(sr);
+}
+EFL_END_TEST
+
void
efl_ui_model(TCase *tc)
{
@@ -1739,4 +1784,6 @@ efl_ui_model(TCase *tc)
tcase_add_test(tc, efl_ui_average_model_forgotten_in_set);
tcase_add_test(tc, efl_ui_average_model_remove_nested);
tcase_add_test(tc, efl_ui_average_model_remove_after_stopped);
+ tcase_add_test(tc, efl_ui_exact_model_narrow_widest_other_slot);
+ tcase_add_test(tc, efl_ui_exact_model_narrower_widest);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.