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 8da39745c52f6443f163db4eb64a73b3722498e3
Author: Cedric BAIL <[email protected]>
AuthorDate: Tue Nov 10 19:46:19 2026 -0600
elementary: exact_model: total width shrinks when the widest row leaves
The total width is the width of the widest row, kept as a running
maximum that only ever rose, so a row that left kept its width in the
total for good. When the row that leaves was as wide as the total is,
the widest of what remains is looked for in the stored sizes (only then,
and the blocks of zeros are skipped).
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 | 32 ++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+)
diff --git a/src/lib/elementary/efl_ui_exact_model.c b/src/lib/elementary/efl_ui_exact_model.c
index d84fd40530..9a2c72db21 100644
--- a/src/lib/elementary/efl_ui_exact_model.c
+++ b/src/lib/elementary/efl_ui_exact_model.c
@@ -488,6 +488,28 @@ _efl_ui_exact_model_list_remove(Eina_List *compressed, unsigned int index,
return EINA_TRUE;
}
+// The widest row of what the list holds (the total width is that of one row,
+// as it is a vertical list that is kept).
+static unsigned int
+_efl_ui_exact_model_width_max(Eina_List *compressed)
+{
+ unsigned int buffer[EFL_UI_EXACT_MODEL_CONTENT];
+ unsigned int max = 0, i;
+ Eina_List *l;
+
+ for (l = compressed; l; l = eina_list_next(l))
+ {
+ if (eina_list_data_get(l) == _zero_block) continue;
+ _efl_ui_exact_model_block_load(l, buffer);
+ for (i = 0; i < EFL_UI_EXACT_MODEL_CONTENT; i++)
+ {
+ if (buffer[i] & EFL_UI_EXACT_MODEL_MEASURED)
+ max = MAX(max, buffer[i] & ~EFL_UI_EXACT_MODEL_MEASURED);
+ }
+ }
+ return max;
+}
+
// A block could not be compressed in the middle of a shift, and the lists are
// no longer in step with the rows. The sizes that are kept are of no use then
// and a size that is the one of another row is worse than none: they are all
@@ -538,6 +560,10 @@ _efl_ui_exact_model_shift(Efl_Ui_Exact_Model_Data *root, unsigned int index, Ein
}
if (h & EFL_UI_EXACT_MODEL_MEASURED)
root->total_size.height -= h & ~EFL_UI_EXACT_MODEL_MEASURED;
+ // The total width is the widest row: only when it was that one is it to be looked for again
+ if ((w & EFL_UI_EXACT_MODEL_MEASURED) &&
+ (w & ~EFL_UI_EXACT_MODEL_MEASURED) >= root->total_size.width)
+ root->total_size.width = _efl_ui_exact_model_width_max(root->compressed.width);
}
}
diff --git a/src/tests/elementary/efl_ui_model.c b/src/tests/elementary/efl_ui_model.c
index 0636040e8a..04bb0e416b 100644
--- a/src/tests/elementary/efl_ui_model.c
+++ b/src/tests/elementary/efl_ui_model.c
@@ -886,6 +886,37 @@ EFL_START_TEST(efl_ui_exact_model_shift_unmeasured)
}
EFL_END_TEST
+// The total width is the one of the widest row, and goes down with it.
+EFL_START_TEST(efl_ui_exact_model_remove_widest)
+{
+ Shift_Rows *sr = _shift_new(1100);
+ Eo *r[4];
+ unsigned int w[4] = { 20, 80, 90, 20 };
+ unsigned int at[4] = { 5, 3, 1030, 7 };
+ unsigned int i;
+
+ for (i = 0; i < 4; i++)
+ {
+ r[i] = sr->cur[at[i]];
+ efl_future_then(r[i], efl_model_property_set(r[i], "self.width", eina_value_uint_new(w[i])));
+ }
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 90);
+
+ // Not the widest: nothing changes
+ _shift_remove(sr, 5);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 90);
+ // The widest, in another block than the others
+ _shift_remove(sr, 1029);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 80);
+ _shift_remove(sr, 3);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 20);
+ ck_assert_uint_eq(efl_composite_model_index_get(r[3]), 5);
+ _shift_remove(sr, 5);
+ ck_assert_uint_eq(_property_uint_expected(sr->model, "total.width"), 0);
+ _shift_free(sr);
+}
+EFL_END_TEST
+
// Blocks that are all measured: what falls out of the last block as the rows
// move is a size too, and has a block of its own.
EFL_START_TEST(efl_ui_exact_model_shift_overflow)
@@ -981,5 +1012,6 @@ efl_ui_model(TCase *tc)
tcase_add_test(tc, efl_ui_exact_model_removed_row_write);
tcase_add_test(tc, efl_ui_exact_model_shift_unmeasured);
tcase_add_test(tc, efl_ui_exact_model_shift_overflow);
+ tcase_add_test(tc, efl_ui_exact_model_remove_widest);
tcase_add_test(tc, efl_ui_exact_model_destroyed);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.