From 6e497527125e4727e6168b1ee4b54d4146808633 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 18 Sep 2019 19:31:05 -0700 Subject: [PATCH 001/115] ecore: correctly handle children removal in Efl.Composite_Model by updating all required index. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10032 --- src/lib/ecore/efl_composite_model.c | 105 ++++++++++++++++++++++------ 1 file changed, 85 insertions(+), 20 deletions(-) diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c index 26322357d2..b3896bc99e 100644 --- a/src/lib/ecore/efl_composite_model.c +++ b/src/lib/ecore/efl_composite_model.c @@ -40,7 +40,26 @@ static int _children_indexed_key(const Efl_Composite_Model_Data *node, const int *key, int length EINA_UNUSED, void *data EINA_UNUSED) { - return node->index - *key; + if (node->index > (unsigned int) *key) return 1; + if (node->index < (unsigned int) *key) return -1; + return 0; +} + +static void +_mark_greater(Efl_Composite_Model_Data *root, Eina_Array *mark, const unsigned int upper) +{ + if (!root) return ; + + if (root->index > upper) + { + eina_array_push(mark, root); + _mark_greater((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + _mark_greater((void*) EINA_RBTREE_GET(root)->son[1], mark, upper); + } + else + { + _mark_greater((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + } } static void @@ -136,20 +155,75 @@ _efl_composite_model_index_get(const Eo *obj, Efl_Composite_Model_Data *pd) return r; } +static void +_efl_composite_model_child_event(Efl_Composite_Model_Data *pd, + const Efl_Model_Children_Event *ev, + const Efl_Event_Description *description) +{ + Efl_Composite_Model_Data *cpd; + Efl_Model_Children_Event cev = { 0 }; + Eina_Array mark; + Eina_Array_Iterator iterator; + unsigned int i; + + cev.index = ev->index; + if (ev->child) + { + cev.child = _efl_composite_lookup(efl_class_get(pd->self), + pd->self, ev->child, ev->index); + } + else + { + cpd = (void*) eina_rbtree_inline_lookup(pd->indexed, &cev.index, sizeof (unsigned int), + EINA_RBTREE_CMP_KEY_CB(_children_indexed_key), NULL); + if (cpd) cev.child = efl_ref(cpd->self); + } + + if (cev.child && description == EFL_MODEL_EVENT_CHILD_REMOVED) + { + cpd = efl_data_scope_get(cev.child, EFL_COMPOSITE_MODEL_CLASS); + + // Remove child from lookup tree if it exist before triggering anything further + pd->indexed = eina_rbtree_inline_remove(pd->indexed, EINA_RBTREE_GET(cpd), + EINA_RBTREE_CMP_NODE_CB(_children_indexed_cmp), NULL); + cpd->inserted = EINA_FALSE; + efl_replace(&cpd->source, NULL); + } + + // Update all index above this one if necessaryy + eina_array_step_set(&mark, sizeof (Eina_Array), 8); + _mark_greater((void*) pd->indexed, &mark, cev.index); + + // Correct index of the object stored that need to + // There is no need to remove and reinsert them as their relative order will not change. + EINA_ARRAY_ITER_NEXT(&mark, i, cpd, iterator) + { + if (description == EFL_MODEL_EVENT_CHILD_REMOVED) cpd->index--; + else cpd->index++; + + efl_ref(cpd->self); + } + + efl_event_callback_call(pd->self, description, &cev); + + // Notify of the index change only after notifying of the removal top avoid overlap + EINA_ARRAY_ITER_NEXT(&mark, i, cpd, iterator) + { + efl_model_properties_changed(cpd->self, EFL_COMPOSITE_MODEL_CHILD_INDEX); + efl_unref(cpd->self); + } + eina_array_flush(&mark); + + efl_unref(cev.child); +} + static void _efl_composite_model_child_added(void *data, const Efl_Event *event) { Efl_Composite_Model_Data *pd = data; Efl_Model_Children_Event *ev = event->info; - Efl_Model_Children_Event cev = { 0 }; - cev.index = ev->index; - if (ev->child) - cev.child = _efl_composite_lookup(efl_class_get(pd->self), - pd->self, ev->child, ev->index); - efl_event_callback_call(pd->self, EFL_MODEL_EVENT_CHILD_ADDED, &cev); - - efl_unref(cev.child); + _efl_composite_model_child_event(pd, ev, EFL_MODEL_EVENT_CHILD_ADDED); } static void @@ -157,16 +231,8 @@ _efl_composite_model_child_removed(void *data, const Efl_Event *event) { Efl_Composite_Model_Data *pd = data; Efl_Model_Children_Event *ev = event->info; - Efl_Model_Children_Event cev = { 0 }; - cev.index = ev->index; - if (ev->child) - cev.child = _efl_composite_lookup(efl_class_get(pd->self), - pd->self, ev->child, ev->index); - - efl_event_callback_call(pd->self, EFL_MODEL_EVENT_CHILD_REMOVED, &cev); - - efl_unref(cev.child); + _efl_composite_model_child_event(pd, ev, EFL_MODEL_EVENT_CHILD_REMOVED); } EFL_CALLBACKS_ARRAY_DEFINE(composite_callbacks, @@ -427,8 +493,7 @@ _efl_composite_model_efl_object_destructor(Eo *obj, Efl_Composite_Model_Data *pd efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, obj); efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_PROPERTIES_CHANGED, obj); - efl_unref(pd->source); - pd->source = NULL; + efl_replace(&pd->source, NULL); } efl_destructor(efl_super(obj, EFL_COMPOSITE_MODEL_CLASS)); From 23c24b36a12079a85bfd88ea8874f3156bdc04c2 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 18 Sep 2019 19:31:39 -0700 Subject: [PATCH 002/115] ecore: update Efl.Boolean_Model to handle children removal and shifting all necessary boolean and index. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10033 --- src/lib/ecore/efl_boolean_model.c | 407 +++++++++++++++++++++++------- 1 file changed, 311 insertions(+), 96 deletions(-) diff --git a/src/lib/ecore/efl_boolean_model.c b/src/lib/ecore/efl_boolean_model.c index 2e09930fb0..4c440f1ffb 100644 --- a/src/lib/ecore/efl_boolean_model.c +++ b/src/lib/ecore/efl_boolean_model.c @@ -8,6 +8,7 @@ typedef struct _Efl_Boolean_Model_Data Efl_Boolean_Model_Data; typedef struct _Efl_Boolean_Model_Value Efl_Boolean_Model_Value; +typedef struct _Efl_Boolean_Model_Storage_Range Efl_Boolean_Model_Storage_Range; struct _Efl_Boolean_Model_Data { @@ -15,19 +16,106 @@ struct _Efl_Boolean_Model_Data Eina_Hash *values; }; +struct _Efl_Boolean_Model_Storage_Range +{ + EINA_RBTREE; + + unsigned int offset; + uint16_t length; // Maximum length of the buffer will be 256, to avoid math error we rely on 16bits here. + + // We over allocate this buffer to have things fitting in one alloc + unsigned char buffer[256]; +}; + struct _Efl_Boolean_Model_Value { Eina_Stringshare *property; - // This is not the best for supporting sparse bitfield with random insertion - // but will do for now (Would be best to have a tree of fixed size array - // or something along that line). - unsigned char *buffer; - unsigned int buffer_count; + Eina_Rbtree *buffers_root; + Efl_Boolean_Model_Storage_Range *last; Eina_Bool default_value; }; +static Eina_Rbtree_Direction +_storage_range_cmp(const Efl_Boolean_Model_Storage_Range *left, + const Efl_Boolean_Model_Storage_Range *right, + void *data EINA_UNUSED) +{ + // We should not have any overlapping range + if (left->offset < right->offset) + return EINA_RBTREE_LEFT; + return EINA_RBTREE_RIGHT; +} + +static int +_storage_range_key(const Efl_Boolean_Model_Storage_Range *node, + const unsigned int *key, int length EINA_UNUSED, void *data EINA_UNUSED) +{ + if (node->offset > *key) return 1; + if (node->offset + node->length < *key) return -1; + // The key is in the range! + return 0; +} + +static void +_storage_range_free(Eina_Rbtree *node, void *data EINA_UNUSED) +{ + free(node); +} + +static Efl_Boolean_Model_Storage_Range * +_storage_lookup(Efl_Boolean_Model_Data *pd, + const char *property, + unsigned int index, + Eina_Bool allocate, + Eina_Bool value, + Eina_Bool *found, + Eina_Bool *default_value) +{ + Efl_Boolean_Model_Storage_Range *lookup; + Efl_Boolean_Model_Value *v; + Eina_Stringshare *s; + + // Check if this is requesting a defined boolean property + // Property are defined and their value are stored on the parent BOOLEAN + s = eina_stringshare_add(property); + v = eina_hash_find(pd->parent->values, s); + eina_stringshare_del(s); + + if (!v) return NULL; + *found = EINA_TRUE; + *default_value = !!v->default_value; + + lookup = (void*) eina_rbtree_inline_lookup(v->buffers_root, &index, sizeof (unsigned int), + EINA_RBTREE_CMP_KEY_CB(_storage_range_key), NULL); + if (lookup) return lookup; + if (!allocate) return NULL; + + // The value is the same as the default value, why bother allocate + if (*default_value == value) return NULL; + + // For simplicity we do not create a sparse array, every boolean potentially needed are allocated + // FIXME: keep it a sparse allocated buffer and only allocate needed buffer on demand + do + { + lookup = calloc(1, sizeof (Efl_Boolean_Model_Storage_Range)); + if (!lookup) return NULL; + + lookup->offset = v->last ? v->last->offset + v->last->length + 1 : 0; + lookup->length = sizeof (lookup->buffer) * 8; // Number of bits in the buffer + // Initialize the buffer to the right default value + if (default_value) memset(&lookup->buffer[0], *default_value, sizeof (&lookup->buffer)); + + v->buffers_root = eina_rbtree_inline_insert(v->buffers_root, EINA_RBTREE_GET(lookup), + EINA_RBTREE_CMP_NODE_CB(_storage_range_cmp), NULL); + v->last = lookup; + } + while (v->last->offset + v->last->length < index); + + return lookup; +} + static Eina_Iterator * _efl_boolean_model_efl_model_properties_get(const Eo *obj, Efl_Boolean_Model_Data *pd) @@ -47,10 +135,12 @@ _efl_boolean_model_efl_model_property_get(const Eo *obj, Efl_Boolean_Model_Data *pd, const char *property) { - Efl_Boolean_Model_Value *v; - Eina_Stringshare *s; + Efl_Boolean_Model_Storage_Range *sr; Eina_Bool flag; unsigned int index; + unsigned int offset; + Eina_Bool found = EINA_FALSE; + Eina_Bool default_value = EINA_FALSE; if (property == NULL) return NULL; @@ -58,23 +148,20 @@ _efl_boolean_model_efl_model_property_get(const Eo *obj, if (!pd->parent) return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property); - // Check if this is requesting a defined boolean property - // Property are defined and their value are stored on the parent BOOLEAN - s = eina_stringshare_add(property); - v = eina_hash_find(pd->parent->values, s); - eina_stringshare_del(s); - - if (!v) // Not a property handle by this object, forward - return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property); - index = efl_composite_model_index_get(obj); - // As an optimization we do optimistically allocate the boolean array - // Better would be to have a sparse boolean array - if ((index >> 3) >= v->buffer_count) - flag = v->default_value; - else - flag = v->buffer[index >> 3] & (((unsigned char)1) << (index & 0x7)); + + sr = _storage_lookup(pd, property, index, EINA_FALSE, EINA_FALSE, &found, &default_value); + if (!found) // Not a property handle by this object, forward + return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property); + + if (!sr) // Not found in storage, should be the default value + return eina_value_bool_new(default_value); + + // Calculate the matching offset for the requested index + offset = index - sr->offset; + + flag = sr->buffer[offset >> 3] & (((unsigned char)1) << (offset & 0x7)); return eina_value_bool_new(!!flag); } @@ -84,54 +171,45 @@ _efl_boolean_model_efl_model_property_set(Eo *obj, Efl_Boolean_Model_Data *pd, const char *property, Eina_Value *value) { - Efl_Boolean_Model_Value *v; - Eina_Stringshare *s; - Eina_Bool flag; + Efl_Boolean_Model_Storage_Range *sr; unsigned int index; + unsigned int offset; + Eina_Bool flag = EINA_FALSE; + Eina_Bool found = EINA_FALSE; + Eina_Bool convert_fail = EINA_FALSE; + Eina_Bool default_value = EINA_FALSE; - if (!property) - return efl_loop_future_rejected(obj, - EFL_MODEL_ERROR_UNKNOWN); + if (!property) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_UNKNOWN); // If we do not have a parent set that his a BOOLEAN, then we should just forward up the call if (!pd->parent) return efl_model_property_set(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property, value); - // Check if this is requesting a defined boolean property - // Property are defined and their value are stored on the parent BOOLEAN - s = eina_stringshare_add(property); - v = eina_hash_find(pd->parent->values, s); - eina_stringshare_del(s); + index = efl_composite_model_index_get(obj); + if (!eina_value_bool_convert(value, &flag)) + convert_fail = EINA_TRUE; - if (!v) + sr = _storage_lookup(pd, property, index, EINA_TRUE, flag, &found, &default_value); + if (!found) return efl_model_property_set(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property, value); - if (!eina_value_bool_convert(value, &flag)) + // Convert did fail and we actually should have a valid Boolean to put in the buffer + if (convert_fail) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_UNKNOWN); - index = efl_composite_model_index_get(obj); + if (!sr) + return efl_loop_future_resolved(obj, eina_value_bool_init(default_value)); - // We are optimistically allocating the boolean buffer now. - // Aligning it on 64bits - if (v->buffer_count < (((index) >> 3) | 0x7) + 1) - { - unsigned int rcount = (((index | 0xF) >> 3) | 0x7) + 1; - unsigned char *tmp; - - tmp = realloc(v->buffer, rcount); - if (!tmp) return efl_loop_future_rejected(obj, ENOMEM); - v->buffer = tmp; - memset(v->buffer + v->buffer_count, 0, rcount - v->buffer_count); - v->buffer_count = rcount; - } + // Calculate the matching offset for the requested index + offset = index - sr->offset; // It is assumed that during slice get the buffer is properly sized if (flag) - v->buffer[index >> 3] |= ((unsigned char)1) << (index & 0x7); + sr->buffer[offset >> 3] |= ((unsigned char)1) << (offset & 0x7); else - v->buffer[index >> 3] &= ~(((unsigned char)1) << (index & 0x7)); + sr->buffer[offset >> 3] &= ~(((unsigned char)1) << (offset & 0x7)); // Calling "properties,changed" event efl_model_properties_changed(obj, property); @@ -148,13 +226,116 @@ _boolean_value_free(void *data) eina_stringshare_del(value->property); value->property = NULL; - free(value->buffer); - value->buffer = NULL; - value->buffer_count = 0; + eina_rbtree_delete(value->buffers_root, _storage_range_free, NULL); + value->last = NULL; free(value); } +static void +_mark_greater(Efl_Boolean_Model_Storage_Range *root, Eina_Array *mark, const unsigned int upper) +{ + if (!root) return ; + + if (root->offset > upper) + { + eina_array_push(mark, root); + _mark_greater((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + _mark_greater((void*) EINA_RBTREE_GET(root)->son[1], mark, upper); + } + else + { + _mark_greater((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + } +} + +static void +_child_removed(void *data, const Efl_Event *event) +{ + Efl_Boolean_Model_Data *pd = data; + Efl_Model_Children_Event *ev = event->info; + Efl_Boolean_Model_Value *v; + Eina_Iterator *it; + Eina_Array updated; + + if (!pd->parent) return; + + eina_array_step_set(&updated, sizeof (Eina_Array), 8); + + it = eina_hash_iterator_data_new(pd->parent->values); + EINA_ITERATOR_FOREACH(it, v) + { + Efl_Boolean_Model_Storage_Range *lookup; + Eina_Array_Iterator iterator; + unsigned int i; + + // Remove the data from the buffer it belong to + lookup = (void*) eina_rbtree_inline_lookup(v->buffers_root, &ev->index, sizeof (unsigned int), + EINA_RBTREE_CMP_KEY_CB(_storage_range_key), NULL); + if (lookup) + { + unsigned char lower_mask = (((unsigned char)1) << (ev->index & 0x7)) - 1; + unsigned char upper_mask = (~(((unsigned char)1) << (ev->index & 0x7))) & (~lower_mask); + unsigned char offset = (ev->index - lookup->offset) >> 3; + uint16_t byte_length = lookup->length >> 3; + + // Manually shift all the byte in the buffer + while (offset < byte_length) + { + lookup->buffer[offset] = (lookup->buffer[offset] & upper_mask) | + ((lookup->buffer[offset] & lower_mask) << 1); + if (offset + 1 < byte_length) + lookup->buffer[offset] |= lookup->buffer[offset + 1] & 0x1; + + lower_mask = 0; + upper_mask = 0xFE; + offset++; + } + + lookup->length--; + if (lookup->length == 0) + { + v->buffers_root = eina_rbtree_inline_remove(v->buffers_root, EINA_RBTREE_GET(lookup), + EINA_RBTREE_CMP_NODE_CB(_storage_range_cmp), NULL); + free(lookup); + + if (lookup == v->last) + { + if (v->buffers_root) + { + unsigned int last_index = ev->index - 1; + + lookup = (void*) eina_rbtree_inline_lookup(v->buffers_root, &last_index, + sizeof (unsigned int), + EINA_RBTREE_CMP_KEY_CB(_storage_range_key), + NULL); + v->last = lookup; + } + else + { + // Nobody left + v->last = NULL; + } + } + } + } + + _mark_greater((void*) v->buffers_root, &updated, ev->index); + + // Correct all the buffer after it + // There is no need to remove and reinsert them as their relative order will not change. + EINA_ARRAY_ITER_NEXT(&updated, i, lookup, iterator) + { + lookup->offset--; + } + + eina_array_clean(&updated); + } + eina_iterator_free(it); + + eina_array_flush(&updated); +} + static Eo * _efl_boolean_model_efl_object_constructor(Eo *obj, Efl_Boolean_Model_Data *pd) { @@ -170,6 +351,8 @@ _efl_boolean_model_efl_object_constructor(Eo *obj, Efl_Boolean_Model_Data *pd) if (efl_isa(parent, EFL_BOOLEAN_MODEL_CLASS)) pd->parent = efl_data_scope_get(parent, EFL_BOOLEAN_MODEL_CLASS); + efl_event_callback_add(obj, EFL_MODEL_EVENT_CHILD_REMOVED, _child_removed, pd); + return obj; } @@ -220,6 +403,8 @@ struct _Eina_Iterator_Boolean Eo *obj; Efl_Boolean_Model_Data *pd; Efl_Boolean_Model_Value *v; + Efl_Boolean_Model_Storage_Range *sr; + Eina_Iterator *infix; uint64_t index; uint64_t total; @@ -227,59 +412,85 @@ struct _Eina_Iterator_Boolean Eina_Bool request; }; -static inline Eina_Bool -_lookup_next_chunk(uint64_t *index, uint64_t total, - Efl_Boolean_Model_Value *v, unsigned char pattern) +static Eina_Bool +_efl_boolean_model_iterator_storage_index_find(Eina_Iterator_Boolean *it) { - uint64_t upidx = *index >> 3; + uint16_t offset; + uint16_t byte_length; - while (upidx < v->buffer_count && - v->buffer[upidx] == pattern) - upidx++; + offset = it->index - it->sr->offset; + byte_length = it->sr->length >> 3; - *index = upidx << 3; - if (upidx == v->buffer_count && - *index >= total) return EINA_FALSE; - return EINA_TRUE; + while (offset < it->sr->length) + { + uint64_t upidx; + + upidx = offset >> 3; + + // Quickly dismiss byte that really do not match + while (upidx < byte_length && + it->sr->buffer[upidx] == (it->request ? 0x00 : 0xFF)) + upidx++; + + // Make the indexes jump + if (upidx != (offset >> 3)) + { + offset = upidx << 3; + it->index = it->sr->offset + offset; + } + + // Search inside the said byte + while (((offset >> 3) == upidx) && + (offset < it->sr->length)) + { + Eina_Bool flag = it->sr->buffer[offset >> 3] & + (((unsigned char)1) << (offset & 0x7)); + + if (it->request == !!flag) + return EINA_TRUE; + + it->index++; + offset++; + } + } + + return EINA_FALSE; +} + +static Eina_Bool +_efl_boolean_model_iterator_index_find(Eina_Iterator_Boolean *it) +{ + while (it->index < it->total) + { + // If we are not walking on an existing storage range, look for a new one + if (!it->sr) + { + if (!eina_iterator_next(it->infix, (void**) &it->sr)) + { + // All the rest of the data are not allocated and there value is still default + if (it->v->default_value != it->request) + return EINA_FALSE; + return EINA_TRUE; + } + } + + if (_efl_boolean_model_iterator_storage_index_find(it)) + return EINA_TRUE; + + // Nothing more to look at in this buffer + it->sr = NULL; + } + + return EINA_FALSE; } static Eina_Bool efl_boolean_model_iterator_next(Eina_Iterator_Boolean *it, void **data) { - uint64_t upidx; - *data = &it->index; it->index++; - retry: - if (it->index >= it->total) return EINA_FALSE; - if ((it->index >> 3) >= it->v->buffer_count) - { - if (it->v->default_value != it->request) - return EINA_FALSE; - return EINA_TRUE; - } - - upidx = it->index >> 3; - while ((it->index >> 3) == upidx) - { - Eina_Bool flag = it->v->buffer[it->index >> 3] & - (((unsigned char)1) << (it->index & 0x7)); - - if (it->request == !!flag) - break; - - it->index++; - } - - if ((it->index >> 3) != upidx) - { - if (!_lookup_next_chunk(&it->index, it->total, it->v, it->request ? 0x00 : 0xFF)) - return EINA_FALSE; - goto retry; - } - - return EINA_TRUE; + return _efl_boolean_model_iterator_index_find(it); } static Eo * @@ -291,6 +502,7 @@ efl_boolean_model_iterator_get_container(Eina_Iterator_Boolean *it) static void efl_boolean_model_iterator_free(Eina_Iterator_Boolean *it) { + eina_iterator_free(it->infix); efl_unref(it->obj); EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_NONE); free(it); @@ -314,6 +526,9 @@ _efl_boolean_model_boolean_iterator_get(Eo *obj, Efl_Boolean_Model_Data *pd, con itb->obj = efl_ref(obj); itb->pd = pd; itb->v = v; + itb->infix = eina_rbtree_iterator_infix(v->buffers_root); + // Search the first index that do have the valid value + _efl_boolean_model_iterator_index_find(itb); itb->index = 0; itb->total = efl_model_children_count_get(obj); itb->request = !!request; From af3f1b070f1ef4480694fe4ab954b83fdae43f09 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 23 Aug 2019 14:48:14 -0700 Subject: [PATCH 003/115] elementary: Efl.Ui.Image_Factory bind property also during widget creation. In the same vain as previous patch this will initialize more of the widget during its creation and reduce unecessary recalc. Reviewed-by: Marcel Hollerbach Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D9950 --- src/lib/elementary/efl_ui_image_factory.c | 22 +++++----------------- src/lib/elementary/efl_ui_image_factory.eo | 1 + 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/lib/elementary/efl_ui_image_factory.c b/src/lib/elementary/efl_ui_image_factory.c index 4d0c139e8b..0010570baa 100644 --- a/src/lib/elementary/efl_ui_image_factory.c +++ b/src/lib/elementary/efl_ui_image_factory.c @@ -35,34 +35,22 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa efl_destructor(efl_super(obj, MY_CLASS)); } -static Eina_Value -_efl_ui_image_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value value) +EOLIAN static void +_efl_ui_image_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, Efl_Gfx_Entity *ui_view) { - Efl_Ui_Image_Factory_Data *pd = data; - Efl_Gfx_Entity *entity; - int len, i; + efl_ui_property_bind(ui_view, "filename", pd->property); - EINA_VALUE_ARRAY_FOREACH(&value, len, i, entity) - efl_ui_property_bind(entity, "filename", pd->property); - - return value; + efl_ui_factory_building(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), ui_view); } EOLIAN static Eina_Future * _efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, Eina_Iterator *models, Efl_Gfx_Entity *parent) { - Eina_Future *f; - if (!parent) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED); if (!pd->property) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED); - f = efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models, parent); - - return efl_future_then(obj, f, - .success_type = EINA_VALUE_TYPE_ARRAY, - .success = _efl_ui_image_factory_bind, - .data = pd); + return efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models, parent); } EOLIAN static Eina_Error diff --git a/src/lib/elementary/efl_ui_image_factory.eo b/src/lib/elementary/efl_ui_image_factory.eo index 5ebcc1cd32..57acc7ea12 100644 --- a/src/lib/elementary/efl_ui_image_factory.eo +++ b/src/lib/elementary/efl_ui_image_factory.eo @@ -5,6 +5,7 @@ class @beta Efl.Ui.Image_Factory extends Efl.Ui.Caching_Factory Efl.Object.constructor; Efl.Object.destructor; Efl.Ui.Factory.create; + Efl.Ui.Factory.building; Efl.Ui.Property_Bind.property_bind; } } From 3c0b496ad34289b9e09a1d357bea31fb0069544a Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 23 Aug 2019 14:51:54 -0700 Subject: [PATCH 004/115] elementary: Efl.Ui.Layout_Factory bind property during widget creation. In the same vain as previous patch this will initialize more of the widget during its creation and reduce unecessary recalc. Reviewed-by: Marcel Hollerbach Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D9951 --- src/lib/elementary/efl_ui_layout_factory.c | 39 ++++----------------- src/lib/elementary/efl_ui_layout_factory.eo | 1 - 2 files changed, 6 insertions(+), 34 deletions(-) diff --git a/src/lib/elementary/efl_ui_layout_factory.c b/src/lib/elementary/efl_ui_layout_factory.c index 58c8235b9e..ed9d975d40 100644 --- a/src/lib/elementary/efl_ui_layout_factory.c +++ b/src/lib/elementary/efl_ui_layout_factory.c @@ -70,48 +70,21 @@ _efl_ui_layout_factory_efl_object_destructor(Eo *obj, Efl_Ui_Layout_Factory_Data efl_destructor(efl_super(obj, MY_CLASS)); } -static Eina_Value -_efl_ui_layout_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value value) -{ - Efl_Ui_Layout_Factory_Data *pd = data; - Efl_Gfx_Entity *layout; - int len, i; - - EINA_VALUE_ARRAY_FOREACH(&value, len, i, layout) - { - eina_hash_foreach(pd->bind.properties, _property_bind, layout); - eina_hash_foreach(pd->bind.factories, _factory_bind, layout); - - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0); - evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - } - - return value; -} - static void _efl_ui_layout_factory_efl_ui_factory_building(const Eo *obj, Efl_Ui_Layout_Factory_Data *pd, Efl_Gfx_Entity *ui_view) { if (pd->klass || pd->group || pd->style) efl_ui_layout_theme_set(ui_view, pd->klass, pd->group, pd->style); + eina_hash_foreach(pd->bind.properties, _property_bind, ui_view); + eina_hash_foreach(pd->bind.factories, _factory_bind, ui_view); + + efl_gfx_hint_weight_set(ui_view, EFL_GFX_HINT_EXPAND, 0); + efl_gfx_hint_fill_set(ui_view, EINA_TRUE, EINA_TRUE); + efl_ui_factory_building(efl_super(obj, EFL_UI_LAYOUT_FACTORY_CLASS), ui_view); } -EOLIAN static Eina_Future * -_efl_ui_layout_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Layout_Factory_Data *pd, - Eina_Iterator *models, Efl_Gfx_Entity *parent) -{ - Eina_Future *f; - - f = efl_ui_factory_create(efl_super(obj, EFL_UI_LAYOUT_FACTORY_CLASS), models, parent); - - return efl_future_then(obj, f, - .success_type = EINA_VALUE_TYPE_ARRAY, - .success = _efl_ui_layout_factory_bind, - .data = pd); -} - EOLIAN static void _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd, const char *key, Efl_Ui_Factory *factory) diff --git a/src/lib/elementary/efl_ui_layout_factory.eo b/src/lib/elementary/efl_ui_layout_factory.eo index d6d473e655..0d35d21706 100644 --- a/src/lib/elementary/efl_ui_layout_factory.eo +++ b/src/lib/elementary/efl_ui_layout_factory.eo @@ -15,7 +15,6 @@ class @beta Efl.Ui.Layout_Factory extends Efl.Ui.Caching_Factory implements { Efl.Object.constructor; Efl.Object.destructor; - Efl.Ui.Factory.create; Efl.Ui.Factory.building; Efl.Ui.Property_Bind.property_bind; Efl.Ui.Factory_Bind.factory_bind; From 759ac54e7f779456e01c194861a6d29465766275 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 3 Sep 2019 14:48:58 +0200 Subject: [PATCH 005/115] efl: split Efl.Ui.Factory.create stage into constructing and building constructing is called during construction time, building is called after finalize. This is usefull for theme related properties that can only be set after the theme is applied, which happens during finalize. Being event allow the user of the factory to add more initialization without needing to implement any new class. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D9952 --- src/lib/efl/interfaces/efl_interfaces_main.c | 10 ++---- src/lib/efl/interfaces/efl_ui_factory.eo | 18 +++++------ src/lib/elementary/efl_ui_caching_factory.c | 5 +-- src/lib/elementary/efl_ui_image_factory.c | 19 ++++++----- src/lib/elementary/efl_ui_image_factory.eo | 1 - src/lib/elementary/efl_ui_layout_factory.c | 33 +++++++++++--------- src/lib/elementary/efl_ui_layout_factory.eo | 1 - src/lib/elementary/efl_ui_widget_factory.c | 32 +++++++++++++++++-- src/lib/elementary/efl_ui_widget_factory.eo | 3 +- 9 files changed, 73 insertions(+), 49 deletions(-) diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 36e962bc1e..4f144bebcf 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -118,15 +118,11 @@ __efl_internal_init(void) static Eina_Value _efl_ui_view_factory_item_created(Eo *factory, void *data EINA_UNUSED, const Eina_Value v) { - Efl_Ui_Factory_Item_Created_Event event = { NULL, NULL }; + Efl_Gfx_Entity *item; int len, i; - EINA_VALUE_ARRAY_FOREACH(&v, len, i, event.item) - { - event.model = efl_ui_view_model_get(event.item); - - efl_event_callback_call(factory, EFL_UI_FACTORY_EVENT_CREATED, &event); - } + EINA_VALUE_ARRAY_FOREACH(&v, len, i, item) + efl_event_callback_call(factory, EFL_UI_FACTORY_EVENT_ITEM_CREATED, item); return v; } diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo index eded76f197..bd3d84f11b 100644 --- a/src/lib/efl/interfaces/efl_ui_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_factory.eo @@ -11,6 +11,8 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind This object represents a Factory in the factory pattern. Objects should be created via the method @Efl.Ui.View_Factory.create_with_event, which will in turn call the necessary APIs from this interface. Objects created this way should be removed using @.release. + + It is recommended to not create your own @Efl.Ui.Factory and use event handler as much as possible. ]] methods { create @protected { @@ -31,18 +33,12 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind ui_view: Efl.Gfx.Entity; [[Object to remove.]] } } - building @const { - [[This function is called during the creation of an UI object between the @Efl.Object.constructor and - @Efl.Object.finalize call. - - Note: If the @Efl.Ui.Factory does keep a cache of objects, this won't be called when objects are pulled out - of the cache.]] - params { - ui_view: Efl.Gfx.Entity; [[The UI object being created.]] - } - } } events { - created: Efl.Ui.Factory_Item_Created_Event; [[Event triggered when an item has been successfully created.]] + item,constructing: Efl.Gfx.Entity; [[Event triggered when an item is under construction (between the @Efl.Object.constructor and @Efl.Object.finalize call on the item). + Note: If the @Efl.Ui.Factory does keep a cache of objects, this won't be called when objects are pulled out of the cache.]] + item,building: Efl.Gfx.Entity; [[Event triggered when an item has processed @Efl.Object.finalize, but before all the factory are done building it. + Note: if the @Efl.Ui.Factory does keep a cache of object, this will be called when object are pulled out of the cache.]] + item,created: Efl.Gfx.Entity; [[Event triggered when an item has been successfully created by the factory and is about to be used by an @Efl.Ui.View.]] } } diff --git a/src/lib/elementary/efl_ui_caching_factory.c b/src/lib/elementary/efl_ui_caching_factory.c index 09ec342845..843871ebe1 100644 --- a/src/lib/elementary/efl_ui_caching_factory.c +++ b/src/lib/elementary/efl_ui_caching_factory.c @@ -246,8 +246,9 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, EINA_ITERATOR_FOREACH(models, model) { w = efl_add(pd->klass, parent, - efl_ui_factory_building(obj, efl_added), - efl_ui_view_model_set(efl_added, model)); + efl_ui_view_model_set(efl_added, model), + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, efl_added)); + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, w); eina_value_array_append(&gr->done, w); } diff --git a/src/lib/elementary/efl_ui_image_factory.c b/src/lib/elementary/efl_ui_image_factory.c index 0010570baa..615f202d38 100644 --- a/src/lib/elementary/efl_ui_image_factory.c +++ b/src/lib/elementary/efl_ui_image_factory.c @@ -15,12 +15,23 @@ typedef struct _Efl_Ui_Image_Factory_Data Eina_Stringshare *property; } Efl_Ui_Image_Factory_Data; +static void +_efl_ui_image_factory_building(void *data, const Efl_Event *ev) +{ + Efl_Ui_Image_Factory_Data *pd = data; + Efl_Gfx_Entity *ui_view = ev->info; + + efl_ui_property_bind(ui_view, "filename", pd->property); +} + EOLIAN static Eo * _efl_ui_image_factory_efl_object_constructor(Eo *obj, Efl_Ui_Image_Factory_Data *pd) { obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_ui_widget_factory_item_class_set(obj, EFL_UI_IMAGE_CLASS); + efl_event_callback_add(obj, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, _efl_ui_image_factory_building, pd); + pd->property = NULL; return obj; @@ -35,14 +46,6 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa efl_destructor(efl_super(obj, MY_CLASS)); } -EOLIAN static void -_efl_ui_image_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, Efl_Gfx_Entity *ui_view) -{ - efl_ui_property_bind(ui_view, "filename", pd->property); - - efl_ui_factory_building(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), ui_view); -} - EOLIAN static Eina_Future * _efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, Eina_Iterator *models, Efl_Gfx_Entity *parent) diff --git a/src/lib/elementary/efl_ui_image_factory.eo b/src/lib/elementary/efl_ui_image_factory.eo index 57acc7ea12..5ebcc1cd32 100644 --- a/src/lib/elementary/efl_ui_image_factory.eo +++ b/src/lib/elementary/efl_ui_image_factory.eo @@ -5,7 +5,6 @@ class @beta Efl.Ui.Image_Factory extends Efl.Ui.Caching_Factory Efl.Object.constructor; Efl.Object.destructor; Efl.Ui.Factory.create; - Efl.Ui.Factory.building; Efl.Ui.Property_Bind.property_bind; } } diff --git a/src/lib/elementary/efl_ui_layout_factory.c b/src/lib/elementary/efl_ui_layout_factory.c index ed9d975d40..cfc2749dd3 100644 --- a/src/lib/elementary/efl_ui_layout_factory.c +++ b/src/lib/elementary/efl_ui_layout_factory.c @@ -44,6 +44,22 @@ _factory_bind(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data, vo return EINA_TRUE; } +static void +_efl_ui_layout_factory_building(void *data, const Efl_Event *event) +{ + Efl_Ui_Layout_Factory_Data *pd = data; + Efl_Gfx_Entity *ui_view = event->info; + + if (pd->klass || pd->group || pd->style) + efl_ui_layout_theme_set(ui_view, pd->klass, pd->group, pd->style); + + eina_hash_foreach(pd->bind.properties, _property_bind, ui_view); + eina_hash_foreach(pd->bind.factories, _factory_bind, ui_view); + + efl_gfx_hint_weight_set(ui_view, EFL_GFX_HINT_EXPAND, 0); + efl_gfx_hint_fill_set(ui_view, EINA_TRUE, EINA_TRUE); +} + EOLIAN static Eo * _efl_ui_layout_factory_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Factory_Data *pd) { @@ -54,6 +70,8 @@ _efl_ui_layout_factory_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Factory_Dat pd->bind.properties = eina_hash_stringshared_new(EINA_FREE_CB(eina_stringshare_del)); pd->bind.factories = eina_hash_stringshared_new(EINA_FREE_CB(efl_unref)); + efl_event_callback_add(obj, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, _efl_ui_layout_factory_building, pd); + return obj; } @@ -70,21 +88,6 @@ _efl_ui_layout_factory_efl_object_destructor(Eo *obj, Efl_Ui_Layout_Factory_Data efl_destructor(efl_super(obj, MY_CLASS)); } -static void -_efl_ui_layout_factory_efl_ui_factory_building(const Eo *obj, Efl_Ui_Layout_Factory_Data *pd, Efl_Gfx_Entity *ui_view) -{ - if (pd->klass || pd->group || pd->style) - efl_ui_layout_theme_set(ui_view, pd->klass, pd->group, pd->style); - - eina_hash_foreach(pd->bind.properties, _property_bind, ui_view); - eina_hash_foreach(pd->bind.factories, _factory_bind, ui_view); - - efl_gfx_hint_weight_set(ui_view, EFL_GFX_HINT_EXPAND, 0); - efl_gfx_hint_fill_set(ui_view, EINA_TRUE, EINA_TRUE); - - efl_ui_factory_building(efl_super(obj, EFL_UI_LAYOUT_FACTORY_CLASS), ui_view); -} - EOLIAN static void _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd, const char *key, Efl_Ui_Factory *factory) diff --git a/src/lib/elementary/efl_ui_layout_factory.eo b/src/lib/elementary/efl_ui_layout_factory.eo index 0d35d21706..ac15fcc73d 100644 --- a/src/lib/elementary/efl_ui_layout_factory.eo +++ b/src/lib/elementary/efl_ui_layout_factory.eo @@ -15,7 +15,6 @@ class @beta Efl.Ui.Layout_Factory extends Efl.Ui.Caching_Factory implements { Efl.Object.constructor; Efl.Object.destructor; - Efl.Ui.Factory.building; Efl.Ui.Property_Bind.property_bind; Efl.Ui.Factory_Bind.factory_bind; } diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index ffb02753d9..0d6f64194a 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -69,8 +69,20 @@ _efl_ui_widget_factory_item_class_get(const Eo *obj EINA_UNUSED, } static void -_efl_ui_widget_factory_efl_ui_factory_building(const Eo *factory EINA_UNUSED, Efl_Ui_Widget_Factory_Data *pd, Efl_Gfx_Entity *ui_view) +_efl_ui_widget_factory_constructing(void *data EINA_UNUSED, const Efl_Event *ev) { + Efl_Gfx_Entity *ui_view = ev->info; + + /* NOP */ + (void)(ui_view); +} + + +static void +_efl_ui_widget_factory_building(void *data, const Efl_Event *ev) +{ + Efl_Gfx_Entity *ui_view = ev->info; + Efl_Ui_Widget_Factory_Data *pd = data; const Efl_Model *model; Eina_Value *property, *width, *height; Efl_Ui_Bind_Part_Data *bpd; @@ -122,6 +134,21 @@ _efl_ui_widget_factory_efl_ui_factory_building(const Eo *factory EINA_UNUSED, Ef eina_value_free(property); } +EFL_CALLBACKS_ARRAY_DEFINE(item_callbacks, + { EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, _efl_ui_widget_factory_constructing }, + { EFL_UI_FACTORY_EVENT_ITEM_BUILDING, _efl_ui_widget_factory_building }) + +static Eo * +_efl_ui_widget_factory_efl_object_constructor(Efl_Ui_Widget_Factory *obj, + Efl_Ui_Widget_Factory_Data *pd) +{ + obj = efl_constructor(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS)); + + efl_event_callback_array_add(obj, item_callbacks(), pd); + + return obj; +} + static Efl_Ui_Widget * _efl_ui_widget_create(const Efl_Ui_Factory *factory, const Efl_Class *klass, Eo *parent, @@ -131,7 +158,8 @@ _efl_ui_widget_create(const Efl_Ui_Factory *factory, w = efl_add(klass, parent, efl_ui_view_model_set(efl_added, model), - efl_ui_factory_building(factory, efl_added)); + efl_event_callback_call((Efl_Ui_Factory *) factory, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, efl_added)); + efl_event_callback_call((Efl_Ui_Factory *) factory, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, w); return w; } diff --git a/src/lib/elementary/efl_ui_widget_factory.eo b/src/lib/elementary/efl_ui_widget_factory.eo index fdf537c1a7..c00775a224 100644 --- a/src/lib/elementary/efl_ui_widget_factory.eo +++ b/src/lib/elementary/efl_ui_widget_factory.eo @@ -4,7 +4,6 @@ class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Fa This factory is designed to build @Efl.Ui.Widget and optionally set their @Efl.Ui.Widget.style if it was connected with @Efl.Ui.Property_Bind.property_bind "$style". - ]] methods { @property item_class { @@ -18,9 +17,9 @@ class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Fa } implements { + Efl.Object.constructor; Efl.Ui.Factory.create; Efl.Ui.Factory.release; - Efl.Ui.Factory.building; Efl.Ui.Property_Bind.property_bind; Efl.Part.part_get; } From 892c26f906d23595b709b834dde6b032bdd6d89d Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Sun, 15 Sep 2019 20:50:05 -0700 Subject: [PATCH 006/115] efl: simplify logic for widget created by factory. In an attempt to make things more complex than they should have been, I tried to change the inheritance tree on the fly and assume widget would rely on autodeleting its children. This is way more complex of a solution than to let the View actually release all the child manually and just set the window as the default parent.h Co-authored-by: Marcel Hollerbach Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D9953 --- .../elementary/layout_property_bind.c | 2 +- src/lib/efl/interfaces/efl_interfaces_main.c | 7 +- src/lib/efl/interfaces/efl_ui_factory.eo | 1 - src/lib/efl/interfaces/efl_ui_view_factory.eo | 1 - src/lib/elementary/efl_ui_caching_factory.c | 76 +++++++++---------- src/lib/elementary/efl_ui_caching_factory.eo | 2 +- src/lib/elementary/efl_ui_image_factory.c | 6 +- src/lib/elementary/efl_ui_layout.c | 4 +- src/lib/elementary/efl_ui_list_view.c | 4 +- src/lib/elementary/efl_ui_widget_factory.c | 32 ++++++-- src/lib/elementary/efl_ui_widget_factory.eo | 1 + src/lib/elementary/elm_priv.h | 2 + 12 files changed, 74 insertions(+), 64 deletions(-) diff --git a/src/examples/elementary/layout_property_bind.c b/src/examples/elementary/layout_property_bind.c index da4c5e6020..f9c5cf979e 100644 --- a/src/examples/elementary/layout_property_bind.c +++ b/src/examples/elementary/layout_property_bind.c @@ -169,7 +169,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) efl_ui_property_bind(img_factory, "", "path"); //connect to "path" property efl_ui_factory_bind(priv->bt, "icon", img_factory); - efl_future_then(win, efl_ui_view_factory_create_with_event(img_factory, NULL, bxr), + efl_future_then(win, efl_ui_view_factory_create_with_event(img_factory, NULL), .success = _wait_for_image, .data = priv); diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 4f144bebcf..91b7ff1775 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -127,10 +127,11 @@ _efl_ui_view_factory_item_created(Eo *factory, void *data EINA_UNUSED, const Ein return v; } -static Eina_Future * -_efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent) +EOLIAN static Eina_Future * +_efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models) { - return efl_future_then(factory, efl_ui_factory_create(factory, models, parent), + EINA_SAFETY_ON_NULL_RETURN_VAL(factory, NULL); + return efl_future_then(factory, efl_ui_factory_create(factory, models), .success_type = EINA_VALUE_TYPE_ARRAY, .success = _efl_ui_view_factory_item_created); } diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo index bd3d84f11b..7eda0c6c84 100644 --- a/src/lib/efl/interfaces/efl_ui_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_factory.eo @@ -23,7 +23,6 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind params { models: iterator; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]] - parent: Efl.Gfx.Entity; [[Efl canvas.]] } return: future; [[Created UI object.]] } diff --git a/src/lib/efl/interfaces/efl_ui_view_factory.eo b/src/lib/efl/interfaces/efl_ui_view_factory.eo index bb1e4a44c3..728c25907c 100644 --- a/src/lib/efl/interfaces/efl_ui_view_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_view_factory.eo @@ -12,7 +12,6 @@ class @beta Efl.Ui.View_Factory event onto.]] models: iterator; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]] - parent: Efl.Gfx.Entity; [[Efl canvas]] } return: future; [[Created UI object]] } diff --git a/src/lib/elementary/efl_ui_caching_factory.c b/src/lib/elementary/efl_ui_caching_factory.c index 843871ebe1..3035c308b4 100644 --- a/src/lib/elementary/efl_ui_caching_factory.c +++ b/src/lib/elementary/efl_ui_caching_factory.c @@ -125,7 +125,7 @@ _efl_ui_caching_factory_create_then(Eo *model, void *data, const Eina_Value v) // This is not ideal, we would want to gather all the request in one swoop here, // left for later improvement. f = efl_ui_factory_create(efl_super(r->factory, EFL_UI_CACHING_FACTORY_CLASS), - EINA_C_ARRAY_ITERATOR_NEW(models), r->parent); + EINA_C_ARRAY_ITERATOR_NEW(models)); f = efl_future_then(r->factory, f, .success = _efl_ui_caching_factory_uncap_then, .success_type = EINA_VALUE_TYPE_ARRAY); @@ -135,7 +135,6 @@ _efl_ui_caching_factory_create_then(Eo *model, void *data, const Eina_Value v) eina_hash_del(r->pd->lookup, style, w); _efl_ui_caching_factory_remove(r->pd, eina_list_data_find(r->pd->cache, w), w); - efl_parent_set(w, r->parent); efl_ui_view_model_set(w, model); return eina_value_object_init(w); @@ -178,7 +177,7 @@ _efl_ui_caching_factory_group_cleanup(Eo *o EINA_UNUSED, void *data, const Eina_ static Eina_Future * _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Caching_Factory_Data *pd, - Eina_Iterator *models, Efl_Gfx_Entity *parent) + Eina_Iterator *models) { Efl_Ui_Caching_Factory_Request *r; Efl_Ui_Caching_Factory_Group_Request *gr; @@ -195,7 +194,6 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, if (!r) return efl_loop_future_rejected(obj, ENOMEM); r->pd = pd; - r->parent = efl_ref(parent); r->factory = efl_ref(obj); all = calloc(1, sizeof (Eina_Future *)); @@ -231,7 +229,6 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, { w = eina_list_data_get(pd->cache); _efl_ui_caching_factory_remove(pd, pd->cache, w); - efl_parent_set(w, parent); efl_ui_view_model_set(w, model); @@ -243,9 +240,11 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, // Now create object on the fly that are missing from the cache if (pd->klass) { + Efl_Ui_Widget *widget = efl_ui_widget_factory_widget_get(obj); + EINA_ITERATOR_FOREACH(models, model) { - w = efl_add(pd->klass, parent, + w = efl_add(pd->klass, widget, efl_ui_view_model_set(efl_added, model), efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, efl_added)); efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, w); @@ -260,8 +259,7 @@ _efl_ui_caching_factory_efl_ui_factory_create(Eo *obj, return f; } - f = efl_ui_factory_create(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), - models, parent); + f = efl_ui_factory_create(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), models); return efl_future_then(obj, f, .success = _efl_ui_caching_factory_group_create_then, .success_type = EINA_VALUE_TYPE_ARRAY, @@ -357,7 +355,6 @@ _efl_ui_caching_factory_efl_ui_factory_release(Eo *obj, } // Change parent, disconnect the object and make it invisible - efl_parent_set(ui_view, obj); efl_gfx_entity_visible_set(ui_view, EINA_FALSE); efl_ui_view_model_set(ui_view, NULL); @@ -379,29 +376,6 @@ _efl_ui_caching_factory_efl_ui_factory_release(Eo *obj, _efl_ui_caching_factory_flush(obj, pd); } -static void -_efl_ui_caching_factory_efl_object_invalidate(Eo *obj EINA_UNUSED, - Efl_Ui_Caching_Factory_Data *pd) -{ - // As all the objects in the cache have the factory as parent, there's no need to unparent them - pd->cache = eina_list_free(pd->cache); - eina_hash_free(pd->lookup); - pd->lookup = NULL; - pd->invalidated = EINA_TRUE; -} - -static Efl_App * -_efl_ui_caching_factory_app_get(Eo *obj) -{ - Efl_Object *p; - - p = efl_parent_get(obj); - if (!p) return NULL; - - // It is acceptable to just have a loop as parent and not an app - return efl_provider_find(obj, EFL_APP_CLASS); -} - static void _efl_ui_caching_factory_pause(void *data, const Efl_Event *event EINA_UNUSED) { @@ -418,18 +392,42 @@ _efl_ui_caching_factory_pause(void *data, const Efl_Event *event EINA_UNUSED) } static void -_efl_ui_caching_factory_efl_object_parent_set(Eo *obj, Efl_Ui_Caching_Factory_Data *pd, Efl_Object *parent) +_invalidate(void *data, const Efl_Event *event EINA_UNUSED) +{ + Efl_Ui_Caching_Factory_Data *pd = data; + + // As all the objects in the cache have the factory as parent, there's no need to unparent them + pd->cache = eina_list_free(pd->cache); + eina_hash_free(pd->lookup); + pd->lookup = NULL; + pd->invalidated = EINA_TRUE; +} + +static Efl_Object * +_efl_ui_caching_factory_efl_object_finalize(Eo *obj, Efl_Ui_Caching_Factory_Data *pd) { Efl_App *a; - a = _efl_ui_caching_factory_app_get(obj); - if (a) efl_event_callback_del(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd); + obj = efl_finalize(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS)); + if (!obj) return NULL; - efl_parent_set(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), parent); - - // We are fetching the parent again, just in case the update was denied - a = _efl_ui_caching_factory_app_get(obj); + a = efl_provider_find(obj, EFL_APP_CLASS); if (a) efl_event_callback_add(a, EFL_APP_EVENT_PAUSE, _efl_ui_caching_factory_pause, pd); + + // The order of the invalidate event is guaranteed to happen before any children is invalidated + // this is not the case for the children invalidate function, which can happen in random order. + efl_event_callback_add(efl_ui_widget_factory_widget_get(obj), EFL_EVENT_INVALIDATE, _invalidate, pd); + + return obj; +} + +static void +_efl_ui_caching_factory_efl_object_invalidate(Eo *obj, + Efl_Ui_Caching_Factory_Data *pd) +{ + efl_event_callback_del(efl_ui_widget_factory_widget_get(obj), EFL_EVENT_INVALIDATE, _invalidate, pd); + + efl_invalidate(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS)); } static Eina_Error diff --git a/src/lib/elementary/efl_ui_caching_factory.eo b/src/lib/elementary/efl_ui_caching_factory.eo index f0a5aae443..9907da7e05 100644 --- a/src/lib/elementary/efl_ui_caching_factory.eo +++ b/src/lib/elementary/efl_ui_caching_factory.eo @@ -41,6 +41,6 @@ class @beta Efl.Ui.Caching_Factory extends Efl.Ui.Widget_Factory Efl.Ui.Property_Bind.property_bind; Efl.Ui.Widget_Factory.item_class { get; set; } Efl.Object.invalidate; - Efl.Object.parent { set; } + Efl.Object.finalize; } } diff --git a/src/lib/elementary/efl_ui_image_factory.c b/src/lib/elementary/efl_ui_image_factory.c index 615f202d38..f8034040aa 100644 --- a/src/lib/elementary/efl_ui_image_factory.c +++ b/src/lib/elementary/efl_ui_image_factory.c @@ -47,13 +47,11 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa } EOLIAN static Eina_Future * -_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, - Eina_Iterator *models, Efl_Gfx_Entity *parent) +_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, Eina_Iterator *models) { - if (!parent) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED); if (!pd->property) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED); - return efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models, parent); + return efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models); } EOLIAN static Eina_Error diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index bcc947ba22..e0b8250f63 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -2238,9 +2238,7 @@ _efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Data *pd, Efl_Ui_Layout_F request->tracking = tracking; models[0] = efl_ui_view_model_get(pd->obj); - f = efl_ui_view_factory_create_with_event(tracking->factory, - EINA_C_ARRAY_ITERATOR_NEW(models), - pd->obj); + f = efl_ui_view_factory_create_with_event(tracking->factory, EINA_C_ARRAY_ITERATOR_NEW(models)); f = efl_future_then(pd->obj, f, .success = _content_created, .success_type = EINA_VALUE_TYPE_ARRAY, diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c index e74e15c792..8329301579 100644 --- a/src/lib/elementary/efl_ui_list_view.c +++ b/src/lib/elementary/efl_ui_list_view.c @@ -959,9 +959,7 @@ _efl_ui_list_view_efl_ui_list_view_model_realize(Eo *obj, Efl_Ui_List_View_Data tracking->pd = pd; childrens[0] = item->children; - item->layout_request = efl_ui_view_factory_create_with_event(pd->factory, - EINA_C_ARRAY_ITERATOR_NEW(childrens), - obj); + item->layout_request = efl_ui_view_factory_create_with_event(pd->factory, EINA_C_ARRAY_ITERATOR_NEW(childrens)); item->layout_request = efl_future_then(obj, item->layout_request, .success = _content_created, .success_type = EINA_VALUE_TYPE_ARRAY, diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index 0d6f64194a..a485edfe7b 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -32,6 +32,8 @@ struct _Efl_Ui_Widget_Factory_Data { const Efl_Class *klass; + Efl_Ui_Widget *parenting_widget; + Eina_Hash *parts; Eina_Stringshare *style; @@ -41,9 +43,25 @@ struct _Efl_Ui_Widget_Factory_Request { Efl_Ui_Widget_Factory_Data *pd; Efl_Ui_Factory *factory; - Eo *parent; }; +static Efl_Object * +_efl_ui_widget_factory_efl_object_finalize(Eo *obj, Efl_Ui_Widget_Factory_Data *pd) +{ + pd->parenting_widget = efl_provider_find(obj, EFL_UI_WIDGET_CLASS); + if (!pd->parenting_widget) return NULL; + + return efl_finalize(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS)); +} + +Efl_Ui_Win * +efl_ui_widget_factory_widget_get(Efl_Ui_Widget_Factory *factory) +{ + Efl_Ui_Widget_Factory_Data *pd = efl_data_scope_get(factory, EFL_UI_WIDGET_FACTORY_CLASS); + + return pd->parenting_widget; +} + static void _efl_ui_widget_factory_item_class_set(Eo *obj, Efl_Ui_Widget_Factory_Data *pd, const Efl_Class *klass) @@ -151,7 +169,8 @@ _efl_ui_widget_factory_efl_object_constructor(Efl_Ui_Widget_Factory *obj, static Efl_Ui_Widget * _efl_ui_widget_create(const Efl_Ui_Factory *factory, - const Efl_Class *klass, Eo *parent, + const Efl_Class *klass, + Efl_Ui_Widget *parent, Efl_Model *model) { Efl_Ui_Widget *w; @@ -169,7 +188,7 @@ _efl_ui_widget_factory_create_then(Eo *model, void *data, const Eina_Value v EIN Efl_Ui_Widget_Factory_Request *r = data; Efl_Ui_Widget *w; - w = _efl_ui_widget_create(r->factory, r->pd->klass, r->parent, model); + w = _efl_ui_widget_create(r->factory, r->pd->klass, r->pd->parenting_widget, model); if (!w) return eina_value_error_init(ENOMEM); return eina_value_object_init(w); } @@ -186,13 +205,12 @@ _efl_ui_widget_factory_create_cleanup(Eo *o EINA_UNUSED, void *data, const Eina_ Efl_Ui_Widget_Factory_Request *r = data; efl_unref(r->factory); - efl_unref(r->parent); free(r); } static Eina_Future * _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data *pd, - Eina_Iterator *models, Efl_Gfx_Entity *parent) + Eina_Iterator *models) { Efl_Ui_Widget_Factory_Request *r; Eina_Future **f; @@ -211,7 +229,7 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data EINA_ITERATOR_FOREACH(models, model) { - w = _efl_ui_widget_create(obj, pd->klass, parent, model); + w = _efl_ui_widget_create(obj, pd->klass, pd->parenting_widget, model); if (!w) return efl_loop_future_rejected(obj, ENOMEM); eina_value_array_append(&r, w); @@ -225,7 +243,6 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data if (!r) return efl_loop_future_rejected(obj, ENOMEM); r->pd = pd; - r->parent = efl_ref(parent); r->factory = efl_ref(obj); f = calloc(count + 1, sizeof (Eina_Future *)); @@ -249,7 +266,6 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data .free = _efl_ui_widget_factory_create_cleanup); alloc_array_error: - efl_unref(r->parent); efl_unref(r->factory); free(r); eina_iterator_free(models); diff --git a/src/lib/elementary/efl_ui_widget_factory.eo b/src/lib/elementary/efl_ui_widget_factory.eo index c00775a224..82ce7292bd 100644 --- a/src/lib/elementary/efl_ui_widget_factory.eo +++ b/src/lib/elementary/efl_ui_widget_factory.eo @@ -22,6 +22,7 @@ class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Fa Efl.Ui.Factory.release; Efl.Ui.Property_Bind.property_bind; Efl.Part.part_get; + Efl.Object.finalize; } constructors { .item_class @optional; diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index b94322c004..f1b959b69f 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -892,6 +892,8 @@ extern const char SIG_LAYOUT_UNFOCUSED[]; extern Eina_Stringshare *_property_style_ss; +Efl_Ui_Win *efl_ui_widget_factory_widget_get(Efl_Ui_Widget_Factory *factory); + extern Eina_Bool _config_profile_lock; extern Eina_FreeQ *postponed_fq; From 0a99fb87bb856bb53ef627184dc968c6ee46fc7a Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Sun, 15 Sep 2019 20:52:50 -0700 Subject: [PATCH 007/115] elementary: rework Efl.Ui.Factory to have another additional stage during releasing of items. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D9954 --- src/lib/efl/interfaces/efl_ui_factory.eo | 1 + src/lib/elementary/efl_ui_caching_factory.c | 3 +- src/lib/elementary/efl_ui_widget_factory.c | 62 +++++++++++++++++++-- 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo index 7eda0c6c84..1db7d8fb9c 100644 --- a/src/lib/efl/interfaces/efl_ui_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_factory.eo @@ -39,5 +39,6 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind item,building: Efl.Gfx.Entity; [[Event triggered when an item has processed @Efl.Object.finalize, but before all the factory are done building it. Note: if the @Efl.Ui.Factory does keep a cache of object, this will be called when object are pulled out of the cache.]] item,created: Efl.Gfx.Entity; [[Event triggered when an item has been successfully created by the factory and is about to be used by an @Efl.Ui.View.]] + item,releasing: Efl.Gfx.Entity; [[Event triggered when an item is being released by the @Efl.Ui.Factory. It must be assumed that after this call, the object can be recycle to another @Efl.Ui.View and there can be more than one call for the same item.]] } } diff --git a/src/lib/elementary/efl_ui_caching_factory.c b/src/lib/elementary/efl_ui_caching_factory.c index 3035c308b4..54f5fd9442 100644 --- a/src/lib/elementary/efl_ui_caching_factory.c +++ b/src/lib/elementary/efl_ui_caching_factory.c @@ -136,6 +136,7 @@ _efl_ui_caching_factory_create_then(Eo *model, void *data, const Eina_Value v) _efl_ui_caching_factory_remove(r->pd, eina_list_data_find(r->pd->cache, w), w); efl_ui_view_model_set(w, model); + efl_event_callback_call(r->factory, EFL_UI_FACTORY_EVENT_ITEM_BUILDING, w); return eina_value_object_init(w); } @@ -356,7 +357,7 @@ _efl_ui_caching_factory_efl_ui_factory_release(Eo *obj, // Change parent, disconnect the object and make it invisible efl_gfx_entity_visible_set(ui_view, EINA_FALSE); - efl_ui_view_model_set(ui_view, NULL); + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_RELEASING, ui_view); // Add to the cache pd->cache = eina_list_prepend(pd->cache, ui_view); diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index a485edfe7b..d7fc34ba64 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -90,9 +90,28 @@ static void _efl_ui_widget_factory_constructing(void *data EINA_UNUSED, const Efl_Event *ev) { Efl_Gfx_Entity *ui_view = ev->info; + const Efl_Model *model; + Eina_Value *width, *height; - /* NOP */ - (void)(ui_view); + model = efl_ui_view_model_get(ui_view); + + // Fetch min size from model if available to avoid recalculcating it + width = efl_model_property_get(model, "self.width"); + height = efl_model_property_get(model, "self.height"); + if (eina_value_type_get(width) != EINA_VALUE_TYPE_ERROR && + eina_value_type_get(height) != EINA_VALUE_TYPE_ERROR) + { + Eina_Size2D s; + + if (!eina_value_int_convert(width, &s.w)) s.w = 0; + if (!eina_value_int_convert(height, &s.h)) s.h = 0; + + /* efl_event_freeze(ui_view); */ + efl_key_data_set(ui_view, "efl.ui.widget.factory.size_set", (void*)EINA_TRUE); + efl_gfx_hint_size_min_set(ui_view, s); + } + eina_value_free(width); + eina_value_free(height); } @@ -109,6 +128,10 @@ _efl_ui_widget_factory_building(void *data, const Efl_Event *ev) model = efl_ui_view_model_get(ui_view); + // Check property size only if not checked yet + if (!efl_key_data_get(ui_view, "efl.ui.widget.factory.size_check")) + _efl_ui_widget_factory_constructing(data, ev); + // Bind all property before the object is finalize it = eina_hash_iterator_data_new(pd->parts); EINA_ITERATOR_FOREACH(it, bpd) @@ -152,9 +175,37 @@ _efl_ui_widget_factory_building(void *data, const Efl_Event *ev) eina_value_free(property); } +static void +_efl_ui_widget_factory_releasing(void *data, const Efl_Event *ev) +{ + Efl_Ui_Widget_Factory_Data *pd = data; + Efl_Gfx_Entity *ui_view = ev->info; + Efl_Ui_Bind_Part_Data *bpd; + Eina_Iterator *it; + + efl_key_data_set(ui_view, "efl.ui.widget.factory.size_set", NULL); + efl_key_data_set(ui_view, "efl.ui.widget.factory.size_check", NULL); + + // Bind all property before the object is finalize + it = eina_hash_iterator_data_new(pd->parts); + EINA_ITERATOR_FOREACH(it, bpd) + { + Efl_Ui_Property_Bind_Data *bppd; + Eina_List *l; + + EINA_LIST_FOREACH(bpd->properties, l, bppd) + efl_ui_property_bind(efl_part(ui_view, bpd->part), + bppd->part_property, NULL); + } + eina_iterator_free(it); + + efl_ui_view_model_set(ui_view, NULL); +} + EFL_CALLBACKS_ARRAY_DEFINE(item_callbacks, { EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, _efl_ui_widget_factory_constructing }, - { EFL_UI_FACTORY_EVENT_ITEM_BUILDING, _efl_ui_widget_factory_building }) + { EFL_UI_FACTORY_EVENT_ITEM_BUILDING, _efl_ui_widget_factory_building }, + { EFL_UI_FACTORY_EVENT_ITEM_RELEASING, _efl_ui_widget_factory_releasing }) static Eo * _efl_ui_widget_factory_efl_object_constructor(Efl_Ui_Widget_Factory *obj, @@ -273,10 +324,13 @@ alloc_array_error: } static void -_efl_ui_widget_factory_efl_ui_factory_release(Eo *obj EINA_UNUSED, +_efl_ui_widget_factory_efl_ui_factory_release(Eo *obj, Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, Efl_Gfx_Entity *ui_view) { + // There might be multiple call to releasing on the same object as every factory in the + // inheritance chain can decide to keep it for a time + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_RELEASING, ui_view); // We do not cache or track this item, just get rid of them asap efl_del(ui_view); } From 5493cc539678739471d5c6444a36dc5fdc3866a8 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Sun, 15 Sep 2019 22:39:05 -0700 Subject: [PATCH 008/115] efl: make Efl.Ui.Factory.release work in batches. This will enable better strategy in scheduling removal of object from the cache instead of doing the throttling in the View as there is a better understanding of the different layer the items are going to go through and where they will consume time. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D9955 --- src/lib/efl/interfaces/efl_ui_factory.eo | 2 +- src/lib/elementary/efl_ui_caching_factory.c | 116 ++++++++++++++------ src/lib/elementary/efl_ui_layout.c | 18 +-- src/lib/elementary/efl_ui_list_view.c | 4 +- src/lib/elementary/efl_ui_widget_factory.c | 18 ++- 5 files changed, 108 insertions(+), 50 deletions(-) diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo index 1db7d8fb9c..47dd203f6e 100644 --- a/src/lib/efl/interfaces/efl_ui_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_factory.eo @@ -29,7 +29,7 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind release { [[Release a UI object and disconnect from models.]] params { - ui_view: Efl.Gfx.Entity; [[Object to remove.]] + ui_views: iterator @move; [[Object to remove.]] } } } diff --git a/src/lib/elementary/efl_ui_caching_factory.c b/src/lib/elementary/efl_ui_caching_factory.c index 54f5fd9442..7dbfc0aae9 100644 --- a/src/lib/elementary/efl_ui_caching_factory.c +++ b/src/lib/elementary/efl_ui_caching_factory.c @@ -21,6 +21,7 @@ struct _Efl_Ui_Caching_Factory_Data // end of the list objects are added and removed. Eina_List *cache; Eina_Hash *lookup; + Eina_Future *flush; struct { unsigned int memory; @@ -57,15 +58,29 @@ _efl_ui_caching_factory_remove(Efl_Ui_Caching_Factory_Data *pd, Eina_List *l, Ef static void _efl_ui_caching_factory_item_del(Eo *obj, Efl_Ui_Caching_Factory_Data *pd, - Efl_Gfx_Entity *entity) + Eina_Iterator *entities) { - if (pd->klass) efl_del(entity); - else efl_ui_factory_release(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), entity); + if (!pd->klass) + { + efl_ui_factory_release(efl_super(obj, EFL_UI_CACHING_FACTORY_CLASS), entities); + } + else + { + Efl_Gfx_Entity *entity; + + EINA_ITERATOR_FOREACH(entities, entity) + efl_del(entity); + eina_iterator_free(entities); + } } static void _efl_ui_caching_factory_flush(Eo *obj, Efl_Ui_Caching_Factory_Data *pd) { + Eina_Array scheduled; + + eina_array_step_set(&scheduled, sizeof (Eina_Array), 8); + while (pd->limit.items != 0 && pd->current.items > pd->limit.items) { @@ -75,7 +90,8 @@ _efl_ui_caching_factory_flush(Eo *obj, Efl_Ui_Caching_Factory_Data *pd) _efl_ui_caching_factory_remove(pd, eina_list_last(pd->cache), entity); if (pd->lookup) eina_hash_del(pd->lookup, efl_ui_widget_style_get(entity), entity); - _efl_ui_caching_factory_item_del(obj, pd, entity); + + eina_array_push(&scheduled, entity); } while (pd->limit.memory != 0 && @@ -87,8 +103,13 @@ _efl_ui_caching_factory_flush(Eo *obj, Efl_Ui_Caching_Factory_Data *pd) _efl_ui_caching_factory_remove(pd, eina_list_last(pd->cache), entity); if (pd->lookup) eina_hash_del(pd->lookup, efl_ui_widget_style_get(entity), entity); - _efl_ui_caching_factory_item_del(obj, pd, entity); + + eina_array_push(&scheduled, entity); } + + // We could improve this by doing some limited batch to reduce potential spike usage + _efl_ui_caching_factory_item_del(obj, pd, eina_array_iterator_new(&scheduled)); + eina_array_flush(&scheduled); } static Eina_Value @@ -343,38 +364,67 @@ _efl_ui_caching_factory_items_limit_get(const Eo *obj EINA_UNUSED, return pd->limit.items; } -static void -_efl_ui_caching_factory_efl_ui_factory_release(Eo *obj, - Efl_Ui_Caching_Factory_Data *pd, - Efl_Gfx_Entity *ui_view) +static Eina_Value +_schedule_cache_flush(Eo *obj, void *data, const Eina_Value v) { - // Are we invalidated ? - if (pd->invalidated) - { - _efl_ui_caching_factory_item_del(obj, pd, ui_view); - return; - } - - // Change parent, disconnect the object and make it invisible - efl_gfx_entity_visible_set(ui_view, EINA_FALSE); - efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_RELEASING, ui_view); - - // Add to the cache - pd->cache = eina_list_prepend(pd->cache, ui_view); - pd->current.items++; - pd->current.memory += efl_class_memory_size_get(ui_view); - if (efl_isa(ui_view, EFL_CACHED_ITEM_INTERFACE)) - pd->current.memory += efl_cached_item_memory_size_get(ui_view); - - // Fill lookup - if (!pd->klass && efl_ui_widget_style_get(ui_view)) - { - if (!pd->lookup) pd->lookup = eina_hash_string_djb2_new(NULL); - eina_hash_direct_add(pd->lookup, efl_ui_widget_style_get(ui_view), ui_view); - } + Efl_Ui_Caching_Factory_Data *pd = data; // And check if the cache need some triming _efl_ui_caching_factory_flush(obj, pd); + + return v; +} + +static void +_schedule_done(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED) +{ + Efl_Ui_Caching_Factory_Data *pd = data; + + pd->flush = NULL; +} + +static void +_efl_ui_caching_factory_efl_ui_factory_release(Eo *obj, + Efl_Ui_Caching_Factory_Data *pd, + Eina_Iterator *ui_views) +{ + Efl_Gfx_Entity *ui_view; + + // Are we invalidated ? + if (pd->invalidated) + { + _efl_ui_caching_factory_item_del(obj, pd, ui_views); + return; + } + + EINA_ITERATOR_FOREACH(ui_views, ui_view) + { + // Change parent, disconnect the object and make it invisible + efl_gfx_entity_visible_set(ui_view, EINA_FALSE); + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_RELEASING, ui_view); + + // Add to the cache + pd->cache = eina_list_prepend(pd->cache, ui_view); + pd->current.items++; + pd->current.memory += efl_class_memory_size_get(ui_view); + if (efl_isa(ui_view, EFL_CACHED_ITEM_INTERFACE)) + pd->current.memory += efl_cached_item_memory_size_get(ui_view); + + // Fill lookup + if (!pd->klass && efl_ui_widget_style_get(ui_view)) + { + if (!pd->lookup) pd->lookup = eina_hash_string_djb2_new(NULL); + eina_hash_direct_add(pd->lookup, efl_ui_widget_style_get(ui_view), ui_view); + } + } + eina_iterator_free(ui_views); + + // Schedule a cache flush if necessary + if (!pd->flush) + pd->flush = efl_future_then(obj, efl_loop_job(efl_loop_get(obj)), + .success = _schedule_cache_flush, + .free = _schedule_done, + .data = pd); } static void diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index e0b8250f63..fd52af6f16 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -2193,14 +2193,14 @@ _content_created(Eo *obj, void *data, const Eina_Value value) { Efl_Ui_Layout_Factory_Request *request = data; Efl_Gfx_Entity *content = NULL; - Efl_Gfx_Entity *old_content; + Efl_Gfx_Entity *old_content[1]; int len, i; EINA_VALUE_ARRAY_FOREACH(&value, len, i, content) { // Recycle old content - old_content = efl_content_get(efl_part(obj, request->key)); - if (old_content) efl_ui_factory_release(request->factory, old_content); + old_content[0] = efl_content_get(efl_part(obj, request->key)); + if (old_content[0]) efl_ui_factory_release(request->factory, EINA_C_ARRAY_ITERATOR_NEW(old_content)); // Set new content efl_content_set(efl_part(obj, request->key), content); @@ -2364,7 +2364,7 @@ _efl_ui_layout_base_model_register(Eo *obj, Efl_Ui_Layout_Data *pd, EINA_ITERATOR_FOREACH(it, tuple) { Efl_Ui_Layout_Factory_Tracking *factory; - Efl_Gfx_Entity *content; + Efl_Gfx_Entity *content[1]; key = tuple->key; factory = tuple->data; @@ -2373,11 +2373,11 @@ _efl_ui_layout_base_model_register(Eo *obj, Efl_Ui_Layout_Data *pd, if (factory->in_flight) eina_future_cancel(factory->in_flight); // Cleanup content - content = efl_content_get(efl_part(obj, key)); + content[0] = efl_content_get(efl_part(obj, key)); efl_content_unset(efl_part(obj, key)); // And recycle it - if (content) efl_ui_factory_release(factory->factory, content); + if (content[0]) efl_ui_factory_release(factory->factory, EINA_C_ARRAY_ITERATOR_NEW(content)); } eina_iterator_free(it); @@ -2500,12 +2500,12 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui tracking = eina_hash_find(pd->connect.factories, ss_key); if (tracking) { - Efl_Gfx_Entity *old; + Efl_Gfx_Entity *old[1]; // Unset and recycle - old = efl_content_get(efl_part(obj, ss_key)); + old[0] = efl_content_get(efl_part(obj, ss_key)); efl_content_unset(efl_part(obj, ss_key)); - if (old) efl_ui_factory_release(tracking->factory, old); + if (old[0]) efl_ui_factory_release(tracking->factory, EINA_C_ARRAY_ITERATOR_NEW(old)); // Stop in flight request if (tracking->in_flight) eina_future_cancel(tracking->in_flight); diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c index 8329301579..cee52e1132 100644 --- a/src/lib/elementary/efl_ui_list_view.c +++ b/src/lib/elementary/efl_ui_list_view.c @@ -973,6 +973,7 @@ EOLIAN static void _efl_ui_list_view_efl_ui_list_view_model_unrealize(Eo *obj, Efl_Ui_List_View_Data *pd, Efl_Ui_List_View_Layout_Item *item) { Efl_Ui_List_View_Item_Event evt; + Efl_Gfx_Entity *entities[1]; EINA_SAFETY_ON_NULL_RETURN(item); if (!item->layout) @@ -1001,7 +1002,8 @@ _efl_ui_list_view_efl_ui_list_view_model_unrealize(Eo *obj, Efl_Ui_List_View_Dat efl_event_callback_call(obj, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, &evt); efl_canvas_group_member_remove(obj, pd->pan_obj); - efl_ui_factory_release(pd->factory, item->layout); + entities[0] = item->layout; + efl_ui_factory_release(pd->factory, EINA_C_ARRAY_ITERATOR_NEW(entities)); item->layout = NULL; } diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index d7fc34ba64..0be3e302d2 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -326,13 +326,19 @@ alloc_array_error: static void _efl_ui_widget_factory_efl_ui_factory_release(Eo *obj, Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, - Efl_Gfx_Entity *ui_view) + Eina_Iterator *ui_views) { - // There might be multiple call to releasing on the same object as every factory in the - // inheritance chain can decide to keep it for a time - efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_RELEASING, ui_view); - // We do not cache or track this item, just get rid of them asap - efl_del(ui_view); + Efl_Gfx_Entity *ui_view; + + EINA_ITERATOR_FOREACH(ui_views, ui_view) + { + // There might be multiple call to releasing on the same object as every factory in the + // inheritance chain can decide to keep it for a time + efl_event_callback_call(obj, EFL_UI_FACTORY_EVENT_ITEM_RELEASING, ui_view); + // We do not cache or track this item, just get rid of them asap + efl_del(ui_view); + } + eina_iterator_free(ui_views); } Eina_Stringshare *_property_style_ss = NULL; From 594fc084427a5c090bff02782015c070416f5c2c Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Fri, 20 Sep 2019 14:57:09 +0200 Subject: [PATCH 009/115] efl_ui_win: default the window type to basic normally when you create a window, you just want to have it beeing a basic window. If not you still can set the window type. ref T8229 Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D10049 --- src/benchmarks/elementary/collection.c | 3 +-- src/bin/elementary/test_efl_ui_animation_view.c | 6 ++---- src/bin/elementary/test_efl_ui_text.c | 12 ++++-------- src/bin/elementary/test_photocam.c | 3 +-- src/bin/elementary/test_ui_button.c | 3 +-- src/bin/elementary/test_ui_clock.c | 3 +-- src/bin/elementary/test_ui_collection.c | 3 +-- src/bin/elementary/test_ui_datepicker.c | 3 +-- src/bin/elementary/test_ui_frame.c | 3 +-- src/bin/elementary/test_ui_items.c | 3 +-- src/bin/elementary/test_ui_pager.c | 3 +-- src/bin/elementary/test_ui_pager_scroll.c | 3 +-- src/bin/elementary/test_ui_panel.c | 6 ++---- src/bin/elementary/test_ui_panes.c | 3 +-- src/bin/elementary/test_ui_progressbar.c | 3 +-- src/bin/elementary/test_ui_radio.c | 3 +-- src/bin/elementary/test_ui_relative_layout.c | 3 +-- src/bin/elementary/test_ui_scroller.c | 9 +++------ src/bin/elementary/test_ui_slider.c | 3 +-- src/bin/elementary/test_ui_slider_interval.c | 3 +-- src/bin/elementary/test_ui_spin.c | 3 +-- src/bin/elementary/test_ui_spin_button.c | 3 +-- src/bin/elementary/test_ui_spotlight.c | 9 +++------ src/bin/elementary/test_ui_tab_pager.c | 3 +-- src/bin/elementary/test_ui_tags.c | 3 +-- src/bin/elementary/test_ui_timepicker.c | 3 +-- src/bin/elementary/test_win_indicator.c | 3 +-- src/examples/elementary/efl_canvas_layout_text.c | 3 +-- src/examples/elementary/efl_ui_grid_example_1.c | 3 +-- src/examples/elementary/efl_ui_list_example_1.c | 3 +-- src/examples/elementary/efl_ui_radio_example_01.c | 3 +-- .../elementary/efl_ui_relative_layout_example_01.c | 3 +-- .../elementary/efl_ui_relative_layout_example_02.c | 3 +-- src/examples/elementary/efl_ui_theme_example_01.c | 3 +-- src/examples/elementary/efl_ui_theme_example_02.c | 3 +-- src/lib/elementary/efl_ui_win.c | 3 +++ src/lib/elementary/efl_ui_win.eo | 2 +- src/tests/elementary/efl_ui_test_widget.c | 12 ++++-------- src/tests/elementary/efl_ui_test_win.c | 12 ++++++++++++ src/tests/elementary/elm_test_win.c | 13 +++++++++++++ src/tests/elementary/suite_helpers.c | 2 +- 41 files changed, 78 insertions(+), 98 deletions(-) diff --git a/src/benchmarks/elementary/collection.c b/src/benchmarks/elementary/collection.c index 99b8472ed2..ec18d22c28 100644 --- a/src/benchmarks/elementary/collection.c +++ b/src/benchmarks/elementary/collection.c @@ -155,8 +155,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) } win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Item_Container benchmark"), + efl_text_set(efl_added, "Efl.Ui.Item_Container benchmark"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); printf("Building %d objects\n", items); diff --git a/src/bin/elementary/test_efl_ui_animation_view.c b/src/bin/elementary/test_efl_ui_animation_view.c index 36e28c4421..31bdb5bfaf 100644 --- a/src/bin/elementary/test_efl_ui_animation_view.c +++ b/src/bin/elementary/test_efl_ui_animation_view.c @@ -142,8 +142,7 @@ test_efl_ui_animation_view(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, char buf[255]; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl_Ui_Animation_View demo"), + efl_text_set(efl_added, "Efl_Ui_Animation_View demo"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); // Create a box in Canvas @@ -297,8 +296,7 @@ test_efl_ui_animation_view(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, char buf[255]; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl_Ui_Animation_View demo"), + efl_text_set(efl_added, "Efl_Ui_Animation_View demo"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); // Create a box diff --git a/src/bin/elementary/test_efl_ui_text.c b/src/bin/elementary/test_efl_ui_text.c index a939304965..8a4da1e849 100644 --- a/src/bin/elementary/test_efl_ui_text.c +++ b/src/bin/elementary/test_efl_ui_text.c @@ -42,8 +42,7 @@ test_efl_ui_text_label(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi char *markup; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Canvas_Layout"), + efl_text_set(efl_added, "Efl Canvas_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win); @@ -146,8 +145,7 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve Eo *bt; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Text"), + efl_text_set(efl_added, "Efl Ui Text"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win); @@ -205,8 +203,7 @@ test_efl_ui_text_inputfield(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED Eo *win, *bx, *en; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Text Input Field"), + efl_text_set(efl_added, "Efl Ui Text Input Field"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win); @@ -295,8 +292,7 @@ test_ui_text_item_factory(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, Eina_File *f; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Text Item Factory"), + efl_text_set(efl_added, "Efl Ui Text Item Factory"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win); diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c index 42ef33f671..6f50740386 100644 --- a/src/bin/elementary/test_photocam.c +++ b/src/bin/elementary/test_photocam.c @@ -806,8 +806,7 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE char buf[PATH_MAX]; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Image_Zoomable animation"), + efl_text_set(efl_added, "Efl.Ui.Image_Zoomable animation"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_button.c b/src/bin/elementary/test_ui_button.c index 9571930f6f..0cd1e9315c 100644 --- a/src/bin/elementary/test_ui_button.c +++ b/src/bin/elementary/test_ui_button.c @@ -30,8 +30,7 @@ test_ui_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event char buf[PATH_MAX]; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Button"), + efl_text_set(efl_added, "Efl.Ui.Button"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/bin/elementary/test_ui_clock.c b/src/bin/elementary/test_ui_clock.c index d8cfd175e1..4542fe81f3 100644 --- a/src/bin/elementary/test_ui_clock.c +++ b/src/bin/elementary/test_ui_clock.c @@ -49,8 +49,7 @@ test_ui_clock(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ Evas_Object *win, *bx; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Clock"), + efl_text_set(efl_added, "Efl.Ui.Clock"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_collection.c b/src/bin/elementary/test_ui_collection.c index 1cc275f2c1..ed98d2e377 100644 --- a/src/bin/elementary/test_ui_collection.c +++ b/src/bin/elementary/test_ui_collection.c @@ -176,8 +176,7 @@ void create_item_container_ui(const Efl_Class *collection_class, const Efl_Class Match_Content_Ctx *ctx = calloc(1, sizeof(*ctx)); win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, name), + efl_text_set(efl_added, name), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); tbl = efl_add(EFL_UI_TABLE_CLASS, win); efl_content_set(win, tbl); diff --git a/src/bin/elementary/test_ui_datepicker.c b/src/bin/elementary/test_ui_datepicker.c index 5b12f35ac4..7898f12065 100644 --- a/src/bin/elementary/test_ui_datepicker.c +++ b/src/bin/elementary/test_ui_datepicker.c @@ -19,8 +19,7 @@ test_ui_datepicker(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e Eo *win, *bx; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Datepicker"), + efl_text_set(efl_added, "Efl.Ui.Datepicker"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_frame.c b/src/bin/elementary/test_ui_frame.c index 84e574778e..4f37a26a10 100644 --- a/src/bin/elementary/test_ui_frame.c +++ b/src/bin/elementary/test_ui_frame.c @@ -16,8 +16,7 @@ test_ui_frame(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ Eo *win, *bx, *f, *txt; win = efl_add_ref(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Frame"), + efl_text_set(efl_added, "Efl.Ui.Frame"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_items.c b/src/bin/elementary/test_ui_items.c index 54dcb64767..b2540699ad 100644 --- a/src/bin/elementary/test_ui_items.c +++ b/src/bin/elementary/test_ui_items.c @@ -54,8 +54,7 @@ void test_efl_ui_item(void *data EINA_UNUSED, Eo *win, *box, *o; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Item examples"), + efl_text_set(efl_added, "Item examples"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/bin/elementary/test_ui_pager.c b/src/bin/elementary/test_ui_pager.c index df9afd5ad9..e0df202244 100644 --- a/src/bin/elementary/test_ui_pager.c +++ b/src/bin/elementary/test_ui_pager.c @@ -701,8 +701,7 @@ void test_ui_pager(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Pager"), + efl_text_set(efl_added, "Pager"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, diff --git a/src/bin/elementary/test_ui_pager_scroll.c b/src/bin/elementary/test_ui_pager_scroll.c index 1ac37da74d..b6548a4b88 100644 --- a/src/bin/elementary/test_ui_pager_scroll.c +++ b/src/bin/elementary/test_ui_pager_scroll.c @@ -901,8 +901,7 @@ void test_ui_pager_scroll(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Pager"), + efl_text_set(efl_added, "Pager"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, diff --git a/src/bin/elementary/test_ui_panel.c b/src/bin/elementary/test_ui_panel.c index 928dd2d201..d5045c6730 100644 --- a/src/bin/elementary/test_ui_panel.c +++ b/src/bin/elementary/test_ui_panel.c @@ -11,8 +11,7 @@ test_ui_panel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ Eo *win, *table, *panel; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Panel"), + efl_text_set(efl_added, "Efl.Ui.Panel"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); table = efl_add(EFL_UI_TABLE_CLASS, win, @@ -104,8 +103,7 @@ test_ui_panel2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event Eo *win, *box, *check, *btn, *table, *list, *panel; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Panel"), + efl_text_set(efl_added, "Efl.Ui.Panel"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); box = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_panes.c b/src/bin/elementary/test_ui_panes.c index 96f30fbba1..72d2ab9a09 100644 --- a/src/bin/elementary/test_ui_panes.c +++ b/src/bin/elementary/test_ui_panes.c @@ -10,8 +10,7 @@ test_panes_minsize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e Eo *win, *panes, *panes_h; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Panes"), + efl_text_set(efl_added, "Efl.Ui.Panes"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/bin/elementary/test_ui_progressbar.c b/src/bin/elementary/test_ui_progressbar.c index 016c5307a9..c0bf12f765 100644 --- a/src/bin/elementary/test_ui_progressbar.c +++ b/src/bin/elementary/test_ui_progressbar.c @@ -152,8 +152,7 @@ test_ui_progressbar(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_inf pd = (pbdata *)calloc(1, sizeof(pbdata)); pd->win = win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Progressbar"), + efl_text_set(efl_added, "Efl.Ui.Progressbar"), efl_ui_win_autodel_set(efl_added, EINA_TRUE), efl_event_callback_add(efl_added, EFL_UI_WIN_EVENT_DELETE_REQUEST, _win_delete_req_cb, pd) diff --git a/src/bin/elementary/test_ui_radio.c b/src/bin/elementary/test_ui_radio.c index 487c6aa932..e03dcf5ee0 100644 --- a/src/bin/elementary/test_ui_radio.c +++ b/src/bin/elementary/test_ui_radio.c @@ -96,8 +96,7 @@ void test_efl_ui_radio(void *data EINA_UNUSED, Efl_Ui_Button *o; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Radio_Box"), + efl_text_set(efl_added, "Efl.Ui.Radio_Box"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); table = efl_add(EFL_UI_TABLE_CLASS, win); efl_content_set(win, table); diff --git a/src/bin/elementary/test_ui_relative_layout.c b/src/bin/elementary/test_ui_relative_layout.c index e4fa8c9a59..052b3ba145 100644 --- a/src/bin/elementary/test_ui_relative_layout.c +++ b/src/bin/elementary/test_ui_relative_layout.c @@ -276,8 +276,7 @@ test_ui_relative_layout(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo Eo *win, *vbox, *f, *hbox; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), + efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); vbox = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_scroller.c b/src/bin/elementary/test_ui_scroller.c index 02cae9a6da..e5f2a6177b 100644 --- a/src/bin/elementary/test_ui_scroller.c +++ b/src/bin/elementary/test_ui_scroller.c @@ -32,8 +32,7 @@ test_efl_ui_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void int i, j; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Scroller"), + efl_text_set(efl_added, "Efl Ui Scroller"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400)); @@ -137,8 +136,7 @@ test_efl_ui_scroller_simple(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED int i; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Scroller Simple"), + efl_text_set(efl_added, "Efl Ui Scroller Simple"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400)); @@ -173,8 +171,7 @@ test_efl_ui_scroller_simple2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE int i; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Ui Scroller Simple2"), + efl_text_set(efl_added, "Efl Ui Scroller Simple2"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400)); diff --git a/src/bin/elementary/test_ui_slider.c b/src/bin/elementary/test_ui_slider.c index 36155e9e5d..5aa31004f9 100644 --- a/src/bin/elementary/test_ui_slider.c +++ b/src/bin/elementary/test_ui_slider.c @@ -53,8 +53,7 @@ test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event Eo *win, *bx, *hbx; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Slider"), + efl_text_set(efl_added, "Efl.Ui.Slider"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_slider_interval.c b/src/bin/elementary/test_ui_slider_interval.c index 75dcbe2354..186e2daadd 100644 --- a/src/bin/elementary/test_ui_slider_interval.c +++ b/src/bin/elementary/test_ui_slider_interval.c @@ -34,8 +34,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void double step; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Slider_Interval"), + efl_text_set(efl_added, "Efl.Ui.Slider_Interval"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_spin.c b/src/bin/elementary/test_ui_spin.c index 6f325bb034..965c88ea26 100644 --- a/src/bin/elementary/test_ui_spin.c +++ b/src/bin/elementary/test_ui_spin.c @@ -40,8 +40,7 @@ test_ui_spin(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i Eo *win, *bx, *sp; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spin"), + efl_text_set(efl_added, "Efl.Ui.Spin"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_spin_button.c b/src/bin/elementary/test_ui_spin_button.c index d6b9a96061..600611eb45 100644 --- a/src/bin/elementary/test_ui_spin_button.c +++ b/src/bin/elementary/test_ui_spin_button.c @@ -29,8 +29,7 @@ test_ui_spin_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void * }; win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spin_Button"), + efl_text_set(efl_added, "Efl.Ui.Spin_Button"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_ui_spotlight.c b/src/bin/elementary/test_ui_spotlight.c index c2bc6b436c..384da6e751 100644 --- a/src/bin/elementary/test_ui_spotlight.c +++ b/src/bin/elementary/test_ui_spotlight.c @@ -856,8 +856,7 @@ test_ui_spotlight_stack(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spotlight Stack"), + efl_text_set(efl_added, "Efl.Ui.Spotlight Stack"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, @@ -955,8 +954,7 @@ test_ui_spotlight_plain(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spotlight Plain"), + efl_text_set(efl_added, "Efl.Ui.Spotlight Plain"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, @@ -1050,8 +1048,7 @@ test_ui_spotlight_scroll(void *data EINA_UNUSED, int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Spotlight Scroll"), + efl_text_set(efl_added, "Efl.Ui.Spotlight Scroll"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); panes = efl_add(EFL_UI_PANES_CLASS, win, diff --git a/src/bin/elementary/test_ui_tab_pager.c b/src/bin/elementary/test_ui_tab_pager.c index 01ca807a2e..1f35bf01a8 100644 --- a/src/bin/elementary/test_ui_tab_pager.c +++ b/src/bin/elementary/test_ui_tab_pager.c @@ -104,8 +104,7 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev int i; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Tab_Pager"), + efl_text_set(efl_added, "Efl.Ui.Tab_Pager"), efl_ui_win_autodel_set(efl_added, EINA_TRUE), efl_event_callback_add(efl_added, EFL_EVENT_DEL, _win_del_cb, ad)); diff --git a/src/bin/elementary/test_ui_tags.c b/src/bin/elementary/test_ui_tags.c index efd87dc749..c5d7425fe3 100644 --- a/src/bin/elementary/test_ui_tags.c +++ b/src/bin/elementary/test_ui_tags.c @@ -60,8 +60,7 @@ test_ui_tags(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i char buf[PATH_MAX]; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Tags"), + efl_text_set(efl_added, "Efl.Ui.Tags"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); snprintf(buf, sizeof(buf), "%s/objects/multibuttonentry.edj", elm_app_data_dir_get()); diff --git a/src/bin/elementary/test_ui_timepicker.c b/src/bin/elementary/test_ui_timepicker.c index c57ee6bb2d..3249699bc8 100644 --- a/src/bin/elementary/test_ui_timepicker.c +++ b/src/bin/elementary/test_ui_timepicker.c @@ -20,8 +20,7 @@ test_ui_timepicker(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e Eo *win, *bx; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Timepicker"), + efl_text_set(efl_added, "Efl.Ui.Timepicker"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); bx = efl_add(EFL_UI_BOX_CLASS, win, diff --git a/src/bin/elementary/test_win_indicator.c b/src/bin/elementary/test_win_indicator.c index aa9606f316..98ba2e2bf3 100644 --- a/src/bin/elementary/test_win_indicator.c +++ b/src/bin/elementary/test_win_indicator.c @@ -93,8 +93,7 @@ test_win_indicator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e // FIXME: Resizing window should no cause sizing issues! win = efl_add_ref(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Win.Indicator"), + efl_text_set(efl_added, "Efl.Win.Indicator"), efl_gfx_hint_size_max_set(efl_added, EINA_SIZE2D(300, -1)), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); efl_event_callback_add(win, EFL_EVENT_DEL, _win_del, indicator); diff --git a/src/examples/elementary/efl_canvas_layout_text.c b/src/examples/elementary/efl_canvas_layout_text.c index bb4fa7b97c..593dbe8872 100644 --- a/src/examples/elementary/efl_canvas_layout_text.c +++ b/src/examples/elementary/efl_canvas_layout_text.c @@ -121,8 +121,7 @@ efl_main(void *data EINA_UNUSED, Eo *win; win = efl_add(EFL_UI_WIN_CLASS, NULL, - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl Canvas_Layout"), + efl_text_set(efl_added, "Efl Canvas_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE), efl_event_callback_add(efl_added, EFL_UI_WIN_EVENT_DELETE_REQUEST, _on_win_delete, NULL)); diff --git a/src/examples/elementary/efl_ui_grid_example_1.c b/src/examples/elementary/efl_ui_grid_example_1.c index fb854fc0e2..032e5d8fdf 100644 --- a/src/examples/elementary/efl_ui_grid_example_1.c +++ b/src/examples/elementary/efl_ui_grid_example_1.c @@ -23,8 +23,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) Efl_Ui_Item *gitem; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Grid"), + efl_text_set(efl_added, "Efl.Ui.Grid"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); box = efl_add(EFL_UI_BOX_CLASS, win); diff --git a/src/examples/elementary/efl_ui_list_example_1.c b/src/examples/elementary/efl_ui_list_example_1.c index 16664142a6..cbd05d23d1 100644 --- a/src/examples/elementary/efl_ui_list_example_1.c +++ b/src/examples/elementary/efl_ui_list_example_1.c @@ -110,8 +110,7 @@ elm_main(int argc EINA_UNUSED, char **argv) win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.List"), + efl_text_set(efl_added, "Efl.Ui.List"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); diff --git a/src/examples/elementary/efl_ui_radio_example_01.c b/src/examples/elementary/efl_ui_radio_example_01.c index b6b72e2ae2..3ab57b87fb 100644 --- a/src/examples/elementary/efl_ui_radio_example_01.c +++ b/src/examples/elementary/efl_ui_radio_example_01.c @@ -25,8 +25,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Radio example"), + efl_text_set(efl_added, "Efl.Ui.Radio example"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/examples/elementary/efl_ui_relative_layout_example_01.c b/src/examples/elementary/efl_ui_relative_layout_example_01.c index e2d2af7948..77453cf7ce 100644 --- a/src/examples/elementary/efl_ui_relative_layout_example_01.c +++ b/src/examples/elementary/efl_ui_relative_layout_example_01.c @@ -16,8 +16,7 @@ elm_main(int argc, char **argv) Eo *win, *layout, *btn1, *btn2, *btn3; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), + efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win, diff --git a/src/examples/elementary/efl_ui_relative_layout_example_02.c b/src/examples/elementary/efl_ui_relative_layout_example_02.c index fe254633bb..bc3740d601 100644 --- a/src/examples/elementary/efl_ui_relative_layout_example_02.c +++ b/src/examples/elementary/efl_ui_relative_layout_example_02.c @@ -16,8 +16,7 @@ elm_main(int argc, char **argv) Eo *win, *layout, *btn1, *btn2; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), + efl_text_set(efl_added, "Efl.Ui.Relative_Layout"), efl_ui_win_autodel_set(efl_added, EINA_TRUE)); layout = efl_add(EFL_UI_RELATIVE_LAYOUT_CLASS, win, diff --git a/src/examples/elementary/efl_ui_theme_example_01.c b/src/examples/elementary/efl_ui_theme_example_01.c index fe09a83556..27ad63f1c4 100644 --- a/src/examples/elementary/efl_ui_theme_example_01.c +++ b/src/examples/elementary/efl_ui_theme_example_01.c @@ -52,8 +52,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) efl_ui_theme_extension_add(default_theme, EXAMPLE_EDJ_FILE_PATH); win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Theme example"), + efl_text_set(efl_added, "Efl.Ui.Theme example"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/examples/elementary/efl_ui_theme_example_02.c b/src/examples/elementary/efl_ui_theme_example_02.c index 1b7e61c96a..52b1952f9d 100644 --- a/src/examples/elementary/efl_ui_theme_example_02.c +++ b/src/examples/elementary/efl_ui_theme_example_02.c @@ -52,8 +52,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) efl_ui_theme_overlay_add(default_theme, EXAMPLE_EDJ_FILE_PATH); win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Efl.Ui.Theme example"), + efl_text_set(efl_added, "Efl.Ui.Theme example"), efl_ui_win_autodel_set(efl_added, EINA_TRUE) ); diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 68ab6bfd0c..679e4aca16 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -5960,6 +5960,9 @@ _efl_ui_win_efl_object_constructor(Eo *obj, Efl_Ui_Win_Data *pd) if (!efl_parent_get(obj)) efl_allow_parent_unref_set(obj, EINA_TRUE); + if (elm_widget_is_legacy(obj)) + pd->type = EFL_UI_WIN_TYPE_BASIC; + return obj; } diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo index 30ae151ac6..bec6fdbf51 100644 --- a/src/lib/elementary/efl_ui_win.eo +++ b/src/lib/elementary/efl_ui_win.eo @@ -443,7 +443,7 @@ class Efl.Ui.Win extends Efl.Ui.Widget implements Efl.Canvas.Scene, Efl.Access.W [[If the object is not window object, returns $unknown.]] } values { - type: Efl.Ui.Win_Type(Efl.Ui.Win_Type.unknown); [[Window type]] + type: Efl.Ui.Win_Type(Efl.Ui.Win_Type.basic); [[Window type]] } } @property accel_preference @beta { diff --git a/src/tests/elementary/efl_ui_test_widget.c b/src/tests/elementary/efl_ui_test_widget.c index 23118fee86..74e8f2eac9 100644 --- a/src/tests/elementary/efl_ui_test_widget.c +++ b/src/tests/elementary/efl_ui_test_widget.c @@ -19,8 +19,7 @@ static void _small_ui(State *s) { s->win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Hello World")); + efl_text_set(efl_added, "Hello World")); s->ic = efl_add(EFL_UI_IMAGE_CLASS, s->win, efl_ui_win_icon_object_set(s->win, efl_added)); @@ -233,8 +232,7 @@ EFL_START_TEST(efl_ui_test_widget_parent_relation) Efl_Ui_Win *win, *w1, *w2, *w3; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Hello World")); + efl_text_set(efl_added, "Hello World")); //first check the initial state w1 = efl_add(efl_ui_widget_realized_class_get(), win); ck_assert_ptr_eq(efl_ui_widget_parent_get(w1), win); @@ -257,8 +255,7 @@ EFL_START_TEST(efl_ui_test_widget_disabled_parent) Efl_Ui_Win *win, *w1, *w2, *t; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Hello World")); + efl_text_set(efl_added, "Hello World")); //first check the initial state w1 = efl_add(efl_ui_widget_realized_class_get(), win); efl_ui_widget_disabled_set(w1, EINA_TRUE); @@ -293,8 +290,7 @@ EFL_START_TEST(efl_ui_test_widget_disabled_behaviour) Efl_Ui_Win *win, *w1, *w2, *t; win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), - efl_text_set(efl_added, "Hello World")); + efl_text_set(efl_added, "Hello World")); //first check the initial state w1 = efl_add(efl_ui_widget_realized_class_get(), win); efl_ui_widget_disabled_set(w1, EINA_TRUE); diff --git a/src/tests/elementary/efl_ui_test_win.c b/src/tests/elementary/efl_ui_test_win.c index 4e61e5bff2..2d893be5bb 100644 --- a/src/tests/elementary/efl_ui_test_win.c +++ b/src/tests/elementary/efl_ui_test_win.c @@ -433,6 +433,17 @@ EFL_START_TEST(efl_ui_win_test_efl_input_interface_pointer_cancel) ck_assert_int_eq(called, 2); } EFL_END_TEST + +EFL_START_TEST(efl_ui_win_test_type) +{ + Efl_Ui_Win *win; + + win = win_add(); + + ck_assert_int_eq(efl_ui_win_type_get(win), EFL_UI_WIN_TYPE_BASIC); +} +EFL_END_TEST + void efl_ui_test_win(TCase *tc) { @@ -447,4 +458,5 @@ efl_ui_test_win(TCase *tc) tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_in_out); tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_wheel); tcase_add_test(tc, efl_ui_win_test_efl_input_interface_pointer_cancel); + tcase_add_test(tc, efl_ui_win_test_type); } diff --git a/src/tests/elementary/elm_test_win.c b/src/tests/elementary/elm_test_win.c index dc335bff68..e90a31a4b6 100644 --- a/src/tests/elementary/elm_test_win.c +++ b/src/tests/elementary/elm_test_win.c @@ -465,6 +465,18 @@ EFL_START_TEST(elm_win_test_rotation) } EFL_END_TEST +EFL_START_TEST(elm_win_test_default_type) +{ + Evas_Object *win; + + win = elm_win_add(NULL, "test win default type", ELM_WIN_UNKNOWN); + ck_assert_int_eq(elm_win_type_get(win), ELM_WIN_UNKNOWN); + + win = elm_win_util_standard_add("test win default type", "test"); + ck_assert_int_eq(elm_win_type_get(win), ELM_WIN_BASIC); +} +EFL_END_TEST + void elm_test_win(TCase *tc) { tcase_add_test(tc, elm_win_legacy_type_check); @@ -475,6 +487,7 @@ void elm_test_win(TCase *tc) tcase_add_test(tc, elm_win_test_app_exit_on_windows_close); tcase_add_test(tc, efl_ui_win_multi_touch_inputs); tcase_add_test(tc, elm_win_test_rotation); + tcase_add_test(tc, elm_win_test_default_type); #ifdef HAVE_ELEMENTARY_X tcase_add_test(tc, elm_win_autohide); tcase_add_test(tc, elm_win_autohide_and_policy_quit_last_window_hidden); diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index 81da3813f6..d4204ef79e 100644 --- a/src/tests/elementary/suite_helpers.c +++ b/src/tests/elementary/suite_helpers.c @@ -201,7 +201,7 @@ _elm_suite_win_create() if (legacy_mode) win = elm_win_add(NULL, "elm_suite", ELM_WIN_BASIC); else - win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC)); + win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get()); if (!buffer) return win; loop = efl_add(efl_loop_realized_class_get(), win); timer = efl_add(EFL_LOOP_TIMER_CLASS, loop, From 047aa170fa68070bb5dd04cb2648f27e2d80fcd5 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 24 Sep 2019 15:16:45 +0200 Subject: [PATCH 010/115] efl_ui_collection: this interface is not event used Differential Revision: https://phab.enlightenment.org/D10108 --- src/lib/elementary/efl_ui_collection.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo index b6125f8560..5ed981abe8 100644 --- a/src/lib/elementary/efl_ui_collection.eo +++ b/src/lib/elementary/efl_ui_collection.eo @@ -1,5 +1,5 @@ class @beta Efl.Ui.Collection extends Efl.Ui.Layout_Base implements - Efl.Pack_Linear, Efl.Pack_Layout, + Efl.Pack_Linear, Efl.Ui.Layout_Orientable, Efl.Ui.Multi_Selectable, Efl.Ui.Focus.Manager_Sub, From da594413bef425f4032e3108817625d3106a233c Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 9 Sep 2019 11:23:04 +0200 Subject: [PATCH 011/115] declare first round of classes stable this stabelizes the "stableized" column of the efl: api workboard. fixes T8208, fixes T8158, fixes T8156, fixes T8025, fixes T8024, fixes T7976, fixes T7946, fixes T7928, fixes T7923, fixes T7905, fixes T7902, fixes T7901, fixes T7900, fixes T7898, fixes T7897, fixes T7895, fixes T7894, fixes T7893, fixes T7891, fixes T7880, fixes T7873, fixes T7869, fixes T7867, fixes T7865, fixes T7862, fixes T7854, fixes T7847, fixes T7881, fixes T7870, fixes T9086 Differential Revision: https://phab.enlightenment.org/D10008 --- src/lib/efl/interfaces/efl_pack_layout.eo | 2 +- src/lib/efl/interfaces/efl_pack_table.eo | 4 ++-- src/lib/efl/interfaces/efl_ui_range_display.eo | 2 +- src/lib/efl/interfaces/efl_ui_range_interactive.eo | 2 +- src/lib/efl/interfaces/efl_ui_scrollbar.eo | 4 ++-- src/lib/elementary/efl_ui_alert_popup.eo | 6 +++--- src/lib/elementary/efl_ui_bg.eo | 2 +- src/lib/elementary/efl_ui_box_flow.eo | 2 +- src/lib/elementary/efl_ui_check.eo | 2 +- src/lib/elementary/efl_ui_collection.eo | 4 ++-- src/lib/elementary/efl_ui_datepicker.eo | 2 +- src/lib/elementary/efl_ui_default_item.eo | 2 +- src/lib/elementary/efl_ui_format.eo | 10 +++++----- src/lib/elementary/efl_ui_grid.eo | 2 +- src/lib/elementary/efl_ui_grid_default_item.eo | 2 +- src/lib/elementary/efl_ui_image.eo | 2 +- src/lib/elementary/efl_ui_item.eo | 2 +- src/lib/elementary/efl_ui_list.eo | 2 +- src/lib/elementary/efl_ui_list_default_item.eo | 2 +- src/lib/elementary/efl_ui_popup.eo | 4 ++-- src/lib/elementary/efl_ui_popup_part_backwall.eo | 2 +- src/lib/elementary/efl_ui_radio.eo | 2 +- src/lib/elementary/efl_ui_radio_group.eo | 2 +- src/lib/elementary/efl_ui_radio_group_impl.eo | 2 +- src/lib/elementary/efl_ui_scroller.eo | 2 +- src/lib/elementary/efl_ui_slider.eo | 2 +- src/lib/elementary/efl_ui_spin.eo | 2 +- src/lib/elementary/efl_ui_timepicker.eo | 2 +- src/lib/evas/canvas/efl_input_clickable.eo | 4 ++-- 29 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/lib/efl/interfaces/efl_pack_layout.eo b/src/lib/efl/interfaces/efl_pack_layout.eo index c77e82dba5..89caa9cbce 100644 --- a/src/lib/efl/interfaces/efl_pack_layout.eo +++ b/src/lib/efl/interfaces/efl_pack_layout.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Pack_Layout +interface Efl.Pack_Layout { [[Low-level APIs for objects that can lay their children out. diff --git a/src/lib/efl/interfaces/efl_pack_table.eo b/src/lib/efl/interfaces/efl_pack_table.eo index 18adfb8225..2c9be6151c 100644 --- a/src/lib/efl/interfaces/efl_pack_table.eo +++ b/src/lib/efl/interfaces/efl_pack_table.eo @@ -1,7 +1,7 @@ -interface @beta Efl.Pack_Table extends Efl.Pack +interface Efl.Pack_Table extends Efl.Pack { [[Interface for 2D containers which arrange their elements on a table with rows and columns. - + Elements can be positioned on a specific row and column, or they can be simply added to the table using @Efl.Pack.pack and the container will chose where to put them. ]] diff --git a/src/lib/efl/interfaces/efl_ui_range_display.eo b/src/lib/efl/interfaces/efl_ui_range_display.eo index 5e67edb25d..a2d4432b7f 100644 --- a/src/lib/efl/interfaces/efl_ui_range_display.eo +++ b/src/lib/efl/interfaces/efl_ui_range_display.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Ui.Range_Display +interface Efl.Ui.Range_Display { [[Interface that contains properties regarding the displaying of a value within a range. diff --git a/src/lib/efl/interfaces/efl_ui_range_interactive.eo b/src/lib/efl/interfaces/efl_ui_range_interactive.eo index 7a37918e12..9237e9c5f1 100644 --- a/src/lib/efl/interfaces/efl_ui_range_interactive.eo +++ b/src/lib/efl/interfaces/efl_ui_range_interactive.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Ui.Range_Interactive extends Efl.Ui.Range_Display +interface Efl.Ui.Range_Interactive extends Efl.Ui.Range_Display { [[Interface that extends the normal displaying properties with usage properties. diff --git a/src/lib/efl/interfaces/efl_ui_scrollbar.eo b/src/lib/efl/interfaces/efl_ui_scrollbar.eo index f5bffe984f..8008bc7ce0 100644 --- a/src/lib/efl/interfaces/efl_ui_scrollbar.eo +++ b/src/lib/efl/interfaces/efl_ui_scrollbar.eo @@ -1,6 +1,6 @@ import efl_ui_layout_orientable; -enum @beta Efl.Ui.Scrollbar_Mode +enum Efl.Ui.Scrollbar_Mode { [[When should the scrollbar be shown.]] auto = 0, [[Visible if necessary.]] @@ -9,7 +9,7 @@ enum @beta Efl.Ui.Scrollbar_Mode last [[For internal use only.]] } -interface @beta Efl.Ui.Scrollbar +interface Efl.Ui.Scrollbar { [[Interface used by widgets which can display scrollbars, enabling them to contain more content than actually fits inside them.]] diff --git a/src/lib/elementary/efl_ui_alert_popup.eo b/src/lib/elementary/efl_ui_alert_popup.eo index 8a4e86e863..2669a553e8 100644 --- a/src/lib/elementary/efl_ui_alert_popup.eo +++ b/src/lib/elementary/efl_ui_alert_popup.eo @@ -1,16 +1,16 @@ -enum @beta Efl.Ui.Alert_Popup_Button { +enum Efl.Ui.Alert_Popup_Button { [[Defines the type of the alert button.]] positive = 0, [[Button having positive meaning. E.g. "Yes".]] negative, [[Button having negative meaning. E.g. "No".]] user [[Button having user-defined meaning. E.g. "More information".]] } -struct @beta Efl.Ui.Alert_Popup_Button_Clicked_Event { +struct Efl.Ui.Alert_Popup_Button_Clicked_Event { [[Information for @[Efl.Ui.Alert_Popup.button,clicked] event.]] button_type: Efl.Ui.Alert_Popup_Button; [[Clicked button type.]] } -class @beta Efl.Ui.Alert_Popup extends Efl.Ui.Popup +class Efl.Ui.Alert_Popup extends Efl.Ui.Popup { [[A variant of @Efl.Ui.Popup which uses a layout containing a content object and a variable number of buttons (up to 3 total). diff --git a/src/lib/elementary/efl_ui_bg.eo b/src/lib/elementary/efl_ui_bg.eo index 6ce62e92e7..ffb695648f 100644 --- a/src/lib/elementary/efl_ui_bg.eo +++ b/src/lib/elementary/efl_ui_bg.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Bg extends Efl.Ui.Layout_Base +class Efl.Ui.Bg extends Efl.Ui.Layout_Base implements Efl.File, Efl.Gfx.Color composites Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller { diff --git a/src/lib/elementary/efl_ui_box_flow.eo b/src/lib/elementary/efl_ui_box_flow.eo index 7e4f6f5552..982a13a553 100644 --- a/src/lib/elementary/efl_ui_box_flow.eo +++ b/src/lib/elementary/efl_ui_box_flow.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Box_Flow extends Efl.Ui.Box +class Efl.Ui.Box_Flow extends Efl.Ui.Box { [[A Flow Box is a customized type of @Efl.Ui.Box. It will fill along the axis selected with @Efl.Ui.Layout_Orientable.orientation (which defaults to Horizontal), until items will no diff --git a/src/lib/elementary/efl_ui_check.eo b/src/lib/elementary/efl_ui_check.eo index 021aa7f8e9..ca812a8e8d 100644 --- a/src/lib/elementary/efl_ui_check.eo +++ b/src/lib/elementary/efl_ui_check.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Check extends Efl.Ui.Layout_Base +class Efl.Ui.Check extends Efl.Ui.Layout_Base implements Efl.Access.Widget.Action, Efl.Text, Efl.Content, Efl.Input.Clickable, Efl.Ui.Selectable { diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo index 5ed981abe8..f040fd87bc 100644 --- a/src/lib/elementary/efl_ui_collection.eo +++ b/src/lib/elementary/efl_ui_collection.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Collection extends Efl.Ui.Layout_Base implements +class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Pack_Linear, Efl.Ui.Layout_Orientable, Efl.Ui.Multi_Selectable, @@ -49,7 +49,7 @@ class @beta Efl.Ui.Collection extends Efl.Ui.Layout_Base implements @in animation: bool; [[If you want to have an animated transition.]] } } - @property position_manager { + @property position_manager @beta { [[Position manager object that handles placement of items.]] values { position_manager : Efl.Ui.Position_Manager.Entity @move; [[Ownership is passed to the item container.]] diff --git a/src/lib/elementary/efl_ui_datepicker.eo b/src/lib/elementary/efl_ui_datepicker.eo index 11df7c45cc..08e841ad99 100644 --- a/src/lib/elementary/efl_ui_datepicker.eo +++ b/src/lib/elementary/efl_ui_datepicker.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Datepicker extends Efl.Ui.Layout_Base +class Efl.Ui.Datepicker extends Efl.Ui.Layout_Base { [[Datepicker widget diff --git a/src/lib/elementary/efl_ui_default_item.eo b/src/lib/elementary/efl_ui_default_item.eo index b11c20ab41..7196a23c32 100644 --- a/src/lib/elementary/efl_ui_default_item.eo +++ b/src/lib/elementary/efl_ui_default_item.eo @@ -1,4 +1,4 @@ -abstract @beta Efl.Ui.Default_Item extends Efl.Ui.Item implements +abstract Efl.Ui.Default_Item extends Efl.Ui.Item implements Efl.Text, Efl.Text_Markup, Efl.Ui.L10n, diff --git a/src/lib/elementary/efl_ui_format.eo b/src/lib/elementary/efl_ui_format.eo index baa8613946..7723639b62 100644 --- a/src/lib/elementary/efl_ui_format.eo +++ b/src/lib/elementary/efl_ui_format.eo @@ -1,6 +1,6 @@ import eina_types; -function @beta Efl.Ui.Format_Func +function Efl.Ui.Format_Func { [[A function taking an @Eina.Value and producing its textual representation. See @Efl.Ui.Format.format_func. @@ -12,7 +12,7 @@ function @beta Efl.Ui.Format_Func return: bool; [[Whether the conversion succeeded or not.]] }; -struct @beta Efl.Ui.Format_Value +struct Efl.Ui.Format_Value { [[A value which should always be displayed as a specific text string. See @Efl.Ui.Format.format_values. @@ -21,7 +21,7 @@ struct @beta Efl.Ui.Format_Value text: string; [[Text string to replace it.]] } -enum @beta Efl.Ui.Format_String_Type +enum Efl.Ui.Format_String_Type { [[Type of formatting string.]] simple, [[This is the simplest formatting mechanism, working pretty much like $printf. @@ -35,10 +35,10 @@ enum @beta Efl.Ui.Format_String_Type ]] } -mixin @beta Efl.Ui.Format requires Efl.Object +mixin Efl.Ui.Format requires Efl.Object { [[Helper mixin that simplifies converting numerical values to text. - + A number of widgets represent a numerical value but display a text representation. For example, an @Efl.Ui.Progressbar can hold the number 0.75 but display the string "75%", or an @Efl.Ui.Spin can hold numbers 1 to 7, but display the strings "Monday" thru "Sunday". diff --git a/src/lib/elementary/efl_ui_grid.eo b/src/lib/elementary/efl_ui_grid.eo index 708d96f1c0..72c2bfface 100644 --- a/src/lib/elementary/efl_ui_grid.eo +++ b/src/lib/elementary/efl_ui_grid.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Grid extends Efl.Ui.Collection +class Efl.Ui.Grid extends Efl.Ui.Collection { [[A scrollable grid of @Efl.Ui.Item objects, typically @Efl.Ui.Grid_Default_Item objects. diff --git a/src/lib/elementary/efl_ui_grid_default_item.eo b/src/lib/elementary/efl_ui_grid_default_item.eo index 86000405cc..d2b0501265 100644 --- a/src/lib/elementary/efl_ui_grid_default_item.eo +++ b/src/lib/elementary/efl_ui_grid_default_item.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Grid_Default_Item extends Efl.Ui.Default_Item +class Efl.Ui.Grid_Default_Item extends Efl.Ui.Default_Item { [[Default Item class to be used inside @Efl.Ui.Grid containers. The $icon part is in the middle, the $extra part overlaps it on its upper-right corner. diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 80bb886f6d..080c0ce94d 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -16,7 +16,7 @@ struct @beta Efl.Ui.Image_Error open_error: bool; [[$true if the error happened when opening the file, $false otherwise]] } -class @beta Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui.Draggable, +class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui.Draggable, Efl.File, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller, Efl.Player, Efl.Gfx.View, Efl.Access.Component, Efl.Access.Widget.Action, Efl.Gfx.Color, Efl.Gfx.Image_Orientable, diff --git a/src/lib/elementary/efl_ui_item.eo b/src/lib/elementary/efl_ui_item.eo index 148a112be3..0e841f5df9 100644 --- a/src/lib/elementary/efl_ui_item.eo +++ b/src/lib/elementary/efl_ui_item.eo @@ -1,4 +1,4 @@ -abstract @beta Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectable, Efl.Input.Clickable +abstract Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectable, Efl.Input.Clickable { [[Selectable Item abstraction. diff --git a/src/lib/elementary/efl_ui_list.eo b/src/lib/elementary/efl_ui_list.eo index 4af260c190..c4481361f6 100644 --- a/src/lib/elementary/efl_ui_list.eo +++ b/src/lib/elementary/efl_ui_list.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.List extends Efl.Ui.Collection +class Efl.Ui.List extends Efl.Ui.Collection { [[A scrollable list of @Efl.Ui.Item objects, typically @Efl.Ui.List_Default_Item objects. diff --git a/src/lib/elementary/efl_ui_list_default_item.eo b/src/lib/elementary/efl_ui_list_default_item.eo index 7e8e3cb3b0..0a251d931a 100644 --- a/src/lib/elementary/efl_ui_list_default_item.eo +++ b/src/lib/elementary/efl_ui_list_default_item.eo @@ -1,5 +1,5 @@ -class @beta Efl.Ui.List_Default_Item extends Efl.Ui.Default_Item +class Efl.Ui.List_Default_Item extends Efl.Ui.Default_Item { [[Default Item class to be used inside @Efl.Ui.List containers. It displays the three parts in horizontal order: $icon, $text and $extra. diff --git a/src/lib/elementary/efl_ui_popup.eo b/src/lib/elementary/efl_ui_popup.eo index 619f7d7549..bcb4d62101 100644 --- a/src/lib/elementary/efl_ui_popup.eo +++ b/src/lib/elementary/efl_ui_popup.eo @@ -1,5 +1,5 @@ parse efl_gfx_hint; -enum @beta Efl.Ui.Popup_Align { +enum Efl.Ui.Popup_Align { [[This is the alignment method for positioning Popup widgets.]] none = 0, [[Popup not aligned.]] center, [[Popup is aligned to the center of its anchor object.]] @@ -9,7 +9,7 @@ enum @beta Efl.Ui.Popup_Align { bottom [[Popup's bottom is aligned to the bottom of its anchor object.]] } -class @beta Efl.Ui.Popup extends Efl.Ui.Layout_Base implements Efl.Content, Efl.Ui.Focus.Layer, +class Efl.Ui.Popup extends Efl.Ui.Layout_Base implements Efl.Content, Efl.Ui.Focus.Layer, Efl.Ui.Widget_Scrollable_Content { [[A styled container widget which overlays a window's contents. diff --git a/src/lib/elementary/efl_ui_popup_part_backwall.eo b/src/lib/elementary/efl_ui_popup_part_backwall.eo index 7cb01544b9..1bb24c0968 100644 --- a/src/lib/elementary/efl_ui_popup_part_backwall.eo +++ b/src/lib/elementary/efl_ui_popup_part_backwall.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Popup_Part_Backwall extends Efl.Ui.Layout_Part implements Efl.File +class Efl.Ui.Popup_Part_Backwall extends Efl.Ui.Layout_Part implements Efl.File { [[A Popup backwall is the background object for an @Efl.Ui.Popup widget. It can be returned from a given Popup widget by using the @Efl.Part API to fetch the "backwall" part. diff --git a/src/lib/elementary/efl_ui_radio.eo b/src/lib/elementary/efl_ui_radio.eo index be595031b9..19206f501f 100644 --- a/src/lib/elementary/efl_ui_radio.eo +++ b/src/lib/elementary/efl_ui_radio.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Radio extends Efl.Ui.Check implements Efl.Access.Widget.Action +class Efl.Ui.Radio extends Efl.Ui.Check implements Efl.Access.Widget.Action { [[Elementary radio button class. diff --git a/src/lib/elementary/efl_ui_radio_group.eo b/src/lib/elementary/efl_ui_radio_group.eo index 5651e237a6..31cad9fd10 100644 --- a/src/lib/elementary/efl_ui_radio_group.eo +++ b/src/lib/elementary/efl_ui_radio_group.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Ui.Radio_Group extends Efl.Ui.Single_Selectable +interface Efl.Ui.Radio_Group extends Efl.Ui.Single_Selectable { [[Interface for manually handling a group of @Efl.Ui.Radio buttons. diff --git a/src/lib/elementary/efl_ui_radio_group_impl.eo b/src/lib/elementary/efl_ui_radio_group_impl.eo index 7de7899248..f35e5623e6 100644 --- a/src/lib/elementary/efl_ui_radio_group_impl.eo +++ b/src/lib/elementary/efl_ui_radio_group_impl.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Radio_Group_Impl extends Efl.Object implements Efl.Ui.Radio_Group +class Efl.Ui.Radio_Group_Impl extends Efl.Object implements Efl.Ui.Radio_Group { [[Object with the default implementation for @Efl.Ui.Radio_Group. ]] diff --git a/src/lib/elementary/efl_ui_scroller.eo b/src/lib/elementary/efl_ui_scroller.eo index 43fcc4f26e..2331bcfa39 100644 --- a/src/lib/elementary/efl_ui_scroller.eo +++ b/src/lib/elementary/efl_ui_scroller.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Scroller extends Efl.Ui.Layout_Base implements +class Efl.Ui.Scroller extends Efl.Ui.Layout_Base implements Efl.Ui.Focus.Manager_Sub, Efl.Ui.Widget_Focus_Manager, Efl.Content diff --git a/src/lib/elementary/efl_ui_slider.eo b/src/lib/elementary/efl_ui_slider.eo index efaf179071..77d4f26f1d 100644 --- a/src/lib/elementary/efl_ui_slider.eo +++ b/src/lib/elementary/efl_ui_slider.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Slider extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Interactive, Efl.Ui.Layout_Orientable, +class Efl.Ui.Slider extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Interactive, Efl.Ui.Layout_Orientable, Efl.Access.Value, Efl.Access.Widget.Action { diff --git a/src/lib/elementary/efl_ui_spin.eo b/src/lib/elementary/efl_ui_spin.eo index 9f55338ee2..b7e965fff4 100644 --- a/src/lib/elementary/efl_ui_spin.eo +++ b/src/lib/elementary/efl_ui_spin.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Display, +class Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Display, Efl.Ui.Format, Efl.Access.Value, Efl.Access.Widget.Action { [[A Spin. diff --git a/src/lib/elementary/efl_ui_timepicker.eo b/src/lib/elementary/efl_ui_timepicker.eo index d8bea2159c..0021384834 100644 --- a/src/lib/elementary/efl_ui_timepicker.eo +++ b/src/lib/elementary/efl_ui_timepicker.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Timepicker extends Efl.Ui.Layout_Base +class Efl.Ui.Timepicker extends Efl.Ui.Layout_Base { [[Timepicker widget diff --git a/src/lib/evas/canvas/efl_input_clickable.eo b/src/lib/evas/canvas/efl_input_clickable.eo index a9285db4fc..a108035fb3 100644 --- a/src/lib/evas/canvas/efl_input_clickable.eo +++ b/src/lib/evas/canvas/efl_input_clickable.eo @@ -1,10 +1,10 @@ -struct @beta Efl.Input.Clickable_Clicked { +struct Efl.Input.Clickable_Clicked { [[A struct that expresses a click in elementary.]] repeated : uint; [[The amount of how often the clicked event was repeated in a certain amount of time]] button : uint; [[The Button that is pressed]] } -mixin @beta Efl.Input.Clickable +mixin Efl.Input.Clickable { [[Efl input clickable interface]] event_prefix: efl_input; From 4ce7444dd117867d2a2d955c5652bb3cc2ab20ca Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 24 Sep 2019 15:52:34 +0200 Subject: [PATCH 012/115] efl: use new eolian error functionality instead of globals Also enable referencing errors in docs. --- src/lib/ecore_con/ecore_con.c | 19 +++++++------------ src/lib/ecore_con/efl_net_dialer.eo | 6 +++--- src/lib/ecore_con/efl_net_socket_ssl.eo | 4 ++-- src/lib/eolian/eolian_database.c | 1 + 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 75f083ac9f..5cf7bc18cf 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -59,13 +59,6 @@ int sd_fd_max = 0; EWAPI Eina_Error EFL_NET_ERROR_COULDNT_RESOLVE_HOST = 0; -EWAPI Eina_Error EFL_NET_DIALER_ERROR_COULDNT_CONNECT = 0; -EWAPI Eina_Error EFL_NET_DIALER_ERROR_COULDNT_RESOLVE_PROXY = 0; -EWAPI Eina_Error EFL_NET_DIALER_ERROR_PROXY_AUTHENTICATION_FAILED = 0; - -EWAPI Eina_Error EFL_NET_SOCKET_SSL_ERROR_HANDSHAKE = 0; -EWAPI Eina_Error EFL_NET_SOCKET_SSL_ERROR_CERTIFICATE_VERIFY_FAILED = 0; - static int _ecore_con_init_count = 0; int _ecore_con_log_dom = -1; @@ -104,12 +97,14 @@ ecore_con_init(void) EFL_NET_ERROR_COULDNT_RESOLVE_HOST = eina_error_msg_static_register("Couldn't resolve host name"); - EFL_NET_DIALER_ERROR_COULDNT_CONNECT = eina_error_msg_static_register("Couldn't connect to server"); - EFL_NET_DIALER_ERROR_COULDNT_RESOLVE_PROXY = eina_error_msg_static_register("Couldn't resolve proxy name"); - EFL_NET_DIALER_ERROR_PROXY_AUTHENTICATION_FAILED = eina_error_msg_static_register("Proxy authentication failed"); + /* initialize the .eo file errors once to guarantee thread safety */ - EFL_NET_SOCKET_SSL_ERROR_HANDSHAKE = eina_error_msg_static_register("Failed SSL handshake"); - EFL_NET_SOCKET_SSL_ERROR_CERTIFICATE_VERIFY_FAILED = eina_error_msg_static_register("Failed to verify peer's certificate"); + EFL_NET_DIALER_ERROR_COULDNT_CONNECT; + EFL_NET_DIALER_ERROR_COULDNT_RESOLVE_PROXY; + EFL_NET_DIALER_ERROR_PROXY_AUTHENTICATION_FAILED; + + EFL_NET_SOCKET_SSL_ERROR_HANDSHAKE; + EFL_NET_SOCKET_SSL_ERROR_CERTIFICATE_VERIFY_FAILED; #ifdef HAVE_SYSTEMD sd_fd_max = sd_listen_fds(0); diff --git a/src/lib/ecore_con/efl_net_dialer.eo b/src/lib/ecore_con/efl_net_dialer.eo index 8570e6538e..6ba5656c2b 100644 --- a/src/lib/ecore_con/efl_net_dialer.eo +++ b/src/lib/ecore_con/efl_net_dialer.eo @@ -1,6 +1,6 @@ -var @beta Efl.Net.Dialer_Error.COULDNT_CONNECT: Eina.Error; [[The dialer could not connect to the remote]] -var @beta Efl.Net.Dialer_Error.COULDNT_RESOLVE_PROXY: Eina.Error; [[The dialer could not resolve the given proxy server]] -var @beta Efl.Net.Dialer_Error.PROXY_AUTHENTICATION_FAILED: Eina.Error; [[The dialer failed to authenticate against the proxy server]] +error @beta Efl.Net.Dialer_Error.COULDNT_CONNECT = "Couldn't connect to server"; [[The dialer could not connect to the remote]] +error @beta Efl.Net.Dialer_Error.COULDNT_RESOLVE_PROXY = "Couldn't resolve proxy name"; [[The dialer could not resolve the given proxy server]] +error @beta Efl.Net.Dialer_Error.PROXY_AUTHENTICATION_FAILED = "Proxy authentication failed"; [[The dialer failed to authenticate against the proxy server]] interface @beta Efl.Net.Dialer extends Efl.Net.Socket { [[Creates a client socket to reach a remote peer. diff --git a/src/lib/ecore_con/efl_net_socket_ssl.eo b/src/lib/ecore_con/efl_net_socket_ssl.eo index 7bf9b4cba7..60a1fbb1ec 100644 --- a/src/lib/ecore_con/efl_net_socket_ssl.eo +++ b/src/lib/ecore_con/efl_net_socket_ssl.eo @@ -1,5 +1,5 @@ -var @beta Efl.Net.Socket_Ssl_Error.HANDSHAKE: Eina.Error; [[Failed SSL handshake]] -var @beta Efl.Net.Socket_Ssl_Error.CERTIFICATE_VERIFY_FAILED: Eina.Error; [[Failed to verify peer's certificate]] +error @beta Efl.Net.Socket_Ssl_Error.HANDSHAKE = "Failed SSL handshake"; [[Failed SSL handshake]] +error @beta Efl.Net.Socket_Ssl_Error.CERTIFICATE_VERIFY_FAILED = "Failed to verify peer's certificate"; [[Failed to verify peer's certificate]] class @beta Efl.Net.Socket_Ssl extends Efl.Loop_Consumer implements Efl.Net.Socket { [[A wrapper socket doing SSL (Secure Sockets Layer). diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index 9aa6b8f87b..cef722dd95 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -492,6 +492,7 @@ database_doc_token_ref_resolve(const Eolian_Doc_Token *tok, case EOLIAN_OBJECT_CLASS: case EOLIAN_OBJECT_TYPEDECL: case EOLIAN_OBJECT_VARIABLE: + case EOLIAN_OBJECT_ERROR: /* we only allow certain types to be referenced */ return tp; default: From 251d8fc6bd4e6a64ac5925fa7a7ed95b8d7ce7bd Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 24 Sep 2019 16:17:11 +0200 Subject: [PATCH 013/115] eolian: remove global vars from tests --- src/tests/eolian/data/class_simple.eo | 6 ---- src/tests/eolian/data/class_simple_ref.c | 1 - src/tests/eolian/data/class_simple_ref_eo.h | 12 -------- src/tests/eolian/data/docs_ref.h | 6 ++-- src/tests/eolian/data/eo_docs.eo | 2 +- src/tests/eolian/data/var.eo | 9 ------ src/tests/eolian/eolian_parsing.c | 32 +-------------------- src/tests/eolian_cxx/docs.eo | 2 +- 8 files changed, 7 insertions(+), 63 deletions(-) diff --git a/src/tests/eolian/data/class_simple.eo b/src/tests/eolian/data/class_simple.eo index ad0589b3a7..12ea743b48 100644 --- a/src/tests/eolian/data/class_simple.eo +++ b/src/tests/eolian/data/class_simple.eo @@ -2,12 +2,6 @@ const Foo: int = 5; [[doc for constant]] -var Bar: float = 10.3f; [[doc for global]] - -var Baz: long; [[in header but not in source]] - -var @extern Bah: double; // not generated - class Class_Simple { [[Class Desc Simple]] c_prefix: efl_canvas_object_simple; diff --git a/src/tests/eolian/data/class_simple_ref.c b/src/tests/eolian/data/class_simple_ref.c index 4fec41fb02..d11055ae5e 100644 --- a/src/tests/eolian/data/class_simple_ref.c +++ b/src/tests/eolian/data/class_simple_ref.c @@ -1,4 +1,3 @@ -EWAPI float BAR = 10.300000f; Eina_Bool _class_simple_a_set(Eo *obj, Evas_Simple_Data *pd, int value); diff --git a/src/tests/eolian/data/class_simple_ref_eo.h b/src/tests/eolian/data/class_simple_ref_eo.h index 60e6fe27e2..d0a6d02ce8 100644 --- a/src/tests/eolian/data/class_simple_ref_eo.h +++ b/src/tests/eolian/data/class_simple_ref_eo.h @@ -19,18 +19,6 @@ typedef Eo Class_Simple; #define FOO 5 #endif -/** doc for global - * - * @ingroup Bar - */ -EWAPI extern float BAR; - -/** in header but not in source - * - * @ingroup Baz - */ -EWAPI extern long BAZ; - #endif /** Class Desc Simple diff --git a/src/tests/eolian/data/docs_ref.h b/src/tests/eolian/data/docs_ref.h index cc4b086873..a5a92e6a4c 100644 --- a/src/tests/eolian/data/docs_ref.h +++ b/src/tests/eolian/data/docs_ref.h @@ -56,11 +56,13 @@ typedef enum */ typedef Bar Alias; +#ifndef PANTS /** Docs for var. * * @ingroup pants */ -EWAPI extern int PANTS; +#define PANTS 150 +#endif /** Opaque struct docs. See @ref Foo for another struct. * @@ -74,7 +76,7 @@ typedef struct _Opaque Opaque; * @brief Docs for class. * * More docs for class. Testing references now. @ref Foo @ref Bar @ref Alias - * @ref pants @ref eo_docs_meth @ref eo_docs_prop_get @ref eo_docs_prop_get + * @ref PANTS @ref eo_docs_meth @ref eo_docs_prop_get @ref eo_docs_prop_get * @ref eo_docs_prop_set @ref Foo.field1 @ref BAR_FOO @ref Eo_Docs * * @since 1.18 diff --git a/src/tests/eolian/data/eo_docs.eo b/src/tests/eolian/data/eo_docs.eo index 50641f2ad4..1fe72df572 100644 --- a/src/tests/eolian/data/eo_docs.eo +++ b/src/tests/eolian/data/eo_docs.eo @@ -31,7 +31,7 @@ type Alias: Bar; [[Docs for typedef. See @Bar. @since 2.0 ]] -var pants: int = 150; [[Docs for var.]] +const pants: int = 150; [[Docs for var.]] struct Opaque; [[Opaque struct docs. See @Foo for another struct.]] diff --git a/src/tests/eolian/data/var.eo b/src/tests/eolian/data/var.eo index 98afb713df..6424427ae0 100644 --- a/src/tests/eolian/data/var.eo +++ b/src/tests/eolian/data/var.eo @@ -1,15 +1,6 @@ // regular constant const Foo: int = 5; -// regular global -var Bar: float = 10.3f; - -// no-value global -var Baz: long; - -// extern global -var @extern Bah: double; - class Var { methods { foo { diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 2dd6c7775a..1a8f9eebcd 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -795,36 +795,6 @@ EFL_START_TEST(eolian_var) fail_if(v.type != EOLIAN_EXPR_INT); fail_if(v.value.i != 5); - /* regular global */ - fail_if(!(var = eolian_unit_global_by_name_get(unit, "Bar"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_GLOBAL); - fail_if(eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); - fail_if(!(name = eolian_type_short_name_get(type))); - fail_if(strcmp(name, "float")); - fail_if(!(exp = eolian_variable_value_get(var))); - v = eolian_expression_eval(exp, EOLIAN_MASK_ALL); - fail_if(v.type != EOLIAN_EXPR_FLOAT); - fail_if(((int)v.value.f) != 10); - - /* no-value global */ - fail_if(!(var = eolian_unit_global_by_name_get(unit, "Baz"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_GLOBAL); - fail_if(eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); - fail_if(!(name = eolian_type_short_name_get(type))); - fail_if(strcmp(name, "long")); - fail_if(eolian_variable_value_get(var)); - - /* extern global */ - fail_if(!(var = eolian_unit_global_by_name_get(unit, "Bah"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_GLOBAL); - fail_if(!eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); - fail_if(!(name = eolian_type_short_name_get(type))); - fail_if(strcmp(name, "double")); - fail_if(eolian_variable_value_get(var)); - eolian_state_free(eos); } EFL_END_TEST @@ -1210,7 +1180,7 @@ EFL_START_TEST(eolian_docs) fail_if(strcmp(eolian_documentation_since_get(doc), "2.0")); - fail_if(!(var = eolian_unit_global_by_name_get(unit, "pants"))); + fail_if(!(var = eolian_unit_constant_by_name_get(unit, "pants"))); fail_if(!(doc = eolian_variable_documentation_get(var))); fail_if(strcmp(eolian_documentation_summary_get(doc), "Docs for var.")); diff --git a/src/tests/eolian_cxx/docs.eo b/src/tests/eolian_cxx/docs.eo index 5249b7196e..55c7dc28e6 100644 --- a/src/tests/eolian_cxx/docs.eo +++ b/src/tests/eolian_cxx/docs.eo @@ -31,7 +31,7 @@ type Alias: Bar; [[Docs for typedef. See @Bar. @since 2.0 ]] -var pants: int = 150; [[Docs for var.]] +const pants: int = 150; [[Docs for var.]] struct Opaque; [[Opaque struct docs. See @Foo for another struct.]] From aaf8d01ba87938f07b48821d7f1b0583015f0fde Mon Sep 17 00:00:00 2001 From: Wonki Kim Date: Tue, 24 Sep 2019 17:20:43 +0200 Subject: [PATCH 014/115] doc: update ecore_filter_model description Summary: this patch updates single line description of ecore_filter_model.(T7717) Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10103 --- src/lib/ecore/efl_filter_model.eo | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore/efl_filter_model.eo b/src/lib/ecore/efl_filter_model.eo index 4dafb94f51..760887a8f6 100644 --- a/src/lib/ecore/efl_filter_model.eo +++ b/src/lib/ecore/efl_filter_model.eo @@ -10,12 +10,13 @@ function @beta EflFilterModel { class @beta Efl.Filter_Model extends Efl.Composite_Model { - [[Efl model designed to filter its children.]] + [[Filtering data that @Efl.Model provides is the main feature of this class. + This class provides a filter function so only children that match it are returned.]] methods { filter_set { [[Set a filter function that will catch children from the composited model.]] params { - filter: EflFilterModel; [[Filter callback]] + filter: EflFilterModel; [[Filter callback.]] } } } From 6ea61dc83a3dfd3179ab9067987883e4dc36a63a Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Tue, 24 Sep 2019 17:57:00 +0200 Subject: [PATCH 015/115] Efl.Ui.Layout_Pack: fix obvious uninitialized variable Why did this ever work? --- src/lib/elementary/efl_ui_layout_pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_layout_pack.c b/src/lib/elementary/efl_ui_layout_pack.c index 0e2743db01..b043ffa112 100644 --- a/src/lib/elementary/efl_ui_layout_pack.c +++ b/src/lib/elementary/efl_ui_layout_pack.c @@ -269,7 +269,7 @@ _efl_ui_layout_part_table_efl_pack_unpack(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Tab EOLIAN static Eina_Bool _efl_ui_layout_part_table_efl_pack_pack(Eo *obj, Efl_Ui_Layout_Table_Data *pd, Efl_Gfx_Entity *subobj) { - int last_col, last_row; + int last_col = 0, last_row = 0; int req_cols, req_rows; Eina_Iterator *iter; Eo *pack, *element; From 72698aa6f5849ee6d24a76ae886d7817ea4373ae Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 24 Sep 2019 18:17:59 +0200 Subject: [PATCH 016/115] eolian: always allow implementation for eot files This is so the build system can unconditionally generate .eot.c without worrying whether there's something to generate. --- src/bin/eolian/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c index 0545430eb5..114f989ac4 100644 --- a/src/bin/eolian/main.c +++ b/src/bin/eolian/main.c @@ -392,8 +392,11 @@ _write_source(const Eolian_State *eos, const char *ofname, const Eolian_Class *cl = eolian_state_class_by_file_get(eos, ifname); eo_gen_types_source_gen(eolian_state_objects_by_file_get(eos, ifname), buf); eo_gen_source_gen(cl, buf); - if (cl || (eot && eina_strbuf_length_get(buf))) + if (cl || eot) { + /* always have at least a stub in order to allow unconditional generation */ + if (!eina_strbuf_length_get(buf)) + eina_strbuf_append(buf, "/* Nothing to implement. */\n"); if (!_write_file(ofname, buf)) goto done; ret = EINA_TRUE; From 553ce69bade88ac675aa56fcb184240403a12bfc Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 24 Sep 2019 17:46:56 +0200 Subject: [PATCH 017/115] efl: remove remaining instances of .eo global variables --- src/lib/ecore_con/Efl_Net.h | 155 +++++++++++++++++++++++ src/lib/ecore_con/ecore_con.c | 8 +- src/lib/ecore_con/efl_net_http_types.eot | 102 +++++++-------- src/lib/ecore_con/efl_net_types.eot | 2 +- src/lib/ecore_con/meson.build | 3 +- src/lib/efl/Efl.h | 38 ++++++ src/lib/efl/interfaces/efl_gfx_types.eot | 22 ++-- src/lib/elementary/Efl_Ui.h | 3 + src/lib/elementary/efl_ui.eot | 15 ++- src/lib/elementary/elm_main.c | 6 +- src/lib/elementary/elm_widget.h | 3 + src/lib/eolian/database_var.c | 1 + 12 files changed, 281 insertions(+), 77 deletions(-) diff --git a/src/lib/ecore_con/Efl_Net.h b/src/lib/ecore_con/Efl_Net.h index be2147105f..7cab05efa3 100644 --- a/src/lib/ecore_con/Efl_Net.h +++ b/src/lib/ecore_con/Efl_Net.h @@ -81,6 +81,161 @@ EAPI int ecore_con_url_init(void); */ EAPI int ecore_con_url_shutdown(void); +#ifdef EFL_BETA_API_SUPPORT +/** HTTP error: bad content encoding */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_BAD_CONTENT_ENCODING; + +/** HTTP error: bad download resume */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_BAD_DOWNLOAD_RESUME; + +/** HTTP error: bad function argument */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_BAD_FUNCTION_ARGUMENT; + +/** HTTP error: chunk failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_CHUNK_FAILED; + +/** HTTP error: conv failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_CONV_FAILED; + +/** HTTP error: conv reqd */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_CONV_REQD; + +/** HTTP error: failed init */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_FAILED_INIT; + +/** HTTP error: could not read file */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_FILE_COULDNT_READ_FILE; + +/** HTTP error: filesize exceeded */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_FILESIZE_EXCEEDED; + +/** HTTP error: function not found */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_FUNCTION_NOT_FOUND; + +/** HTTP error: got nothing */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_GOT_NOTHING; + +/** HTTP error: http2 */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_HTTP2; + +/** HTTP error: http2 stream */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_HTTP2_STREAM; + +/** HTTP error: http post error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_HTTP_POST_ERROR; + +/** HTTP error: http returned error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_HTTP_RETURNED_ERROR; + +/** HTTP error: interface failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_INTERFACE_FAILED; + +/** HTTP error: login denied */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_LOGIN_DENIED; + +/** HTTP error: no connection available */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_NO_CONNECTION_AVAILABLE; + +/** HTTP error: not built in */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_NOT_BUILT_IN; + +/** HTTP error: operation timeout */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_OPERATION_TIMEDOUT; + +/** HTTP error: partial file */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_PARTIAL_FILE; + +/** HTTP error: peer failed verification */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_PEER_FAILED_VERIFICATION; + +/** HTTP error: range error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_RANGE_ERROR; + +/** HTTP error: read error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_READ_ERROR; + +/** HTTP error: receive error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_RECV_ERROR; + +/** HTTP error: remote access denied */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_REMOTE_ACCESS_DENIED; + +/** HTTP error: remote disk full */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_REMOTE_DISK_FULL; + +/** HTTP error: remote file exists */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_REMOTE_FILE_EXISTS; + +/** HTTP error: remote file not found */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_REMOTE_FILE_NOT_FOUND; + +/** HTTP error: send error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SEND_ERROR; + +/** HTTP error: send fail rewind */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SEND_FAIL_REWIND; + +/** HTTP error: SSL cacert */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CACERT; + +/** HTTP error: SSL cacert bad file */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CACERT_BADFILE; + +/** HTTP error: SSL certproblem */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CERTPROBLEM; + +/** HTTP error: SSL cipher */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CIPHER; + +/** HTTP error: SSL connect error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CONNECT_ERROR; + +/** HTTP error: SSL crl bad file */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_CRL_BADFILE; + +/** HTTP error: SSL engine init failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_ENGINE_INITFAILED; + +/** HTTP error: SSL engine not found */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_ENGINE_NOTFOUND; + +/** HTTP error: SSL engine set failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_ENGINE_SETFAILED; + +/** HTTP error: SSL invalid cert status */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_INVALIDCERTSTATUS; + +/** HTTP error: SSL issuer error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_ISSUER_ERROR; + +/** HTTP error: SSL pinned pub key does not match */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_PINNEDPUBKEYNOTMATCH; + +/** HTTP error: SSL shutdown failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_SSL_SHUTDOWN_FAILED; + +/** HTTP error: too many redirects */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_TOO_MANY_REDIRECTS; + +/** HTTP error: unknown option */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_UNKNOWN_OPTION; + +/** HTTP error: unsupported protocol */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_UNSUPPORTED_PROTOCOL; + +/** HTTP error: upload failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_UPLOAD_FAILED; + +/** HTTP error: URL mal-formatted */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_URL_MALFORMAT; + +/** HTTP error: usage of SSL failed */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_USE_SSL_FAILED; + +/** HTTP error: write error */ +extern EWAPI Eina_Error EFL_NET_HTTP_ERROR_WRITE_ERROR; +#endif /* EFL_BETA_API_SUPPORT */ + #include "efl_net_types.eot.h" #include "efl_net_ip_address.eo.h" diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 5cf7bc18cf..8a4e0fb43e 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -48,6 +48,8 @@ #include "Ecore_Con.h" #include "ecore_con_private.h" +#include "efl_net_types.eot.c" + #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 /* noop */ #endif @@ -57,8 +59,6 @@ int sd_fd_index = 0; int sd_fd_max = 0; #endif -EWAPI Eina_Error EFL_NET_ERROR_COULDNT_RESOLVE_HOST = 0; - static int _ecore_con_init_count = 0; int _ecore_con_log_dom = -1; @@ -95,10 +95,10 @@ ecore_con_init(void) ecore_con_mempool_init(); ecore_con_legacy_init(); - EFL_NET_ERROR_COULDNT_RESOLVE_HOST = eina_error_msg_static_register("Couldn't resolve host name"); - /* initialize the .eo file errors once to guarantee thread safety */ + EFL_NET_ERROR_COULDNT_RESOLVE_HOST; + EFL_NET_DIALER_ERROR_COULDNT_CONNECT; EFL_NET_DIALER_ERROR_COULDNT_RESOLVE_PROXY; EFL_NET_DIALER_ERROR_PROXY_AUTHENTICATION_FAILED; diff --git a/src/lib/ecore_con/efl_net_http_types.eot b/src/lib/ecore_con/efl_net_http_types.eot index 01a4cff5d3..63784f86e9 100644 --- a/src/lib/ecore_con/efl_net_http_types.eot +++ b/src/lib/ecore_con/efl_net_http_types.eot @@ -126,54 +126,54 @@ struct @beta Efl.Net.Http.Header { value: string; [[Header value]] } -var @beta Efl.Net.Http.Error.BAD_CONTENT_ENCODING: Eina.Error; [[HTTP error: bad content encoding]] -var @beta Efl.Net.Http.Error.BAD_DOWNLOAD_RESUME: Eina.Error; [[HTTP error: bad download resume]] -var @beta Efl.Net.Http.Error.BAD_FUNCTION_ARGUMENT: Eina.Error; [[HTTP error: bad function argument]] -var @beta Efl.Net.Http.Error.CHUNK_FAILED: Eina.Error; [[HTTP error: chunk failed]] -var @beta Efl.Net.Http.Error.CONV_FAILED: Eina.Error; [[HTTP error: conv failed]] -var @beta Efl.Net.Http.Error.CONV_REQD: Eina.Error; [[HTTP error: conv reqd]] -var @beta Efl.Net.Http.Error.FAILED_INIT: Eina.Error; [[HTTP error: failed init]] -var @beta Efl.Net.Http.Error.FILE_COULDNT_READ_FILE: Eina.Error; [[HTTP error: could not read file]] -var @beta Efl.Net.Http.Error.FILESIZE_EXCEEDED: Eina.Error; [[HTTP error: filesize exceeded]] -var @beta Efl.Net.Http.Error.FUNCTION_NOT_FOUND: Eina.Error; [[HTTP error: function not found]] -var @beta Efl.Net.Http.Error.GOT_NOTHING: Eina.Error; [[HTTP error: got nothing]] -var @beta Efl.Net.Http.Error.HTTP2: Eina.Error; [[HTTP error: http2]] -var @beta Efl.Net.Http.Error.HTTP2_STREAM: Eina.Error; [[HTTP error: http2 stream]] -var @beta Efl.Net.Http.Error.HTTP_POST_ERROR: Eina.Error; [[HTTP error: http post error]] -var @beta Efl.Net.Http.Error.HTTP_RETURNED_ERROR: Eina.Error; [[HTTP error: http returned error]] -var @beta Efl.Net.Http.Error.INTERFACE_FAILED: Eina.Error; [[HTTP error: interface failed]] -var @beta Efl.Net.Http.Error.LOGIN_DENIED: Eina.Error; [[HTTP error: login denied]] -var @beta Efl.Net.Http.Error.NO_CONNECTION_AVAILABLE: Eina.Error; [[HTTP error: no connection available]] -var @beta Efl.Net.Http.Error.NOT_BUILT_IN: Eina.Error; [[HTTP error: not built in]] -var @beta Efl.Net.Http.Error.OPERATION_TIMEDOUT: Eina.Error; [[HTTP error: operation timeout]] -var @beta Efl.Net.Http.Error.PARTIAL_FILE: Eina.Error; [[HTTP error: partial file]] -var @beta Efl.Net.Http.Error.PEER_FAILED_VERIFICATION: Eina.Error; [[HTTP error: peer failed verification]] -var @beta Efl.Net.Http.Error.RANGE_ERROR: Eina.Error; [[HTTP error: range error]] -var @beta Efl.Net.Http.Error.READ_ERROR: Eina.Error; [[HTTP error: read error]] -var @beta Efl.Net.Http.Error.RECV_ERROR: Eina.Error; [[HTTP error: receive error]] -var @beta Efl.Net.Http.Error.REMOTE_ACCESS_DENIED: Eina.Error; [[HTTP error: remote access denied]] -var @beta Efl.Net.Http.Error.REMOTE_DISK_FULL: Eina.Error; [[HTTP error: remote disk full]] -var @beta Efl.Net.Http.Error.REMOTE_FILE_EXISTS: Eina.Error; [[HTTP error: remote file exists]] -var @beta Efl.Net.Http.Error.REMOTE_FILE_NOT_FOUND: Eina.Error; [[HTTP error: remote file not found]] -var @beta Efl.Net.Http.Error.SEND_ERROR: Eina.Error; [[HTTP error: send error]] -var @beta Efl.Net.Http.Error.SEND_FAIL_REWIND: Eina.Error; [[HTTP error: send fail rewind]] -var @beta Efl.Net.Http.Error.SSL_CACERT: Eina.Error; [[HTTP error: SSL cacert]] -var @beta Efl.Net.Http.Error.SSL_CACERT_BADFILE: Eina.Error; [[HTTP error: SSL cacert bad file]] -var @beta Efl.Net.Http.Error.SSL_CERTPROBLEM: Eina.Error; [[HTTP error: SSL certproblem]] -var @beta Efl.Net.Http.Error.SSL_CIPHER: Eina.Error; [[HTTP error: SSL cipher]] -var @beta Efl.Net.Http.Error.SSL_CONNECT_ERROR: Eina.Error; [[HTTP error: SSL connect error]] -var @beta Efl.Net.Http.Error.SSL_CRL_BADFILE: Eina.Error; [[HTTP error: SSL crl bad file]] -var @beta Efl.Net.Http.Error.SSL_ENGINE_INITFAILED: Eina.Error; [[HTTP error: SSL engine init failed]] -var @beta Efl.Net.Http.Error.SSL_ENGINE_NOTFOUND: Eina.Error; [[HTTP error: SSL engine not found]] -var @beta Efl.Net.Http.Error.SSL_ENGINE_SETFAILED: Eina.Error; [[HTTP error: SSL engine set failed]] -var @beta Efl.Net.Http.Error.SSL_INVALIDCERTSTATUS: Eina.Error; [[HTTP error: SSL invalid cert status]] -var @beta Efl.Net.Http.Error.SSL_ISSUER_ERROR: Eina.Error; [[HTTP error: SSL issuer error]] -var @beta Efl.Net.Http.Error.SSL_PINNEDPUBKEYNOTMATCH: Eina.Error; [[HTTP error: SSL pinned pub key does not match]] -var @beta Efl.Net.Http.Error.SSL_SHUTDOWN_FAILED: Eina.Error; [[HTTP error: SSL shutdown failed]] -var @beta Efl.Net.Http.Error.TOO_MANY_REDIRECTS: Eina.Error; [[HTTP error: too many redirects]] -var @beta Efl.Net.Http.Error.UNKNOWN_OPTION: Eina.Error; [[HTTP error: unknown option]] -var @beta Efl.Net.Http.Error.UNSUPPORTED_PROTOCOL: Eina.Error; [[HTTP error: unsupported protocol]] -var @beta Efl.Net.Http.Error.UPLOAD_FAILED: Eina.Error; [[HTTP error: upload failed]] -var @beta Efl.Net.Http.Error.URL_MALFORMAT: Eina.Error; [[HTTP error: URL mal-formatted]] -var @beta Efl.Net.Http.Error.USE_SSL_FAILED: Eina.Error; [[HTTP error: usage of SSL failed]] -var @beta Efl.Net.Http.Error.WRITE_ERROR: Eina.Error; [[HTTP error: write error]] +error @extern @beta Efl.Net.Http.Error.BAD_CONTENT_ENCODING = "XXX"; [[HTTP error: bad content encoding]] +error @extern @beta Efl.Net.Http.Error.BAD_DOWNLOAD_RESUME = "XXX"; [[HTTP error: bad download resume]] +error @extern @beta Efl.Net.Http.Error.BAD_FUNCTION_ARGUMENT = "XXX"; [[HTTP error: bad function argument]] +error @extern @beta Efl.Net.Http.Error.CHUNK_FAILED = "XXX"; [[HTTP error: chunk failed]] +error @extern @beta Efl.Net.Http.Error.CONV_FAILED = "XXX"; [[HTTP error: conv failed]] +error @extern @beta Efl.Net.Http.Error.CONV_REQD = "XXX"; [[HTTP error: conv reqd]] +error @extern @beta Efl.Net.Http.Error.FAILED_INIT = "XXX"; [[HTTP error: failed init]] +error @extern @beta Efl.Net.Http.Error.FILE_COULDNT_READ_FILE = "XXX"; [[HTTP error: could not read file]] +error @extern @beta Efl.Net.Http.Error.FILESIZE_EXCEEDED = "XXX"; [[HTTP error: filesize exceeded]] +error @extern @beta Efl.Net.Http.Error.FUNCTION_NOT_FOUND = "XXX"; [[HTTP error: function not found]] +error @extern @beta Efl.Net.Http.Error.GOT_NOTHING = "XXX"; [[HTTP error: got nothing]] +error @extern @beta Efl.Net.Http.Error.HTTP2 = "XXX"; [[HTTP error: http2]] +error @extern @beta Efl.Net.Http.Error.HTTP2_STREAM = "XXX"; [[HTTP error: http2 stream]] +error @extern @beta Efl.Net.Http.Error.HTTP_POST_ERROR = "XXX"; [[HTTP error: http post error]] +error @extern @beta Efl.Net.Http.Error.HTTP_RETURNED_ERROR = "XXX"; [[HTTP error: http returned error]] +error @extern @beta Efl.Net.Http.Error.INTERFACE_FAILED = "XXX"; [[HTTP error: interface failed]] +error @extern @beta Efl.Net.Http.Error.LOGIN_DENIED = "XXX"; [[HTTP error: login denied]] +error @extern @beta Efl.Net.Http.Error.NO_CONNECTION_AVAILABLE = "XXX"; [[HTTP error: no connection available]] +error @extern @beta Efl.Net.Http.Error.NOT_BUILT_IN = "XXX"; [[HTTP error: not built in]] +error @extern @beta Efl.Net.Http.Error.OPERATION_TIMEDOUT = "XXX"; [[HTTP error: operation timeout]] +error @extern @beta Efl.Net.Http.Error.PARTIAL_FILE = "XXX"; [[HTTP error: partial file]] +error @extern @beta Efl.Net.Http.Error.PEER_FAILED_VERIFICATION = "XXX"; [[HTTP error: peer failed verification]] +error @extern @beta Efl.Net.Http.Error.RANGE_ERROR = "XXX"; [[HTTP error: range error]] +error @extern @beta Efl.Net.Http.Error.READ_ERROR = "XXX"; [[HTTP error: read error]] +error @extern @beta Efl.Net.Http.Error.RECV_ERROR = "XXX"; [[HTTP error: receive error]] +error @extern @beta Efl.Net.Http.Error.REMOTE_ACCESS_DENIED = "XXX"; [[HTTP error: remote access denied]] +error @extern @beta Efl.Net.Http.Error.REMOTE_DISK_FULL = "XXX"; [[HTTP error: remote disk full]] +error @extern @beta Efl.Net.Http.Error.REMOTE_FILE_EXISTS = "XXX"; [[HTTP error: remote file exists]] +error @extern @beta Efl.Net.Http.Error.REMOTE_FILE_NOT_FOUND = "XXX"; [[HTTP error: remote file not found]] +error @extern @beta Efl.Net.Http.Error.SEND_ERROR = "XXX"; [[HTTP error: send error]] +error @extern @beta Efl.Net.Http.Error.SEND_FAIL_REWIND = "XXX"; [[HTTP error: send fail rewind]] +error @extern @beta Efl.Net.Http.Error.SSL_CACERT = "XXX"; [[HTTP error: SSL cacert]] +error @extern @beta Efl.Net.Http.Error.SSL_CACERT_BADFILE = "XXX"; [[HTTP error: SSL cacert bad file]] +error @extern @beta Efl.Net.Http.Error.SSL_CERTPROBLEM = "XXX"; [[HTTP error: SSL certproblem]] +error @extern @beta Efl.Net.Http.Error.SSL_CIPHER = "XXX"; [[HTTP error: SSL cipher]] +error @extern @beta Efl.Net.Http.Error.SSL_CONNECT_ERROR = "XXX"; [[HTTP error: SSL connect error]] +error @extern @beta Efl.Net.Http.Error.SSL_CRL_BADFILE = "XXX"; [[HTTP error: SSL crl bad file]] +error @extern @beta Efl.Net.Http.Error.SSL_ENGINE_INITFAILED = "XXX"; [[HTTP error: SSL engine init failed]] +error @extern @beta Efl.Net.Http.Error.SSL_ENGINE_NOTFOUND = "XXX"; [[HTTP error: SSL engine not found]] +error @extern @beta Efl.Net.Http.Error.SSL_ENGINE_SETFAILED = "XXX"; [[HTTP error: SSL engine set failed]] +error @extern @beta Efl.Net.Http.Error.SSL_INVALIDCERTSTATUS = "XXX"; [[HTTP error: SSL invalid cert status]] +error @extern @beta Efl.Net.Http.Error.SSL_ISSUER_ERROR = "XXX"; [[HTTP error: SSL issuer error]] +error @extern @beta Efl.Net.Http.Error.SSL_PINNEDPUBKEYNOTMATCH = "XXX"; [[HTTP error: SSL pinned pub key does not match]] +error @extern @beta Efl.Net.Http.Error.SSL_SHUTDOWN_FAILED = "XXX"; [[HTTP error: SSL shutdown failed]] +error @extern @beta Efl.Net.Http.Error.TOO_MANY_REDIRECTS = "XXX"; [[HTTP error: too many redirects]] +error @extern @beta Efl.Net.Http.Error.UNKNOWN_OPTION = "XXX"; [[HTTP error: unknown option]] +error @extern @beta Efl.Net.Http.Error.UNSUPPORTED_PROTOCOL = "XXX"; [[HTTP error: unsupported protocol]] +error @extern @beta Efl.Net.Http.Error.UPLOAD_FAILED = "XXX"; [[HTTP error: upload failed]] +error @extern @beta Efl.Net.Http.Error.URL_MALFORMAT = "XXX"; [[HTTP error: URL mal-formatted]] +error @extern @beta Efl.Net.Http.Error.USE_SSL_FAILED = "XXX"; [[HTTP error: usage of SSL failed]] +error @extern @beta Efl.Net.Http.Error.WRITE_ERROR = "XXX"; [[HTTP error: write error]] diff --git a/src/lib/ecore_con/efl_net_types.eot b/src/lib/ecore_con/efl_net_types.eot index 48512fb105..36d8bba1ec 100644 --- a/src/lib/ecore_con/efl_net_types.eot +++ b/src/lib/ecore_con/efl_net_types.eot @@ -1,3 +1,3 @@ import eina_types; -var @beta Efl.Net.Error.COULDNT_RESOLVE_HOST: Eina.Error; [[Could not resolve the given host name]] +error @beta Efl.Net.Error.COULDNT_RESOLVE_HOST = "Couldn't resolve host name"; [[Could not resolve the given host name]] diff --git a/src/lib/ecore_con/meson.build b/src/lib/ecore_con/meson.build index eacf16f720..fc53d3210f 100644 --- a/src/lib/ecore_con/meson.build +++ b/src/lib/ecore_con/meson.build @@ -89,8 +89,9 @@ foreach eo_file : pub_eo_types_files install_dir : dir_package_include, command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), + '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), - '-ghd', '@INPUT@']) + '-gchd', '@INPUT@']) endforeach eolian_include_directories += ['-I', meson.current_source_dir()] diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index db6e21b9c4..9f3b2ff518 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -76,6 +76,44 @@ typedef struct _Efl_Text_Annotate_Annotation Efl_Text_Annotate_Annotation; #include /* Data types */ + +#ifdef EFL_BETA_API_SUPPORT +/** No error on load */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_NONE; + +/** A non-specific error occurred */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_GENERIC; + +/** File (or file path) does not exist */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST; + +/** Permission denied to an existing file (or path) */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_PERMISSION_DENIED; + +/** Allocation of resources failure prevented load */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + +/** File corrupt (but was detected as a known format) */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_CORRUPT_FILE; + +/** File is not a known format */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_FORMAT; + +/** Reading operation has been cancelled during decoding */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_CANCELLED; + +/** (Edje only) The file pointed to is incompatible, i.e., it doesn't + * match the library's current version's format. */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_INCOMPATIBLE_FILE; + +/** (Edje only) The group/collection set to load from was not found in the file */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION; + +/** (Edje only) The group/collection set to load from had recursive references + * on its components */ +extern EWAPI Eina_Error EFL_GFX_IMAGE_LOAD_ERROR_RECURSIVE_REFERENCE; +#endif /* EFL_BETA_API_SUPPORT */ + #include "interfaces/efl_gfx_types.eot.h" #include "interfaces/efl_ui_types.eot.h" typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; diff --git a/src/lib/efl/interfaces/efl_gfx_types.eot b/src/lib/efl/interfaces/efl_gfx_types.eot index e0ec30a3ac..2e14ae9732 100644 --- a/src/lib/efl/interfaces/efl_gfx_types.eot +++ b/src/lib/efl/interfaces/efl_gfx_types.eot @@ -205,14 +205,14 @@ enum @beta Efl.Gfx.Color_Class_Layer { type @beta Efl.Font.Size: int; [[Efl font size type]] -var @beta Efl.Gfx.Image.Load_Error.NONE: Eina.Error; [[No error on load]] -var @beta Efl.Gfx.Image.Load_Error.GENERIC: Eina.Error; [[A non-specific error occurred]] -var @beta Efl.Gfx.Image.Load_Error.DOES_NOT_EXIST: Eina.Error; [[File (or file path) does not exist]] -var @beta Efl.Gfx.Image.Load_Error.PERMISSION_DENIED: Eina.Error; [[Permission denied to an existing file (or path)]] -var @beta Efl.Gfx.Image.Load_Error.RESOURCE_ALLOCATION_FAILED: Eina.Error; [[Allocation of resources failure prevented load]] -var @beta Efl.Gfx.Image.Load_Error.CORRUPT_FILE: Eina.Error; [[File corrupt (but was detected as a known format)]] -var @beta Efl.Gfx.Image.Load_Error.UNKNOWN_FORMAT: Eina.Error; [[File is not a known format]] -var @beta Efl.Gfx.Image.Load_Error.CANCELLED: Eina.Error; [[Reading operation has been cancelled during decoding]] -var @beta Efl.Gfx.Image.Load_Error.INCOMPATIBLE_FILE: Eina.Error; [[(Edje only) The file pointed to is incompatible, i.e., it doesn't match the library's current version's format.]] -var @beta Efl.Gfx.Image.Load_Error.UNKNOWN_COLLECTION: Eina.Error; [[(Edje only) The group/collection set to load from was not found in the file]] -var @beta Efl.Gfx.Image.Load_Error.RECURSIVE_REFERENCE: Eina.Error; [[(Edje only) The group/collection set to load from had recursive references on its components]] +error @extern @beta Efl.Gfx.Image.Load_Error.NONE = "XXX"; [[No error on load]] +error @extern @beta Efl.Gfx.Image.Load_Error.GENERIC = "XXX"; [[A non-specific error occurred]] +error @extern @beta Efl.Gfx.Image.Load_Error.DOES_NOT_EXIST = "XXX"; [[File (or file path) does not exist]] +error @extern @beta Efl.Gfx.Image.Load_Error.PERMISSION_DENIED = "XXX"; [[Permission denied to an existing file (or path)]] +error @extern @beta Efl.Gfx.Image.Load_Error.RESOURCE_ALLOCATION_FAILED = "XXX"; [[Allocation of resources failure prevented load]] +error @extern @beta Efl.Gfx.Image.Load_Error.CORRUPT_FILE = "XXX"; [[File corrupt (but was detected as a known format)]] +error @extern @beta Efl.Gfx.Image.Load_Error.UNKNOWN_FORMAT = "XXX"; [[File is not a known format]] +error @extern @beta Efl.Gfx.Image.Load_Error.CANCELLED = "XXX"; [[Reading operation has been cancelled during decoding]] +error @extern @beta Efl.Gfx.Image.Load_Error.INCOMPATIBLE_FILE = "XXX"; [[(Edje only) The file pointed to is incompatible, i.e., it doesn't match the library's current version's format.]] +error @extern @beta Efl.Gfx.Image.Load_Error.UNKNOWN_COLLECTION = "XXX"; [[(Edje only) The group/collection set to load from was not found in the file]] +error @extern @beta Efl.Gfx.Image.Load_Error.RECURSIVE_REFERENCE = "XXX"; [[(Edje only) The group/collection set to load from had recursive references on its components]] diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index e5b5b6b00b..a4285ef04f 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -137,6 +137,9 @@ extern "C" { extern EAPI double _efl_startup_time; +/** Successfully applied the requested style from the current theme. */ +extern EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE; + // EO types. Defined for legacy-only builds as legacy uses typedef of EO types. #include "efl_ui.eot.h" #include "efl_ui_selection_types.eot.h" diff --git a/src/lib/elementary/efl_ui.eot b/src/lib/elementary/efl_ui.eot index f0b5e6ce44..4e665113f6 100644 --- a/src/lib/elementary/efl_ui.eot +++ b/src/lib/elementary/efl_ui.eot @@ -1,11 +1,16 @@ /* Efl.Ui enum and struct types */ import eina_types; -var Efl.Ui.Theme.Apply_Error.NONE: Eina.Error; [[Successfully applied the requested style from the current theme.]] -var Efl.Ui.Theme.Apply_Error.DEFAULT: Eina.Error; [[Successfully applied the default style. The widget may - look different from the rest of the UI if a custom theme - is in use, but it should be usable.]] -var Efl.Ui.Theme.Apply_Error.GENERIC: Eina.Error; [[Failed to apply theme. The widget may become unusable.]] +/* FIXME: find a better way to express this */ +error @extern Efl.Ui.Theme.Apply_Error.NONE = "Succcess"; [[Successfully applied the requested style from the current theme.]] + +error Efl.Ui.Theme.Apply_Error.DEFAULT = "Fallback to default style was enabled for this widget"; [[ + Successfully applied the default style. The widget may look different from + the rest of the UI if a custom theme is in use, but it should be usable. +]] +error Efl.Ui.Theme.Apply_Error.GENERIC = "An error occurred and no theme could be set for this widget"; [[ + Failed to apply theme. The widget may become unusable. +]] enum Efl.Ui.Focus.Direction { diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index dfc81efbba..0d781a94be 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -405,16 +405,14 @@ _sys_lang_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA } EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE = 0; -EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_DEFAULT = 0; -EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_GENERIC = 0; static void _efl_ui_theme_apply_error_init(void) { if (EFL_UI_THEME_APPLY_ERROR_DEFAULT) return; /* NONE should always be 0 */ - EFL_UI_THEME_APPLY_ERROR_DEFAULT = eina_error_msg_static_register("Fallback to default style was enabled for this widget"); - EFL_UI_THEME_APPLY_ERROR_GENERIC = eina_error_msg_static_register("An error occurred and no theme could be set for this widget"); + EFL_UI_THEME_APPLY_ERROR_DEFAULT; + EFL_UI_THEME_APPLY_ERROR_GENERIC; } // This is necessary to keep backward compatibility diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index 7afc2d218b..ab8ea9a215 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -300,6 +300,9 @@ #include "elm_object_item.h" #include "efl_ui.eot.h" typedef Eo Efl_Ui_Focus_Manager; + +extern EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE; + #define _EFL_UI_FOCUS_MANAGER_EO_CLASS_TYPE #include "efl_ui_focus_object.eo.h" #include "efl_ui_focus_manager.eo.h" diff --git a/src/lib/eolian/database_var.c b/src/lib/eolian/database_var.c index 4007091848..5029e52068 100644 --- a/src/lib/eolian/database_var.c +++ b/src/lib/eolian/database_var.c @@ -33,6 +33,7 @@ database_var_constant_add(Eolian_Unit *unit, Eolian_Variable *var) EOLIAN_OBJECT_ADD(unit, var->base.name, var, constants); eina_hash_set(unit->state->staging.constants_f, var->base.file, eina_list_append ((Eina_List*)eina_hash_find(unit->state->staging.constants_f, var->base.file), var)); + database_object_add(unit, &var->base); } void From 92da64a532f8c1746d7bd06b66b7ff4409c2ff8c Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 24 Sep 2019 17:06:24 +0200 Subject: [PATCH 018/115] eolian: remove support for globals This was meant to happen but did not previously happen. It is not ideal to do it now but better do it while we still can. In short, this removes one half of the variables API (keeps constants as they are) and repurposes the API to be only for constants. This is also better for consistency to match errors. --- src/bin/eolian/docs.c | 9 +- src/bin/eolian/types.c | 93 +++-------- .../eolian_mono/eolian/mono/documentation.hh | 17 +- .../eolian/mono/variable_definition.hh | 2 +- src/bin/eolian_mono/eolian_mono.cc | 4 +- src/bindings/luajit/eolian.lua | 70 ++------- src/lib/eolian/Eolian.h | 146 +++++------------- src/lib/eolian/database_check.c | 8 +- src/lib/eolian/database_expr.c | 2 +- src/lib/eolian/database_validate.c | 16 +- src/lib/eolian/database_var.c | 24 +-- src/lib/eolian/database_var_api.c | 15 +- src/lib/eolian/eo_lexer.c | 4 +- src/lib/eolian/eo_lexer.h | 14 +- src/lib/eolian/eo_parser.c | 36 ++--- src/lib/eolian/eolian_database.c | 43 +----- src/lib/eolian/eolian_database.h | 9 +- src/lib/eolian_cxx/grammar/klass_def.hpp | 45 ++---- src/scripts/pyolian/eolian.py | 43 ++---- src/scripts/pyolian/eolian_lib.py | 44 ++---- src/scripts/pyolian/generator.py | 3 +- src/scripts/pyolian/test_eolian.py | 34 +--- src/tests/eolian/eolian_parsing.c | 26 ++-- 23 files changed, 193 insertions(+), 514 deletions(-) diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c index e9af2e867f..6b016eb4ee 100644 --- a/src/bin/eolian/docs.c +++ b/src/bin/eolian/docs.c @@ -27,13 +27,8 @@ _generate_ref(const Eolian_State *state, const char *refn, Eina_Strbuf *wbuf) char *n = strdup(eolian_object_name_get(decl)); char *p = n; while ((p = strchr(p, '.'))) *p = '_'; - if (eolian_object_type_get(decl) == EOLIAN_OBJECT_VARIABLE) - { - const Eolian_Variable *v = (const Eolian_Variable *)decl; - /* constants are emitted as macros */ - if (eolian_variable_type_get(v) == EOLIAN_VAR_CONSTANT) - eina_str_toupper(&n); - } + if (eolian_object_type_get(decl) == EOLIAN_OBJECT_CONSTANT) + eina_str_toupper(&n); eina_strbuf_append(wbuf, n); free(n); return; diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c index 75426f1220..96232833cd 100644 --- a/src/bin/eolian/types.c +++ b/src/bin/eolian/types.c @@ -168,12 +168,12 @@ _type_generate(const Eolian_State *state, const Eolian_Typedecl *tp, } static Eina_Strbuf * -_var_generate(const Eolian_State *state, const Eolian_Variable *vr) +_const_generate(const Eolian_State *state, const Eolian_Constant *vr) { - char *fn = strdup(eolian_variable_name_get(vr)); + char *fn = strdup(eolian_constant_name_get(vr)); char *p = strrchr(fn, '.'); if (p) *p = '\0'; - Eina_Strbuf *buf = eo_gen_docs_full_gen(state, eolian_variable_documentation_get(vr), + Eina_Strbuf *buf = eo_gen_docs_full_gen(state, eolian_constant_documentation_get(vr), fn, 0); if (p) { @@ -184,31 +184,23 @@ _var_generate(const Eolian_State *state, const Eolian_Variable *vr) eina_str_toupper(&fn); if (!buf) buf = eina_strbuf_new(); else eina_strbuf_append_char(buf, '\n'); - const Eolian_Type *vt = eolian_variable_base_type_get(vr); - if (eolian_variable_type_get(vr) == EOLIAN_VAR_CONSTANT) - { - /* we generate a define macro here, as it's a constant */ - eina_strbuf_prepend_printf(buf, "#ifndef %s\n", fn); - eina_strbuf_append_printf(buf, "#define %s ", fn); - const Eolian_Expression *vv = eolian_variable_value_get(vr); - Eolian_Value val = eolian_expression_eval(vv, EOLIAN_MASK_ALL); - Eina_Stringshare *lit = eolian_expression_value_to_literal(&val); - eina_strbuf_append(buf, lit); - Eina_Stringshare *exp = eolian_expression_serialize(vv); - if (exp && strcmp(lit, exp)) - eina_strbuf_append_printf(buf, " /* %s */", exp); - eina_stringshare_del(lit); - eina_stringshare_del(exp); - eina_strbuf_append(buf, "\n#endif"); - } - else - { - Eina_Stringshare *ct = eolian_type_c_type_get(vt); - eina_strbuf_append_printf(buf, "EWAPI extern %s %s;", ct, fn); - eina_stringshare_del(ct); - } + + /* we generate a define macro here, as it's a constant */ + eina_strbuf_prepend_printf(buf, "#ifndef %s\n", fn); + eina_strbuf_append_printf(buf, "#define %s ", fn); + const Eolian_Expression *vv = eolian_constant_value_get(vr); + Eolian_Value val = eolian_expression_eval(vv, EOLIAN_MASK_ALL); + Eina_Stringshare *lit = eolian_expression_value_to_literal(&val); + eina_strbuf_append(buf, lit); + Eina_Stringshare *exp = eolian_expression_serialize(vv); + if (exp && strcmp(lit, exp)) + eina_strbuf_append_printf(buf, " /* %s */", exp); + eina_stringshare_del(lit); + eina_stringshare_del(exp); + eina_strbuf_append(buf, "\n#endif"); + free(fn); - if (eolian_variable_is_beta(vr)) + if (eolian_constant_is_beta(vr)) { eina_strbuf_prepend(buf, "#ifdef EFL_BETA_API_SUPPORT\n"); eina_strbuf_append(buf, "\n#endif /* EFL_BETA_API_SUPPORT */"); @@ -259,13 +251,13 @@ void eo_gen_types_header_gen(const Eolian_State *state, { Eolian_Object_Type dt = eolian_object_type_get(decl); - if (dt == EOLIAN_OBJECT_VARIABLE) + if (dt == EOLIAN_OBJECT_CONSTANT) { - const Eolian_Variable *vr = (const Eolian_Variable *)decl; - if (!vr || eolian_variable_is_extern(vr)) + const Eolian_Constant *vr = (const Eolian_Constant *)decl; + if (!vr || eolian_constant_is_extern(vr)) continue; - Eina_Strbuf *vbuf = _var_generate(state, vr); + Eina_Strbuf *vbuf = _const_generate(state, vr); if (vbuf) { eina_strbuf_append(buf, eina_strbuf_string_get(vbuf)); @@ -375,43 +367,6 @@ _source_gen_error(Eina_Strbuf *buf, const Eolian_Error *err) eina_strbuf_append(buf, " return err;\n}\n\n"); } -static void -_source_gen_var(Eina_Strbuf *buf, const Eolian_Variable *vr) -{ - if (eolian_variable_is_extern(vr)) - return; - - if (eolian_variable_type_get(vr) == EOLIAN_VAR_CONSTANT) - return; - - const Eolian_Expression *vv = eolian_variable_value_get(vr); - if (!vv) - return; - - char *fn = strdup(eolian_variable_name_get(vr)); - for (char *p = strchr(fn, '.'); p; p = strchr(p, '.')) - *p = '_'; - eina_str_toupper(&fn); - - const Eolian_Type *vt = eolian_variable_base_type_get(vr); - Eina_Stringshare *ct = eolian_type_c_type_get(vt); - eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn); - eina_stringshare_del(ct); - free(fn); - - Eolian_Value val = eolian_expression_eval(vv, EOLIAN_MASK_ALL); - Eina_Stringshare *lit = eolian_expression_value_to_literal(&val); - eina_strbuf_append(buf, lit); - eina_strbuf_append_char(buf, ';'); - Eina_Stringshare *exp = eolian_expression_serialize(vv); - if (exp && strcmp(lit, exp)) - eina_strbuf_append_printf(buf, " /* %s */", exp); - eina_stringshare_del(lit); - eina_stringshare_del(exp); - - eina_strbuf_append(buf, "\n"); -} - void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf) { const Eolian_Object *decl; @@ -421,8 +376,6 @@ void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf) if (dt == EOLIAN_OBJECT_ERROR) _source_gen_error(buf, (const Eolian_Error *)decl); - else if (dt == EOLIAN_OBJECT_VARIABLE) - _source_gen_var(buf, (const Eolian_Variable *)decl); } eina_iterator_free(itr); } diff --git a/src/bin/eolian_mono/eolian/mono/documentation.hh b/src/bin/eolian_mono/eolian/mono/documentation.hh index 234ce49430..a7821c5e5d 100644 --- a/src/bin/eolian_mono/eolian/mono/documentation.hh +++ b/src/bin/eolian_mono/eolian/mono/documentation.hh @@ -187,17 +187,12 @@ struct documentation_generator ref += function_conversion(data, (const ::Eolian_Function *)data2, name_tail); is_beta = eolian_object_is_beta(data) || eolian_object_is_beta(data2); break; - case ::EOLIAN_OBJECT_VARIABLE: - if (::eolian_variable_type_get((::Eolian_Variable *)data) == ::EOLIAN_VAR_CONSTANT) - { - auto names = utils::split(name_helpers::managed_namespace(::eolian_object_name_get(data)), '.'); - names.pop_back(); // Remove var name - ref = name_helpers::join_namespaces(names, '.'); - ref += "Constants."; - ref += name_helpers::managed_name(::eolian_object_short_name_get(data)); - } - // Otherwise, do nothing and no tag will be generated. Because, who would - // reference a global (non-constant) variable in the docs? + case ::EOLIAN_OBJECT_CONSTANT: + auto names = utils::split(name_helpers::managed_namespace(::eolian_object_name_get(data)), '.'); + names.pop_back(); // Remove var name + ref = name_helpers::join_namespaces(names, '.'); + ref += "Constants."; + ref += name_helpers::managed_name(::eolian_object_short_name_get(data)); break; case ::EOLIAN_OBJECT_UNKNOWN: // If the reference cannot be resolved, just return an empty string and diff --git a/src/bin/eolian_mono/eolian/mono/variable_definition.hh b/src/bin/eolian_mono/eolian/mono/variable_definition.hh index fdc5219794..c34a18cc7f 100644 --- a/src/bin/eolian_mono/eolian/mono/variable_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/variable_definition.hh @@ -28,7 +28,7 @@ namespace eolian_mono { struct constant_definition_generator { template - bool generate(OutputIterator sink, attributes::variable_def constant, Context const& context) const + bool generate(OutputIterator sink, attributes::constant_def constant, Context const& context) const { // Open partial class if (!name_helpers::open_namespaces(sink, constant.namespaces, context)) diff --git a/src/bin/eolian_mono/eolian_mono.cc b/src/bin/eolian_mono/eolian_mono.cc index 42f8034a03..83379b28cb 100644 --- a/src/bin/eolian_mono/eolian_mono.cc +++ b/src/bin/eolian_mono/eolian_mono.cc @@ -177,10 +177,10 @@ run(options_type const& opts) // Constants { auto var_cxt = context_add_tag(class_context{class_context::variables}, context); - for (efl::eina::iterator var_iterator( ::eolian_state_constants_by_file_get(opts.state, basename_input.c_str())) + for (efl::eina::iterator var_iterator( ::eolian_state_constants_by_file_get(opts.state, basename_input.c_str())) , var_last; var_iterator != var_last; ++var_iterator) { - efl::eolian::grammar::attributes::variable_def var(&*var_iterator, opts.unit); + efl::eolian::grammar::attributes::constant_def var(&*var_iterator, opts.unit); if (!eolian_mono::constant_definition.generate(iterator, var, var_cxt)) { throw std::runtime_error("Failed to generate enum"); diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index 7fec606c10..bd3b20601b 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -25,7 +25,7 @@ ffi.cdef [[ typedef struct _Eolian_Constructor Eolian_Constructor; typedef struct _Eolian_Event Eolian_Event; typedef struct _Eolian_Expression Eolian_Expression; - typedef struct _Eolian_Variable Eolian_Variable; + typedef struct _Eolian_Constant Eolian_Constant; typedef struct _Eolian_Error Eolian_Error; typedef struct _Eolian_Struct_Type_Field Eolian_Struct_Type_Field; typedef struct _Eolian_Enum_Type_Field Eolian_Enum_Type_Field; @@ -43,7 +43,7 @@ ffi.cdef [[ EOLIAN_OBJECT_STRUCT_FIELD, EOLIAN_OBJECT_ENUM_FIELD, EOLIAN_OBJECT_TYPE, - EOLIAN_OBJECT_VARIABLE, + EOLIAN_OBJECT_CONSTANT, EOLIAN_OBJECT_EXPRESSION, EOLIAN_OBJECT_FUNCTION, EOLIAN_OBJECT_FUNCTION_PARAMETER, @@ -207,12 +207,6 @@ ffi.cdef [[ | EOLIAN_MASK_NULL } Eolian_Expression_Mask; - typedef enum { - EOLIAN_VAR_UNKNOWN = 0, - EOLIAN_VAR_CONSTANT, - EOLIAN_VAR_GLOBAL - } Eolian_Variable_Type; - typedef union { char c; Eina_Bool b; @@ -325,11 +319,9 @@ ffi.cdef [[ Eina_Iterator *eolian_unit_objects_get(const Eolian_Unit *unit); const Eolian_Class *eolian_unit_class_by_name_get(const Eolian_Unit *unit, const char *class_name); Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit); - const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name); - const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); + const Eolian_Constant *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, const char *name); Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit); - Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit); Eina_Iterator *eolian_unit_errors_get(const Eolian_Unit *unit); const Eolian_Typedecl *eolian_unit_alias_by_name_get(const Eolian_Unit *unit, const char *name); const Eolian_Typedecl *eolian_unit_struct_by_name_get(const Eolian_Unit *unit, const char *name); @@ -339,7 +331,6 @@ ffi.cdef [[ Eina_Iterator *eolian_unit_enums_get(const Eolian_Unit *unit); Eina_Iterator *eolian_state_objects_by_file_get(const Eolian_State *state, const char *file_name); const Eolian_Class *eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name); - Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name); Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name); Eina_Iterator *eolian_state_errors_by_file_get(const Eolian_State *state, const char *file_name); Eina_Iterator *eolian_state_aliases_by_file_get(const Eolian_State *state, const char *file_name); @@ -462,11 +453,10 @@ ffi.cdef [[ Eolian_Unary_Operator eolian_expression_unary_operator_get(const Eolian_Expression *expr); const Eolian_Expression *eolian_expression_unary_expression_get(const Eolian_Expression *expr); Eolian_Value_t eolian_expression_value_get(const Eolian_Expression *expr); - Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var); - const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var); - const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var); - const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var); - Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); + const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var); + const Eolian_Type *eolian_constant_base_type_get(const Eolian_Constant *var); + const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var); + Eina_Bool eolian_constant_is_extern(const Eolian_Constant *var); const char *eolian_documentation_summary_get(const Eolian_Documentation *doc); const char *eolian_documentation_description_get(const Eolian_Documentation *doc); const char *eolian_documentation_since_get(const Eolian_Documentation *doc); @@ -522,7 +512,7 @@ M.object_type = { STRUCT_FIELD = 3, ENUM_FIELD = 4, TYPE = 5, - VARIABLE = 6, + CONSTANT = 6, EXPRESSION = 7, FUNCTION = 8, FUNCTION_PARAMETER = 9, @@ -674,12 +664,6 @@ local unit_idx, wrap_unit = gen_wrap { eolian.eolian_unit_classes_get(cast_unit(self))) end, - global_by_name_get = function(self, name) - local v = eolian.eolian_unit_global_by_name_get(cast_unit(self), name) - if v == nil then return nil end - return v - end, - constant_by_name_get = function(self, name) local v = eolian.eolian_unit_constant_by_name_get(cast_unit(self), name) if v == nil then return nil end @@ -693,15 +677,10 @@ local unit_idx, wrap_unit = gen_wrap { end, constants_get = function(self) - return Ptr_Iterator("const Eolian_Variable *", + return Ptr_Iterator("const Eolian_Constant *", eolian.eolian_unit_constants_get(cast_unit(self))) end, - globals_get = function(self) - return Ptr_Iterator("const Eolian_Variable *", - eolian.eolian_unit_globals_get(cast_unit(self))) - end, - errors_get = function(self) return Ptr_Iterator("const Eolian_Error *", eolian.eolian_unit_errors_get(cast_unit(self))) @@ -860,13 +839,8 @@ ffi.metatype("Eolian_State", { return v end, - globals_by_file_get = function(unit, fname) - return Ptr_Iterator("const Eolian_Variable*", - eolian.eolian_state_globals_by_file_get(self, fname)) - end, - constants_by_file_get = function(unit, fname) - return Ptr_Iterator("const Eolian_Variable*", + return Ptr_Iterator("const Eolian_Constant*", eolian.eolian_state_constants_by_file_get(self, fname)) end, @@ -1606,12 +1580,6 @@ emask.NUMBER = bit.bor(emask.INT , emask.FLOAT) emask.ALL = bit.bor(emask.NUMBER, emask.BOOL, emask.STRING, emask.CHAR, emask.NULL) -M.variable_type = { - UNKNOWN = 0, - CONSTANT = 1, - GLOBAL = 2 -} - local value_con = { [etype.INT ] = function(v) return tonumber(v.value.i ) end, [etype.UINT ] = function(v) return tonumber(v.value.u ) end, @@ -1737,32 +1705,28 @@ M.Expression = ffi.metatype("Eolian_Expression", { } }) -M.Variable = ffi.metatype("Eolian_Variable", { +M.Constant = ffi.metatype("Eolian_Constant", { __index = wrap_object { - type_get = function(self) - return tonumber(eolian.eolian_variable_type_get(self)) - end, - documentation_get = function(self) - local v = eolian.eolian_variable_documentation_get(self) + local v = eolian.eolian_constant_documentation_get(self) if v == nil then return nil end return v end, base_type_get = function(self) - local v = eolian.eolian_variable_base_type_get(self) + local v = eolian.eolian_constant_base_type_get(self) if v == nil then return nil end return v end, value_get = function(self) - local v = eolian.eolian_variable_value_get(self) + local v = eolian.eolian_constant_value_get(self) if v == nil then return nil end return v end, is_extern = function(self) - return eolian.eolian_variable_is_extern(self) ~= 0 + return eolian.eolian_constant_is_extern(self) ~= 0 end } }) @@ -1890,8 +1854,8 @@ M.Eolian_Doc_Token = ffi.metatype("Eolian_Doc_Token", { elseif tp == reft.ENUM_FIELD then return tp, ffi.cast("const Eolian_Typedecl *", stor[0]), ffi.cast("const Eolian_Enum_Type_Field *", stor[1]) - elseif tp == reft.VARIABLE then - return tp, ffi.cast("const Eolian_Variable *", stor[0]) + elseif tp == reft.CONSTANT then + return tp, ffi.cast("const Eolian_Constant *", stor[0]) else return reft.UNKNOWN end diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index ed6444ce73..b0d7a4e9ce 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -164,11 +164,11 @@ typedef struct _Eolian_Event Eolian_Event; */ typedef struct _Eolian_Expression Eolian_Expression; -/* Variable information +/* Constant information * * @ingroup Eolian */ -typedef struct _Eolian_Variable Eolian_Variable; +typedef struct _Eolian_Constant Eolian_Constant; /* Error information * @@ -220,7 +220,7 @@ typedef enum EOLIAN_OBJECT_STRUCT_FIELD, EOLIAN_OBJECT_ENUM_FIELD, EOLIAN_OBJECT_TYPE, - EOLIAN_OBJECT_VARIABLE, + EOLIAN_OBJECT_CONSTANT, EOLIAN_OBJECT_EXPRESSION, EOLIAN_OBJECT_FUNCTION, EOLIAN_OBJECT_FUNCTION_PARAMETER, @@ -388,13 +388,6 @@ typedef enum | EOLIAN_MASK_NULL } Eolian_Expression_Mask; -typedef enum -{ - EOLIAN_VAR_UNKNOWN = 0, - EOLIAN_VAR_CONSTANT, - EOLIAN_VAR_GLOBAL -} Eolian_Variable_Type; - typedef union { char c; @@ -699,7 +692,7 @@ EAPI const char *eolian_object_name_get(const Eolian_Object *obj); * This is the full name, but for C. It is typically derived from the * regular full name, with namespaces flattened to underscores, but * some things may be explicitly renamed. Only classes, types (both - * declarations and instances) and variables have C names, as others + * declarations and instances) and constants have C names, as others * are never referred to by name directly in C. * * @see eolian_object_unit_get @@ -1018,7 +1011,7 @@ EAPI unsigned short eolian_unit_version_get(const Eolian_Unit *unit); * @brief Get an object in a unit by name. * * Only objects declared directly within the file can be retrieved, i.e. - * classes, typedecls and variables. + * classes, typedecls and constants. * * @param[in] unit The unit. * @param[in] name The fully namespaced object name. @@ -1032,7 +1025,7 @@ EAPI const Eolian_Object *eolian_unit_object_by_name_get(const Eolian_Unit *unit * * The order is not necessarily the declaration order. Only objects declared * directly within the file can be retrieved, i.e. classes, typedecls and - * variables. + * constants. * * @param[in] unit The unit. * @@ -1060,24 +1053,14 @@ EAPI const Eolian_Class *eolian_unit_class_by_name_get(const Eolian_Unit *unit, EAPI Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit); /* - * @brief Get a global variable in a unit by name. + * @brief Get a constant in a unit by name. * * @param[in] unit The unit. - * @param[in] name the name of the variable + * @param[in] name the name of the constant * * @ingroup Eolian */ -EAPI const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name); - -/* - * @brief Get a constant variable in a unit by name. - * - * @param[in] unit The unit. - * @param[in] name the name of the variable - * - * @ingroup Eolian - */ -EAPI const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); +EAPI const Eolian_Constant *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); /* * @brief Get an error declaration in a unit by name. @@ -1090,7 +1073,7 @@ EAPI const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit * EAPI const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, const char *name); /* - * @brief Get an iterator to all constant variables in the Eolian database. + * @brief Get an iterator to all constants in the Eolian database. * * @return the iterator or NULL * @@ -1100,17 +1083,6 @@ EAPI const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, */ EAPI Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit); -/* - * @brief Get an iterator to all global variables in the Eolian database. - * - * @return the iterator or NULL - * - * Thanks to internal caching, this is an O(1) operation. - * - * @ingroup Eolian - */ -EAPI Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit); - /* * @brief Get an iterator to all error declarations in the Eolian database. * @@ -1203,7 +1175,7 @@ eolian_state_object_by_name_get(const Eolian_State *state, const char *name) * * The list follows declaration order in the file. Only objects declared * directly within the file can be retrieved, i.e. classes, typedecls and - * variables. + * constants. * * @param[in] state The state. * @param[in] file_name The file name. @@ -1261,19 +1233,6 @@ eolian_state_classes_get(const Eolian_State *state) return eolian_unit_classes_get(EOLIAN_UNIT(state)); } -/* - * @brief A helper function to get a global in a state by name. - * - * @see eolian_unit_global_by_name_get - * - * @ingroup Eolian - */ -static inline const Eolian_Variable * -eolian_state_global_by_name_get(const Eolian_State *state, const char *name) -{ - return eolian_unit_global_by_name_get(EOLIAN_UNIT(state), name); -} - /* * @brief A helper function to get a constant in a state by name. * @@ -1281,7 +1240,7 @@ eolian_state_global_by_name_get(const Eolian_State *state, const char *name) * * @ingroup Eolian */ -static inline const Eolian_Variable * +static inline const Eolian_Constant * eolian_state_constant_by_name_get(const Eolian_State *state, const char *name) { return eolian_unit_constant_by_name_get(EOLIAN_UNIT(state), name); @@ -1301,19 +1260,7 @@ eolian_state_error_by_name_get(const Eolian_State *state, const char *name) } /* - * @brief Get an iterator to all global variables contained in a file. - * - * @param[in] state The state. - * @param[in] file_name The file name. - * - * Thanks to internal caching, this is an O(1) operation. - * - * @ingroup Eolian - */ -EAPI Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name); - -/* - * @brief Get an iterator to all constant variables contained in a file. + * @brief Get an iterator to all constants contained in a file. * * @param[in] state The state. * @param[in] file_name The file name. @@ -1338,19 +1285,6 @@ EAPI Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state */ EAPI Eina_Iterator *eolian_state_errors_by_file_get(const Eolian_State *state, const char *file_name); -/* - * @brief A helper function to get all globals in a state. - * - * @see eolian_unit_globals_get - * - * @ingroup Eolian - */ -static inline Eina_Iterator * -eolian_state_globals_get(const Eolian_State *state) -{ - return eolian_unit_globals_get(EOLIAN_UNIT(state)); -} - /* * @brief A helper function to get all constants in a state. * @@ -3182,116 +3116,106 @@ EAPI const Eolian_Expression *eolian_expression_unary_expression_get(const Eolia EAPI Eolian_Value eolian_expression_value_get(const Eolian_Expression *expr); /* - * @brief Get the type of a variable (global, constant) + * @brief Get the documentation of a constant. * - * @param[in] var the variable. - * @return an Eolian_Type_Type. - * - * @ingroup Eolian - */ -EAPI Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var); - -/* - * @brief Get the documentation of a variable. - * - * @param[in] var the variable. + * @param[in] var the constant. * @return the documentation or NULL. * * @ingroup Eolian */ -EAPI const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var); +EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var); /* - * @brief Get the base type of a variable. + * @brief Get the base type of a constant. * - * @param[in] var the variable. + * @param[in] var the constant. * @return the base type or NULL. * * @ingroup Eolian */ -EAPI const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var); +EAPI const Eolian_Type *eolian_constant_base_type_get(const Eolian_Constant *var); /* - * @brief Get the value of a variable. + * @brief Get the value of a constant. * - * @param[in] var the variable. + * @param[in] var the constant. * @return the value or NULL. * * @ingroup Eolian */ -EAPI const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var); +EAPI const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var); /* - * @brief A helper function to get the full name of a variable. + * @brief A helper function to get the full name of a constant. * * @see eolian_object_name_get * * @ingroup Eolian */ static inline const char * -eolian_variable_name_get(const Eolian_Variable *tp) +eolian_constant_name_get(const Eolian_Constant *tp) { return eolian_object_name_get(EOLIAN_OBJECT(tp)); } /* - * @brief A helper function to get the C name of a variable. + * @brief A helper function to get the C name of a constant. * * @see eolian_object_c_name_get * * @ingroup Eolian */ static inline const char * -eolian_variable_c_name_get(const Eolian_Variable *tp) +eolian_constant_c_name_get(const Eolian_Constant *tp) { return eolian_object_c_name_get(EOLIAN_OBJECT(tp)); } /* - * @brief A helper function to get the short name of a variable. + * @brief A helper function to get the short name of a constant. * * @see eolian_object_short_name_get * * @ingroup Eolian */ static inline const char * -eolian_variable_short_name_get(const Eolian_Variable *tp) +eolian_constant_short_name_get(const Eolian_Constant *tp) { return eolian_object_short_name_get(EOLIAN_OBJECT(tp)); } /* - * @brief A helper function to get the namespaces of a variable. + * @brief A helper function to get the namespaces of a constant. * * @see eolian_object_namespaces_get * * @ingroup Eolian */ static inline Eina_Iterator * -eolian_variable_namespaces_get(const Eolian_Variable *tp) +eolian_constant_namespaces_get(const Eolian_Constant *tp) { return eolian_object_namespaces_get(EOLIAN_OBJECT(tp)); } /* - * @brief Check if a variable is extern. + * @brief Check if a constant is extern. * - * @param[in] var the variable. + * @param[in] var the constant. * @return EINA_TRUE if it's extern, EINA_FALSE otherwise. * * @ingroup Eolian */ -EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); +EAPI Eina_Bool eolian_constant_is_extern(const Eolian_Constant *var); /* - * @brief Get whether a variable is beta. + * @brief Get whether a constant is beta. * * @see eolian_object_is_beta * * @ingroup Eolian */ static inline Eina_Bool -eolian_variable_is_beta(const Eolian_Variable *var) +eolian_constant_is_beta(const Eolian_Constant *var) { return eolian_object_is_beta(EOLIAN_OBJECT(var)); } diff --git a/src/lib/eolian/database_check.c b/src/lib/eolian/database_check.c index 4e448cea7a..0626512076 100644 --- a/src/lib/eolian/database_check.c +++ b/src/lib/eolian/database_check.c @@ -47,7 +47,7 @@ _check_expr_cb(const Eolian_Object *obj, void *data) switch (obj->type) { case EOLIAN_OBJECT_TYPEDECL: - case EOLIAN_OBJECT_VARIABLE: + case EOLIAN_OBJECT_CONSTANT: _add_dep(depset, obj->unit); default: break; @@ -195,7 +195,7 @@ _check_typedecl(const Eolian_Typedecl *tp, Eina_Hash *depset, Eina_Hash *chash) } static void -_check_variable(const Eolian_Variable *v, Eina_Hash *depset, Eina_Hash *chash) +_check_constant(const Eolian_Constant *v, Eina_Hash *depset, Eina_Hash *chash) { if (_check_cycle(chash, &v->base)) return; @@ -230,8 +230,8 @@ _check_unit(const Eolian_Unit *unit) case EOLIAN_OBJECT_TYPEDECL: _check_typedecl((const Eolian_Typedecl *)obj, depset, chash); break; - case EOLIAN_OBJECT_VARIABLE: - _check_variable((const Eolian_Variable *)obj, depset, chash); + case EOLIAN_OBJECT_CONSTANT: + _check_constant((const Eolian_Constant *)obj, depset, chash); break; default: continue; diff --git a/src/lib/eolian/database_expr.c b/src/lib/eolian/database_expr.c index c2b6030db1..978f281a8f 100644 --- a/src/lib/eolian/database_expr.c +++ b/src/lib/eolian/database_expr.c @@ -512,7 +512,7 @@ eval_exp(const Eolian_Unit *unit, Eolian_Expression *expr, return eval_exp(NULL, expr->expr, mask, out, cb, data); } - const Eolian_Variable *var = eolian_unit_constant_by_name_get + const Eolian_Constant *var = eolian_unit_constant_by_name_get (unit, expr->value.s); Eolian_Expression *exp = NULL; diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index d0bf40d17a..87d51ac2e1 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c @@ -1488,7 +1488,7 @@ _validate_class(Validate_State *vals, Eolian_Class *cl, } static Eina_Bool -_validate_variable(Validate_State *vals, Eolian_Variable *var) +_validate_constant(Validate_State *vals, Eolian_Constant *var) { if (var->base.validated) return EINA_TRUE; @@ -1498,7 +1498,7 @@ _validate_variable(Validate_State *vals, Eolian_Variable *var) if (!_validate_type(vals, var->base_type)) return _reset_stable(vals, was_stable, EINA_FALSE); - if (var->value && !_validate_expr(var->value, var->base_type, 0, EINA_FALSE)) + if (!_validate_expr(var->value, var->base_type, 0, EINA_FALSE)) return _reset_stable(vals, was_stable, EINA_FALSE); if (!_validate_doc(var->doc)) @@ -1516,10 +1516,10 @@ _typedecl_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, } static Eina_Bool -_var_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, - Eolian_Variable *var, Cb_Ret *sc) +_constant_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, + Eolian_Constant *var, Cb_Ret *sc) { - return (sc->succ = _validate_variable(sc->vals, var)); + return (sc->succ = _validate_constant(sc->vals, var)); } Eina_Bool @@ -1597,11 +1597,7 @@ database_validate(const Eolian_Unit *src) if (!rt.succ) return EINA_FALSE; - eina_hash_foreach(src->globals, (Eina_Hash_Foreach)_var_map_cb, &rt); - if (!rt.succ) - return EINA_FALSE; - - eina_hash_foreach(src->constants, (Eina_Hash_Foreach)_var_map_cb, &rt); + eina_hash_foreach(src->constants, (Eina_Hash_Foreach)_constant_map_cb, &rt); if (!rt.succ) return EINA_FALSE; diff --git a/src/lib/eolian/database_var.c b/src/lib/eolian/database_var.c index 5029e52068..a714bd6344 100644 --- a/src/lib/eolian/database_var.c +++ b/src/lib/eolian/database_var.c @@ -6,7 +6,7 @@ #include "eo_lexer.h" void -database_var_del(Eolian_Variable *var) +database_constant_del(Eolian_Constant *var) { if (!var || eolian_object_unref(&var->base)) return; eina_stringshare_del(var->base.file); @@ -19,29 +19,11 @@ database_var_del(Eolian_Variable *var) free(var); } -static void -database_var_global_add(Eolian_Unit *unit, Eolian_Variable *var) -{ - EOLIAN_OBJECT_ADD(unit, var->base.name, var, globals); - eina_hash_set(unit->state->staging.globals_f, var->base.file, eina_list_append - ((Eina_List*)eina_hash_find(unit->state->staging.globals_f, var->base.file), var)); -} - -static void -database_var_constant_add(Eolian_Unit *unit, Eolian_Variable *var) +void +database_constant_add(Eolian_Unit *unit, Eolian_Constant *var) { EOLIAN_OBJECT_ADD(unit, var->base.name, var, constants); eina_hash_set(unit->state->staging.constants_f, var->base.file, eina_list_append ((Eina_List*)eina_hash_find(unit->state->staging.constants_f, var->base.file), var)); database_object_add(unit, &var->base); } - -void -database_var_add(Eolian_Unit *unit, Eolian_Variable *var) -{ - if (var->type == EOLIAN_VAR_GLOBAL) - database_var_global_add(unit, var); - else - database_var_constant_add(unit, var); - database_object_add(unit, &var->base); -} diff --git a/src/lib/eolian/database_var_api.c b/src/lib/eolian/database_var_api.c index 099237a8ba..260baa638f 100644 --- a/src/lib/eolian/database_var_api.c +++ b/src/lib/eolian/database_var_api.c @@ -5,36 +5,29 @@ #include #include "eolian_database.h" -EAPI Eolian_Variable_Type -eolian_variable_type_get(const Eolian_Variable *var) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(var, EOLIAN_VAR_UNKNOWN); - return var->type; -} - EAPI const Eolian_Documentation * -eolian_variable_documentation_get(const Eolian_Variable *var) +eolian_constant_documentation_get(const Eolian_Constant *var) { EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); return var->doc; } EAPI const Eolian_Type * -eolian_variable_base_type_get(const Eolian_Variable *var) +eolian_constant_base_type_get(const Eolian_Constant *var) { EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); return var->base_type; } EAPI const Eolian_Expression * -eolian_variable_value_get(const Eolian_Variable *var) +eolian_constant_value_get(const Eolian_Constant *var) { EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); return var->value; } EAPI Eina_Bool -eolian_variable_is_extern(const Eolian_Variable *var) +eolian_constant_is_extern(const Eolian_Constant *var) { EINA_SAFETY_ON_NULL_RETURN_VAL(var, EINA_FALSE); return var->is_extern; diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index 809e7fae5d..165c8340f2 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -1056,8 +1056,8 @@ _node_free(Eolian_Object *obj) case EOLIAN_OBJECT_TYPE: database_type_del((Eolian_Type *)obj); break; - case EOLIAN_OBJECT_VARIABLE: - database_var_del((Eolian_Variable *)obj); + case EOLIAN_OBJECT_CONSTANT: + database_constant_del((Eolian_Constant *)obj); break; case EOLIAN_OBJECT_EXPRESSION: database_expr_del((Eolian_Expression *)obj); diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 3b2bf734ac..706acb028e 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -31,7 +31,7 @@ enum Tokens KW(data), KW(destructor), KW(error), KW(event_prefix), KW(events), KW(extends), \ KW(free), KW(get), KW(implements), KW(import), KW(interface), \ KW(keys), KW(legacy), KW(methods), KW(mixin), KW(params), \ - KW(parse), KW(parts), KW(ptr), KW(set), KW(type), KW(values), KW(var), KW(requires), \ + KW(parse), KW(parts), KW(ptr), KW(set), KW(type), KW(values), KW(requires), \ \ KWAT(auto), KWAT(beta), KWAT(by_ref), KWAT(c_name), KWAT(const), \ KWAT(empty), KWAT(extern), KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), \ @@ -264,16 +264,16 @@ eo_lexer_typedecl_release(Eo_Lexer *ls, Eolian_Typedecl *tp) return (Eolian_Typedecl *)eo_lexer_node_release(ls, (Eolian_Object *)tp); } -static inline Eolian_Variable * -eo_lexer_variable_new(Eo_Lexer *ls) +static inline Eolian_Constant * +eo_lexer_constant_new(Eo_Lexer *ls) { - return (Eolian_Variable *)eo_lexer_node_new(ls, sizeof(Eolian_Variable)); + return (Eolian_Constant *)eo_lexer_node_new(ls, sizeof(Eolian_Constant)); } -static inline Eolian_Variable * -eo_lexer_variable_release(Eo_Lexer *ls, Eolian_Variable *var) +static inline Eolian_Constant * +eo_lexer_constant_release(Eo_Lexer *ls, Eolian_Constant *var) { - return (Eolian_Variable *)eo_lexer_node_release(ls, (Eolian_Object *)var); + return (Eolian_Constant *)eo_lexer_node_release(ls, (Eolian_Object *)var); } static inline Eolian_Expression * diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 879cc0af3a..faaaf4fb3d 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -125,7 +125,7 @@ _eolian_decl_get(Eo_Lexer *ls, const char *name) obj = eina_hash_find(ls->state->staging.unit.objects, name); if (obj && ((obj->type == EOLIAN_OBJECT_CLASS) || (obj->type == EOLIAN_OBJECT_TYPEDECL) || - (obj->type == EOLIAN_OBJECT_VARIABLE))) + (obj->type == EOLIAN_OBJECT_CONSTANT))) return obj; return NULL; @@ -152,8 +152,8 @@ _eolian_decl_name_get(Eolian_Object *obj) break; } goto end; - case EOLIAN_OBJECT_VARIABLE: - return "variable"; + case EOLIAN_OBJECT_CONSTANT: + return "constant"; default: break; } @@ -879,10 +879,10 @@ tags_done: return def; } -static Eolian_Variable * -parse_variable(Eo_Lexer *ls, Eina_Bool global) +static Eolian_Constant * +parse_constant(Eo_Lexer *ls) { - Eolian_Variable *def = eo_lexer_variable_new(ls); + Eolian_Constant *def = eo_lexer_constant_new(ls); Eina_Strbuf *buf; eo_lexer_get(ls); Eina_Stringshare *cname = NULL; @@ -908,11 +908,10 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global) goto tags_done; } tags_done: - def->type = global ? EOLIAN_VAR_GLOBAL : EOLIAN_VAR_CONSTANT; buf = eina_strbuf_new(); eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf); eo_lexer_context_push(ls); - FILL_BASE(def->base, ls, ls->line_number, ls->column, VARIABLE); + FILL_BASE(def->base, ls, ls->line_number, ls->column, CONSTANT); parse_name(ls, buf); def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); if (cname) @@ -932,17 +931,12 @@ tags_done: check_next(ls, ':'); def->base_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE)); /* constants are required to have a value */ - if (!global) - check(ls, '='); - /* globals can optionally have a value */ - if (ls->t.token == '=') - { - ls->expr_mode = EINA_TRUE; - eo_lexer_get(ls); - def->value = parse_expr(ls); - ls->expr_mode = EINA_FALSE; - eo_lexer_expr_release_ref(ls, def->value); - } + check(ls, '='); + ls->expr_mode = EINA_TRUE; + eo_lexer_get(ls); + def->value = parse_expr(ls); + ls->expr_mode = EINA_FALSE; + eo_lexer_expr_release_ref(ls, def->value); check_next(ls, ';'); FILL_DOC(ls, def, doc); eo_lexer_dtor_pop(ls); @@ -2401,10 +2395,8 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot) break; } case KW_const: - case KW_var: { - database_var_add(ls->unit, eo_lexer_variable_release(ls, - parse_variable(ls, ls->t.kw == KW_var))); + database_constant_add(ls->unit, eo_lexer_constant_release(ls, parse_constant(ls))); break; } case KW_error: diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index cef722dd95..09eb904992 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -491,7 +491,7 @@ database_doc_token_ref_resolve(const Eolian_Doc_Token *tok, { case EOLIAN_OBJECT_CLASS: case EOLIAN_OBJECT_TYPEDECL: - case EOLIAN_OBJECT_VARIABLE: + case EOLIAN_OBJECT_CONSTANT: case EOLIAN_OBJECT_ERROR: /* we only allow certain types to be referenced */ return tp; @@ -589,8 +589,7 @@ database_unit_init(Eolian_State *state, Eolian_Unit *unit, const char *file) unit->children = eina_hash_stringshared_new(NULL); unit->classes = eina_hash_stringshared_new(EINA_FREE_CB(database_class_del)); - unit->globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); - unit->constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); + unit->constants = eina_hash_stringshared_new(EINA_FREE_CB(database_constant_del)); unit->errors = eina_hash_stringshared_new(EINA_FREE_CB(database_error_del)); unit->aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); unit->structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); @@ -607,7 +606,6 @@ _unit_contents_del(Eolian_Unit *unit) eina_stringshare_del(unit->file); eina_hash_free(unit->children); eina_hash_free(unit->classes); - eina_hash_free(unit->globals); eina_hash_free(unit->constants); eina_hash_free(unit->errors); eina_hash_free(unit->aliases); @@ -660,7 +658,6 @@ _state_area_init(Eolian_State *state, Eolian_State_Area *a) a->aliases_f = eina_hash_stringshared_new(NULL); a->structs_f = eina_hash_stringshared_new(NULL); a->enums_f = eina_hash_stringshared_new(NULL); - a->globals_f = eina_hash_stringshared_new(NULL); a->constants_f = eina_hash_stringshared_new(NULL); a->errors_f = eina_hash_stringshared_new(NULL); a->objects_f = eina_hash_stringshared_new(NULL); @@ -687,7 +684,6 @@ _state_area_contents_del(Eolian_State_Area *a) _hashlist_free(a->aliases_f); _hashlist_free(a->structs_f); _hashlist_free(a->enums_f); - _hashlist_free(a->globals_f); _hashlist_free(a->constants_f); _hashlist_free(a->errors_f); _hashlist_free(a->objects_f); @@ -906,7 +902,6 @@ _state_clean(Eolian_State *state) Eolian_Unit *stu = &st->unit; eina_hash_free_buckets(stu->classes); - eina_hash_free_buckets(stu->globals); eina_hash_free_buckets(stu->constants); eina_hash_free_buckets(stu->aliases); eina_hash_free_buckets(stu->structs); @@ -921,7 +916,6 @@ _state_clean(Eolian_State *state) _hashlist_free_buckets(st->aliases_f); _hashlist_free_buckets(st->structs_f); _hashlist_free_buckets(st->enums_f); - _hashlist_free_buckets(st->globals_f); _hashlist_free_buckets(st->constants_f); _hashlist_free_buckets(st->objects_f); } @@ -1010,7 +1004,6 @@ static void _merge_unit(Eolian_Unit *dest, Eolian_Unit *src) { eina_hash_foreach(src->classes, _merge_unit_cb, dest->classes); - eina_hash_foreach(src->globals, _merge_unit_cb, dest->globals); eina_hash_foreach(src->constants, _merge_unit_cb, dest->constants); eina_hash_foreach(src->aliases, _merge_unit_cb, dest->aliases); eina_hash_foreach(src->structs, _merge_unit_cb, dest->structs); @@ -1073,7 +1066,6 @@ _merge_staging(Eolian_State *state) EOLIAN_STAGING_MERGE_LIST(aliases); EOLIAN_STAGING_MERGE_LIST(structs); EOLIAN_STAGING_MERGE_LIST(enums); - EOLIAN_STAGING_MERGE_LIST(globals); EOLIAN_STAGING_MERGE_LIST(constants); EOLIAN_STAGING_MERGE_LIST(objects); @@ -1248,17 +1240,6 @@ eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name) return cl; } -EAPI Eina_Iterator * -eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name) -{ - if (!state) return NULL; - Eina_Stringshare *shr = eina_stringshare_add(file_name); - Eina_List *l = eina_hash_find(state->main.globals_f, shr); - eina_stringshare_del(shr); - if (!l) return NULL; - return eina_list_iterator_new(l); -} - EAPI Eina_Iterator * eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name) { @@ -1383,22 +1364,12 @@ eolian_unit_classes_get(const Eolian_Unit *unit) return (unit ? eina_hash_iterator_data_new(unit->classes) : NULL); } -EAPI const Eolian_Variable * -eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name) -{ - if (!unit) return NULL; - Eina_Stringshare *shr = eina_stringshare_add(name); - Eolian_Variable *v = eina_hash_find(unit->globals, shr); - eina_stringshare_del(shr); - return v; -} - -EAPI const Eolian_Variable * +EAPI const Eolian_Constant * eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name) { if (!unit) return NULL; Eina_Stringshare *shr = eina_stringshare_add(name); - Eolian_Variable *v = eina_hash_find(unit->constants, shr); + Eolian_Constant *v = eina_hash_find(unit->constants, shr); eina_stringshare_del(shr); return v; } @@ -1419,12 +1390,6 @@ eolian_unit_constants_get(const Eolian_Unit *unit) return (unit ? eina_hash_iterator_data_new(unit->constants) : NULL); } -EAPI Eina_Iterator * -eolian_unit_globals_get(const Eolian_Unit *unit) -{ - return (unit ? eina_hash_iterator_data_new(unit->globals) : NULL); -} - EAPI Eina_Iterator * eolian_unit_errors_get(const Eolian_Unit *unit) { diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index ab49424cad..3cbf4fbeea 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -39,7 +39,6 @@ struct _Eolian_Unit Eolian_State *state; Eina_Hash *children; Eina_Hash *classes; - Eina_Hash *globals; Eina_Hash *constants; Eina_Hash *errors; Eina_Hash *aliases; @@ -59,7 +58,6 @@ typedef struct _Eolian_State_Area Eina_Hash *aliases_f; Eina_Hash *structs_f; Eina_Hash *enums_f; - Eina_Hash *globals_f; Eina_Hash *constants_f; Eina_Hash *errors_f; Eina_Hash *objects_f; @@ -394,10 +392,9 @@ struct _Eolian_Expression Eina_Bool weak_rhs :1; }; -struct _Eolian_Variable +struct _Eolian_Constant { Eolian_Object base; - Eolian_Variable_Type type; Eolian_Type *base_type; Eolian_Expression *value; Eolian_Documentation *doc; @@ -449,8 +446,8 @@ void database_expr_print(Eolian_Expression *expr); /* variables */ -void database_var_del(Eolian_Variable *var); -void database_var_add(Eolian_Unit *unit, Eolian_Variable *var); +void database_constant_del(Eolian_Constant *var); +void database_constant_add(Eolian_Unit *unit, Eolian_Constant *var); /* classes */ void database_class_del(Eolian_Class *cl); diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index a7a01cc243..ce3053331c 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp @@ -113,13 +113,6 @@ inline typedecl_type typedecl_type_get(Eolian_Typedecl const* decl) } } -enum class variable_type -{ - unknown, - constant, - global -}; - struct type_def; bool operator==(type_def const& lhs, type_def const& rhs); @@ -1070,63 +1063,57 @@ struct property_def } }; -struct variable_def +struct constant_def { std::string name; std::string full_name; type_def base_type; documentation_def documentation; - variable_type type; std::vector namespaces; Eolian_Value expression_value; bool is_extern : 1; - friend inline bool operator==(variable_def const& lhs, variable_def const& rhs) + friend inline bool operator==(constant_def const& lhs, constant_def const& rhs) { return lhs.name == rhs.name && lhs.full_name == rhs.full_name && lhs.base_type == rhs.base_type && lhs.documentation == rhs.documentation - && lhs.type == rhs.type && lhs.namespaces == rhs.namespaces && lhs.expression_value.type == rhs.expression_value.type && lhs.expression_value.value.ll == rhs.expression_value.value.ll && lhs.is_extern == rhs.is_extern; } - friend inline bool operator!=(variable_def const& lhs, variable_def const& rhs) + friend inline bool operator!=(constant_def const& lhs, constant_def const& rhs) { return !(lhs == rhs); } - variable_def() = default; - variable_def(Eolian_Variable const* variable, Eolian_Unit const* unit) - : name(::eolian_variable_short_name_get(variable)) - , full_name(::eolian_variable_name_get(variable)) - , base_type(::eolian_variable_base_type_get(variable) + constant_def() = default; + constant_def(Eolian_Constant const* constant, Eolian_Unit const* unit) + : name(::eolian_constant_short_name_get(constant)) + , full_name(::eolian_constant_name_get(constant)) + , base_type(::eolian_constant_base_type_get(constant) , unit - , ::eolian_type_c_type_get(eolian_variable_base_type_get(variable)) + , ::eolian_type_c_type_get(eolian_constant_base_type_get(constant)) , value_ownership::unmoved , is_by::value) - , documentation(::eolian_variable_documentation_get(variable)) - , type(static_cast(::eolian_variable_type_get(variable))) + , documentation(::eolian_constant_documentation_get(constant)) , expression_value() - , is_extern(::eolian_variable_is_extern(variable)) + , is_extern(::eolian_constant_is_extern(constant)) { - for(efl::eina::iterator namespace_iterator( ::eolian_variable_namespaces_get(variable)) + for(efl::eina::iterator namespace_iterator( ::eolian_constant_namespaces_get(constant)) , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator) { this->namespaces.push_back((&*namespace_iterator)); } - if (this->type == variable_type::constant) - { - auto expr = ::eolian_variable_value_get(variable); - if (!expr) - throw std::runtime_error("Could not get constant variable value expression"); + auto expr = ::eolian_constant_value_get(constant); + if (!expr) + throw std::runtime_error("Could not get constant variable value expression"); - this->expression_value = ::eolian_expression_eval(expr, ::EOLIAN_MASK_ALL); - } + this->expression_value = ::eolian_expression_eval(expr, ::EOLIAN_MASK_ALL); } }; diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index c76bc49e72..6d800cdd82 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -173,11 +173,6 @@ class Eolian_Expression_Mask(IntEnum): NUMBER = INT | FLOAT ALL = NUMBER | BOOL | STRING | CHAR | NULL -class Eolian_Variable_Type(IntEnum): - UNKNOWN = 0 - CONSTANT = 1 - GLOBAL = 2 - class Eolian_Binary_Operator(IntEnum): INVALID = 0 ADD = 1 # + int, float @@ -350,19 +345,11 @@ class Eolian_Unit(EolianBaseObject): @property def constants(self): - return Iterator(Variable, lib.eolian_unit_constants_get(self)) + return Iterator(Constant, lib.eolian_unit_constants_get(self)) def constant_by_name_get(self, name): c_var = lib.eolian_unit_constant_by_name_get(self, _str_to_bytes(name)) - return Variable(c_var) if c_var else None - - @property - def globals(self): - return Iterator(Variable, lib.eolian_unit_globals_get(self)) - - def global_by_name_get(self, name): - c_var = lib.eolian_unit_global_by_name_get(self, _str_to_bytes(name)) - return Variable(c_var) if c_var else None + return Constant(c_var) if c_var else None @property def enums(self): @@ -472,13 +459,9 @@ class Eolian_State(Eolian_Unit): return Class(c_cls) if c_cls else None def constants_by_file_get(self, file_name): - return Iterator(Variable, + return Iterator(Constant, lib.eolian_state_constants_by_file_get(self, _str_to_bytes(file_name))) - def globals_by_file_get(self, file_name): - return Iterator(Variable, - lib.eolian_state_globals_by_file_get(self, _str_to_bytes(file_name))) - def aliases_by_file_get(self, file_name): return Iterator(Typedecl, lib.eolian_state_aliases_by_file_get(self, _str_to_bytes(file_name))) @@ -1238,31 +1221,27 @@ class Expression(Object): return Expression(c_expr) if c_expr is not None else None -class Variable(Object): +class Constant(Object): def __repr__(self): - return "".format(self) - - @cached_property - def type(self): - return Eolian_Variable_Type(lib.eolian_variable_type_get(self)) + return "".format(self) @cached_property def value(self): - c_expr = lib.eolian_variable_value_get(self) + c_expr = lib.eolian_constant_value_get(self) return Expression(c_expr) if c_expr else None @cached_property def base_type(self): - c_type = lib.eolian_variable_base_type_get(self) + c_type = lib.eolian_constant_base_type_get(self) return Type(c_type) if c_type else None @cached_property def is_extern(self): - return bool(lib.eolian_variable_is_extern(self)) + return bool(lib.eolian_constant_is_extern(self)) @cached_property def documentation(self): - c_doc = lib.eolian_variable_documentation_get(self) + c_doc = lib.eolian_constant_documentation_get(self) return Documentation(c_doc) if c_doc else None @@ -1380,7 +1359,7 @@ class _Eolian_Object_Type(IntEnum): STRUCT_FIELD = 3 ENUM_FIELD = 4 TYPE = 5 - VARIABLE = 6 + CONSTANT = 6 EXPRESSION = 7 FUNCTION = 8 FUNCTION_PARAMETER = 9 @@ -1397,7 +1376,7 @@ _eolian_type_class_mapping = { _Eolian_Object_Type.STRUCT_FIELD: Struct_Type_Field, _Eolian_Object_Type.ENUM_FIELD: Enum_Type_Field, _Eolian_Object_Type.TYPE: Type, - _Eolian_Object_Type.VARIABLE: Variable, + _Eolian_Object_Type.CONSTANT: Constant, _Eolian_Object_Type.EXPRESSION: Expression, _Eolian_Object_Type.FUNCTION: Function, _Eolian_Object_Type.FUNCTION_PARAMETER: Function_Parameter, diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py index b9ee5d39a1..3a745edf31 100644 --- a/src/scripts/pyolian/eolian_lib.py +++ b/src/scripts/pyolian/eolian_lib.py @@ -108,10 +108,6 @@ lib.eolian_state_objects_by_file_get.restype = c_void_p lib.eolian_state_class_by_file_get.argtypes = (c_void_p, c_char_p) lib.eolian_state_class_by_file_get.restype = c_void_p -# EAPI Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name); -lib.eolian_state_globals_by_file_get.argtypes = (c_void_p, c_char_p) -lib.eolian_state_globals_by_file_get.restype = c_void_p - # EAPI Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name); lib.eolian_state_constants_by_file_get.argtypes = (c_void_p, c_char_p) lib.eolian_state_constants_by_file_get.restype = c_void_p @@ -182,11 +178,7 @@ lib.eolian_unit_structs_get.restype = c_void_p lib.eolian_unit_enums_get.argtypes = (c_void_p,) lib.eolian_unit_enums_get.restype = c_void_p -# EAPI const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name); -lib.eolian_unit_global_by_name_get.argtypes = (c_void_p, c_char_p) -lib.eolian_unit_global_by_name_get.restype = c_void_p - -# EAPI const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); +# EAPI const Eolian_Constant *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); lib.eolian_unit_constant_by_name_get.argtypes = (c_void_p, c_char_p) lib.eolian_unit_constant_by_name_get.restype = c_void_p @@ -194,10 +186,6 @@ lib.eolian_unit_constant_by_name_get.restype = c_void_p lib.eolian_unit_constants_get.argtypes = (c_void_p,) lib.eolian_unit_constants_get.restype = c_void_p -# EAPI Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit); -lib.eolian_unit_globals_get.argtypes = (c_void_p,) -lib.eolian_unit_globals_get.restype = c_void_p - ### Eolian_Object ########################################################### # EAPI Eolian_Object_Type eolian_object_type_get(const Eolian_Object *obj); @@ -637,27 +625,23 @@ lib.eolian_expression_unary_operator_get.restype = c_int lib.eolian_expression_unary_expression_get.argtypes = (c_void_p,) lib.eolian_expression_unary_expression_get.restype = c_void_p -### Eolian_Variable ######################################################### +### Eolian_Constant ######################################################### -# EAPI Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var); -lib.eolian_variable_type_get.argtypes = (c_void_p,) -lib.eolian_variable_type_get.restype = c_int +# EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var); +lib.eolian_constant_documentation_get.argtypes = (c_void_p,) +lib.eolian_constant_documentation_get.restype = c_void_p -# EAPI const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var); -lib.eolian_variable_documentation_get.argtypes = (c_void_p,) -lib.eolian_variable_documentation_get.restype = c_void_p +# EAPI const Eolian_Type *eolian_constant_base_type_get(const Eolian_Constant *var); +lib.eolian_constant_base_type_get.argtypes = (c_void_p,) +lib.eolian_constant_base_type_get.restype = c_void_p -# EAPI const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var); -lib.eolian_variable_base_type_get.argtypes = (c_void_p,) -lib.eolian_variable_base_type_get.restype = c_void_p +# EAPI const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var); +lib.eolian_constant_value_get.argtypes = (c_void_p,) +lib.eolian_constant_value_get.restype = c_void_p -# EAPI const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var); -lib.eolian_variable_value_get.argtypes = (c_void_p,) -lib.eolian_variable_value_get.restype = c_void_p - -# EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); -lib.eolian_variable_is_extern.argtypes = (c_void_p,) -lib.eolian_variable_is_extern.restype = c_bool +# EAPI Eina_Bool eolian_constant_is_extern(const Eolian_Constant *var); +lib.eolian_constant_is_extern.argtypes = (c_void_p,) +lib.eolian_constant_is_extern.restype = c_bool ### Eolian_Documentation #################################################### diff --git a/src/scripts/pyolian/generator.py b/src/scripts/pyolian/generator.py index cd4d105858..a86e03240c 100755 --- a/src/scripts/pyolian/generator.py +++ b/src/scripts/pyolian/generator.py @@ -125,7 +125,7 @@ class Template(pyratemp.Template): 'Enum_Type_Field': eolian.Enum_Type_Field, 'Struct_Type_Field': eolian.Struct_Type_Field, 'Expression': eolian.Expression, - 'Variable': eolian.Variable, + 'Constant': eolian.Constant, 'Documentation': eolian.Documentation, 'Documentation_Token': eolian.Documentation_Token, # Eolian Enums @@ -139,7 +139,6 @@ class Template(pyratemp.Template): 'Eolian_C_Type_Type': eolian.Eolian_C_Type_Type, 'Eolian_Expression_Type': eolian.Eolian_Expression_Type, 'Eolian_Expression_Mask': eolian.Eolian_Expression_Mask, - 'Eolian_Variable_Type': eolian.Eolian_Variable_Type, 'Eolian_Binary_Operator': eolian.Eolian_Binary_Operator, 'Eolian_Unary_Operator': eolian.Eolian_Unary_Operator, 'Eolian_Doc_Token_Type': eolian.Eolian_Doc_Token_Type, diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py index 36c19ea1ae..280d4c187c 100755 --- a/src/scripts/pyolian/test_eolian.py +++ b/src/scripts/pyolian/test_eolian.py @@ -180,22 +180,14 @@ class TestEolianUnit(unittest.TestCase): all_count += 1 self.assertGreater(all_count, 10) - def test_variable_listing(self): + def test_constant_listing(self): l = list(eolian_db.constants) self.assertGreater(len(l), 2) - self.assertIsInstance(l[0], eolian.Variable) - - l = list(eolian_db.globals) - self.assertGreater(len(l), 20) - self.assertIsInstance(l[0], eolian.Variable) + self.assertIsInstance(l[0], eolian.Constant) l = list(eolian_db.constants_by_file_get('efl_gfx_stack.eo')) self.assertGreater(len(l), 1) - self.assertIsInstance(l[0], eolian.Variable) - - l = list(eolian_db.globals_by_file_get('efl_net_http_types.eot')) - self.assertGreater(len(l), 10) - self.assertIsInstance(l[0], eolian.Variable) + self.assertIsInstance(l[0], eolian.Constant) def test_class_listing(self): all_count = 0 @@ -473,26 +465,12 @@ class TestEolianDocumentation(unittest.TestCase): self.assertEqual(doc.since, '1.22') -class TestEolianVariable(unittest.TestCase): - def test_variable_global(self): - var = eolian_db.global_by_name_get('Efl.Net.Http.Error.BAD_CONTENT_ENCODING') - self.assertIsInstance(var, eolian.Variable) - self.assertEqual(var.name, 'Efl.Net.Http.Error.BAD_CONTENT_ENCODING') - self.assertEqual(var.short_name, 'BAD_CONTENT_ENCODING') - self.assertEqual(var.type, eolian.Eolian_Variable_Type.GLOBAL) - self.assertEqual(var.file, 'efl_net_http_types.eot') - self.assertFalse(var.is_extern) - self.assertEqual(list(var.namespaces), ['Efl','Net','Http','Error']) - self.assertIsInstance(var.documentation, eolian.Documentation) - self.assertIsInstance(var.base_type, eolian.Type) - self.assertIsNone(var.value) # TODO is None correct here? no value? - - def test_variable_constant(self): +class TestEolianConstant(unittest.TestCase): + def test_constant(self): var = eolian_db.constant_by_name_get('Efl.Gfx.Hint_Expand') - self.assertIsInstance(var, eolian.Variable) + self.assertIsInstance(var, eolian.Constant) self.assertEqual(var.name, 'Efl.Gfx.Hint_Expand') self.assertEqual(var.short_name, 'Hint_Expand') - self.assertEqual(var.type, eolian.Eolian_Variable_Type.CONSTANT) self.assertEqual(var.file, 'efl_gfx_hint.eo') self.assertFalse(var.is_extern) self.assertEqual(list(var.namespaces), ['Efl','Gfx']) diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 1a8f9eebcd..a6a6d744b4 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -765,7 +765,7 @@ EFL_END_TEST EFL_START_TEST(eolian_var) { - const Eolian_Variable *var = NULL; + const Eolian_Constant *var = NULL; const Eolian_Expression *exp = NULL; const Eolian_Type *type = NULL; const Eolian_Class *class; @@ -785,12 +785,11 @@ EFL_START_TEST(eolian_var) /* regular constant */ fail_if(!(var = eolian_unit_constant_by_name_get(unit, "Foo"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_CONSTANT); - fail_if(eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); + fail_if(eolian_constant_is_extern(var)); + fail_if(!(type = eolian_constant_base_type_get(var))); fail_if(!(name = eolian_type_short_name_get(type))); fail_if(strcmp(name, "int")); - fail_if(!(exp = eolian_variable_value_get(var))); + fail_if(!(exp = eolian_constant_value_get(var))); v = eolian_expression_eval(exp, EOLIAN_MASK_ALL); fail_if(v.type != EOLIAN_EXPR_INT); fail_if(v.value.i != 5); @@ -849,7 +848,7 @@ EFL_END_TEST EFL_START_TEST(eolian_enum) { const Eolian_Enum_Type_Field *field = NULL; - const Eolian_Variable *var = NULL; + const Eolian_Constant *var = NULL; const Eolian_Typedecl *tdl = NULL; const Eolian_Type *type = NULL; const Eolian_Class *class; @@ -914,19 +913,16 @@ EFL_START_TEST(eolian_enum) eina_stringshare_del(cname); fail_if(!(var = eolian_unit_constant_by_name_get(unit, "Bah"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_CONSTANT); - fail_if(eolian_variable_is_extern(var)); - fail_if(!(type = eolian_variable_base_type_get(var))); + fail_if(!(type = eolian_constant_base_type_get(var))); fail_if(!(name = eolian_type_short_name_get(type))); fail_if(strcmp(name, "Baz")); - fail_if(!(exp = eolian_variable_value_get(var))); + fail_if(!(exp = eolian_constant_value_get(var))); v = eolian_expression_eval(exp, EOLIAN_MASK_ALL); fail_if(v.type != EOLIAN_EXPR_INT); fail_if(v.value.i != (1 << 0)); fail_if(!(var = eolian_unit_constant_by_name_get(unit, "Pants"))); - fail_if(eolian_variable_type_get(var) != EOLIAN_VAR_CONSTANT); - fail_if(!(exp = eolian_variable_value_get(var))); + fail_if(!(exp = eolian_constant_value_get(var))); v = eolian_expression_eval(exp, EOLIAN_MASK_ALL); fail_if(v.type != EOLIAN_EXPR_INT); fail_if(v.value.i != 5); @@ -1032,7 +1028,7 @@ EFL_START_TEST(eolian_docs) const Eolian_Typedecl *tdl; const Eolian_Class *class; const Eolian_Event *event; - const Eolian_Variable *var; + const Eolian_Constant *var; const Eolian_Function *fid; const Eolian_Documentation *doc; const Eolian_Function_Parameter *par; @@ -1101,7 +1097,7 @@ EFL_START_TEST(eolian_docs) fail_if(eolian_doc_token_type_get(&tok) != EOLIAN_DOC_TOKEN_REF); txt = eolian_doc_token_text_get(&tok); fail_if(strcmp(txt, "pants")); - fail_if(eolian_doc_token_ref_resolve(&tok, eos, NULL, NULL) != EOLIAN_OBJECT_VARIABLE); + fail_if(eolian_doc_token_ref_resolve(&tok, eos, NULL, NULL) != EOLIAN_OBJECT_CONSTANT); free(txt); tdoc = eolian_documentation_tokenize(tdoc, &tok); fail_if(eolian_doc_token_type_get(&tok) != EOLIAN_DOC_TOKEN_TEXT); @@ -1181,7 +1177,7 @@ EFL_START_TEST(eolian_docs) "2.0")); fail_if(!(var = eolian_unit_constant_by_name_get(unit, "pants"))); - fail_if(!(doc = eolian_variable_documentation_get(var))); + fail_if(!(doc = eolian_constant_documentation_get(var))); fail_if(strcmp(eolian_documentation_summary_get(doc), "Docs for var.")); fail_if(eolian_documentation_description_get(doc)); From e0f07489dfb34526ea0d92d757f4a77b31709bce Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 24 Sep 2019 19:17:28 +0200 Subject: [PATCH 019/115] elm: fix Efl.Ui errors not being registered The implementation is necessary, but it wasn't being generated and included by mistake. --- src/lib/elementary/elm_main.c | 2 ++ src/lib/elementary/meson.build | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 0d781a94be..95a81df58f 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -31,6 +31,8 @@ #include "elm_gengrid_eo.h" #include "elm_widget_gengrid.h" +#include "efl_ui.eot.c" + #define SEMI_BROKEN_QUICKLAUNCH 1 #ifdef __CYGWIN__ diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 323d14576c..3770fe9448 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -218,8 +218,9 @@ foreach eo_file : pub_eo_types_files install_dir : dir_package_include, command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), + '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), - '-ghd', '@INPUT@']) + '-gchd', '@INPUT@']) endforeach priv_eo_files = [ From 1c0916ef03549eb742f635f29c4340b0989839a6 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Sun, 15 Sep 2019 14:38:03 -0700 Subject: [PATCH 020/115] elementary: factorize all events emitted by a Efl.Ui.Collection into their own interface. For most event it is actually meaningful to share them with Efl.Ui.Collection_View so let's do it. Differential Revision: https://phab.enlightenment.org/D9956 --- src/lib/elementary/Efl_Ui.h | 1 + src/lib/elementary/efl_ui_collection.eo | 11 ++--------- src/lib/elementary/efl_ui_collection_events.eo | 12 ++++++++++++ src/lib/elementary/efl_ui_item.c | 2 ++ src/lib/elementary/meson.build | 1 + 5 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 src/lib/elementary/efl_ui_collection_events.eo diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index a4285ef04f..53c10adfcf 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -307,6 +307,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include +# include # include # include # include diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo index f040fd87bc..4a320c362a 100644 --- a/src/lib/elementary/efl_ui_collection.eo +++ b/src/lib/elementary/efl_ui_collection.eo @@ -3,7 +3,8 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Ui.Layout_Orientable, Efl.Ui.Multi_Selectable, Efl.Ui.Focus.Manager_Sub, - Efl.Ui.Widget_Focus_Manager + Efl.Ui.Widget_Focus_Manager, + Efl.Ui.Collection_Events composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar, @@ -25,7 +26,6 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_items_get. ]] - event_prefix:efl_ui; methods { item_scroll { [[Brings the passed item into the viewport.]] @@ -90,12 +90,5 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Ui.Multi_Selectable.unselect_range; Efl.Ui.Single_Selectable.fallback_selection {get; set;} } - events { - item,pressed : Efl.Ui.Item; [[A $press event occurred over an item.]] - item,unpressed : Efl.Ui.Item; [[An $unpress event occurred over an item.]] - item,longpressed : Efl.Ui.Item; [[A $longpressed event occurred over an item.]] - item,clicked : Efl.Ui.Item; [[A $clicked event occurred over an item.]] - item,clicked,any : Efl.Ui.Item; [[A $clicked,any event occurred over an item.]] - } } diff --git a/src/lib/elementary/efl_ui_collection_events.eo b/src/lib/elementary/efl_ui_collection_events.eo new file mode 100644 index 0000000000..653172564b --- /dev/null +++ b/src/lib/elementary/efl_ui_collection_events.eo @@ -0,0 +1,12 @@ +interface @beta Efl.Ui.Collection_Events +{ + [[Shared sets of events between @Efl.Ui.Collection and @Efl.Ui.Collection_View.]] + event_prefix: efl_ui; + events { + item,pressed : Efl.Ui.Item; [[A $press event occurred over an item.]] + item,unpressed : Efl.Ui.Item; [[An $unpress event occurred over an item.]] + item,longpressed : Efl.Ui.Item; [[A $longpressed event occurred over an item.]] + item,clicked : Efl.Ui.Item; [[A $clicked event occurred over an item.]] + item,clicked,any : Efl.Ui.Item; [[A $clicked,any event occurred over an item.]] + } +} \ No newline at end of file diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c index 1b0c4f1a46..b454555497 100644 --- a/src/lib/elementary/efl_ui_item.c +++ b/src/lib/elementary/efl_ui_item.c @@ -214,3 +214,5 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_item, Efl_Ui_Item_Data) #include "efl_ui_selectable.eo.c" #include "efl_ui_multi_selectable.eo.c" #include "efl_ui_single_selectable.eo.c" +#include "efl_ui_collection_events.eo.c" + diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 3770fe9448..a1c001a7bb 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -173,6 +173,7 @@ pub_eo_files = [ 'efl_ui_relative_layout.eo', 'efl_ui_action_connector.eo', 'efl_ui_format.eo', + 'efl_ui_collection_events.eo', 'efl_ui_collection.eo', 'efl_ui_position_manager_entity.eo', 'efl_ui_position_manager_list.eo', From 3c9a46372efe03f6f90488342d999aad02e0036d Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Sun, 15 Sep 2019 12:50:27 -0700 Subject: [PATCH 021/115] elementary: add an interface for asynchronous multi selection. This interface is currently focusing on being use by widget like Efl.Ui.Collection_View or Efl.Ui.Select_Model. I have decided that it should not be available along with Efl.Ui.Multi_Selectable. Differential Revision: https://phab.enlightenment.org/D9957 --- src/lib/elementary/Efl_Ui.h | 1 + src/lib/elementary/efl_ui.eot | 8 + .../elementary/efl_ui_collection_events.eo | 2 +- src/lib/elementary/efl_ui_multi_selectable.eo | 8 +- .../efl_ui_multi_selectable_async.eo | 63 ++++ src/lib/elementary/efl_ui_select_model.c | 348 ++++++++++++++++-- src/lib/elementary/efl_ui_select_model.eo | 36 +- src/lib/elementary/meson.build | 1 + .../elementary/efl_ui_test_select_model.c | 4 +- 9 files changed, 408 insertions(+), 63 deletions(-) create mode 100644 src/lib/elementary/efl_ui_multi_selectable_async.eo diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 53c10adfcf..2c899fa20c 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -326,6 +326,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include +# include # include # include "efl_ui_list_view_types.eot.h" diff --git a/src/lib/elementary/efl_ui.eot b/src/lib/elementary/efl_ui.eot index 4e665113f6..b397b27094 100644 --- a/src/lib/elementary/efl_ui.eot +++ b/src/lib/elementary/efl_ui.eot @@ -96,5 +96,13 @@ enum @beta Efl.Ui.Widget_Orientation_Mode not change according to the window or screen orientation.]] } +enum @beta Efl.Ui.Select_Mode { + [[Type of multi selectable object.]] + single, [[Only single child is selected. If a child is selected, + previous selected child will be unselected.]] + multi, [[Allow multiple selection of children.]] + none [[No child can be selected at all.]] +} + /* Types for A11Y (internal/beta API) */ type @beta @extern Efl.Access.Action_Data: __undefined_type; [[Internal struct for accesssibility.]] diff --git a/src/lib/elementary/efl_ui_collection_events.eo b/src/lib/elementary/efl_ui_collection_events.eo index 653172564b..9ef6a991df 100644 --- a/src/lib/elementary/efl_ui_collection_events.eo +++ b/src/lib/elementary/efl_ui_collection_events.eo @@ -1,6 +1,6 @@ interface @beta Efl.Ui.Collection_Events { - [[Shared sets of events between @Efl.Ui.Collection and @Efl.Ui.Collection_View.]] + [[Shared sets of events between @Efl.Ui.Collection and Efl.Ui.Collection_View.]] event_prefix: efl_ui; events { item,pressed : Efl.Ui.Item; [[A $press event occurred over an item.]] diff --git a/src/lib/elementary/efl_ui_multi_selectable.eo b/src/lib/elementary/efl_ui_multi_selectable.eo index 9b581357a1..a3806c1608 100644 --- a/src/lib/elementary/efl_ui_multi_selectable.eo +++ b/src/lib/elementary/efl_ui_multi_selectable.eo @@ -1,10 +1,4 @@ -enum @beta Efl.Ui.Select_Mode { - [[Type of multi selectable object.]] - single, [[Only single child is selected. If a child is selected, - previous selected child will be unselected.]] - multi, [[Allow multiple selection of children.]] - none [[No child can be selected at all.]] -} +import efl_ui; interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable { diff --git a/src/lib/elementary/efl_ui_multi_selectable_async.eo b/src/lib/elementary/efl_ui_multi_selectable_async.eo new file mode 100644 index 0000000000..6f4ed14abe --- /dev/null +++ b/src/lib/elementary/efl_ui_multi_selectable_async.eo @@ -0,0 +1,63 @@ +import efl_ui; + +interface @beta Efl.Ui.Multi_Selectable_Async extends Efl.Ui.Single_Selectable +{ + [[Interface for getting access to a range of selected items for widgets that provide them asynchronously. + + The implementor of this interface provides the possibility to select multiple @Efl.Ui.Selectable. + If not, only @Efl.Ui.Single_Selectable should be implemented. + A widget can only provide either this interface or @Efl.Ui.Multi_Selectable, but not both.]] + methods + { + @property select_mode { + [[The mode type for children selection.]] + set {} + get {} + values { + mode: Efl.Ui.Select_Mode; [[Type of selection of children]] + } + } + selected_iterator_new { + [[Gets an iterator of all the selected child of this model. + ]] + return: iterator @move @no_unused; [[The iterator gives indices of selected children. + It is valid until any change is made on the model.]] + } + unselected_iterator_new { + [[Gets an iterator of all the child of this model that are not selected. + ]] + return: iterator @move @no_unused; [[The iterator gives indices of unselected children. + It is valid until any change is made on the model.]] + } + select_range { + [[Select a range of @Efl.Ui.Selectable. + + This will select the range of selectables from $a to $b or from $b to $a depending on which one comes first. + If $a or $b are not in the range the widget, an error is returned, and no change is applied. + Both of the passed values will also be selected. + ]] + params { + a : uint64; [[One side of the range.]] + b : uint64; [[The other side of the range.]] + } + } + unselect_range { + [[Unselect a range of @Efl.Ui.Selectable. + + This will unselect the range of selectables from $a to $b or from $b to $a depending on which one comes first. + If $a or $b are not in the range of the widget, an error is returned, and no change is applied. + Both of the passed values will also be unselected. + ]] + params { + a : uint64; [[One side of the range.]] + b : uint64; [[The other side of the range.]] + } + } + select_all { + [[Select all @Efl.Ui.Selectable]] + } + unselect_all { + [[Unselect all @Efl.Ui.Selectable]] + } + } +} diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c index e862b569e0..93db5b3a6f 100644 --- a/src/lib/elementary/efl_ui_select_model.c +++ b/src/lib/elementary/efl_ui_select_model.c @@ -2,6 +2,10 @@ # include #endif +// Note: we do not rely on reflection here to implement select as it require to asynchronously acces +// children. Could be done differently by implementing the children select in the parent instead of +// in the children. For later optimization. + #include #include "elm_priv.h" @@ -13,15 +17,21 @@ typedef struct _Efl_Ui_Select_Model_Data Efl_Ui_Select_Model_Data; struct _Efl_Ui_Select_Model_Data { Efl_Ui_Select_Model_Data *parent; + + Eina_Future *pending_selection_event; + + Efl_Ui_Select_Model *fallback_model; + Efl_Ui_Select_Model *last_model; unsigned long last; - Eina_Bool single_selection : 1; + Efl_Ui_Select_Mode selection; + Eina_Bool none : 1; }; static Eo* _efl_ui_select_model_efl_object_constructor(Eo *obj, - Efl_Ui_Select_Model_Data *pd EINA_UNUSED) + Efl_Ui_Select_Model_Data *pd) { Eo *parent; @@ -29,7 +39,9 @@ _efl_ui_select_model_efl_object_constructor(Eo *obj, efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE); - pd->last = -1; + efl_replace(&pd->last_model, NULL); + pd->last = 0; + pd->none = EINA_TRUE; parent = efl_parent_get(obj); if (efl_isa(parent, EFL_UI_SELECT_MODEL_CLASS)) @@ -38,10 +50,61 @@ _efl_ui_select_model_efl_object_constructor(Eo *obj, return obj; } +static void +_efl_ui_select_model_efl_object_invalidate(Eo *obj, + Efl_Ui_Select_Model_Data *pd) +{ + efl_replace(&pd->fallback_model, NULL); + efl_replace(&pd->last_model, NULL); + pd->none = EINA_TRUE; + + efl_invalidate(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS)); +} + +static void +_efl_ui_select_model_fallback(Efl_Ui_Select_Model_Data *pd) +{ + Eina_Value selected; + + if (!pd->parent) return; + if (!pd->parent->none) return; + if (!pd->parent->fallback_model) return; + // I think it only make sense to trigger the fallback on single mode + if (pd->parent->selection != EFL_UI_SELECT_MODE_SINGLE) return; + + selected = eina_value_bool_init(EINA_TRUE); + efl_model_property_set(pd->parent->fallback_model, "self.selected", &selected); + eina_value_flush(&selected); +} + +static Eina_Value +_select_notification_cb(Eo *o, void *data EINA_UNUSED, const Eina_Value v) +{ + Efl_Ui_Select_Model_Data *pd = efl_data_scope_get(o, EFL_UI_SELECT_MODEL_CLASS); + + efl_event_callback_call(o, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, NULL); + + pd->pending_selection_event = NULL; + + return v; +} + +static void +_efl_ui_select_model_selection_notification(Eo *parent, Efl_Ui_Select_Model_Data *pd) +{ + if (!pd) return; + if (pd->pending_selection_event) return; + + pd->pending_selection_event = efl_future_then(parent, + efl_loop_job(efl_loop_get(parent)), + .success = _select_notification_cb); +} + static Eina_Value _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) { Efl_Ui_Select_Model_Data *pd; + Eo *parent; Eina_Value *selected = NULL; Eina_Bool selflag = EINA_FALSE; @@ -50,7 +113,8 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) selected = efl_model_property_get(child, "selected"); - pd = efl_data_scope_get(efl_parent_get(child), EFL_UI_SELECT_MODEL_CLASS); + parent = efl_parent_get(child); + pd = efl_data_scope_get(parent, EFL_UI_SELECT_MODEL_CLASS); if (!pd) goto on_error; eina_value_bool_get(selected, &selflag); @@ -59,6 +123,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) // select case pd->none = EINA_FALSE; pd->last = efl_composite_model_index_get(child); + efl_replace(&pd->last_model, child); efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_SELECTED, child); } else @@ -69,11 +134,17 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) last = efl_composite_model_index_get(child); if (pd->last == last) { + efl_replace(&pd->last_model, NULL); pd->last = 0; pd->none = EINA_TRUE; + + // Just in case we need to refill the fallback + _efl_ui_select_model_fallback(pd); } efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_UNSELECTED, child); } + _efl_ui_select_model_selection_notification(parent, pd); + efl_model_properties_changed(child, "self.selected"); on_error: eina_value_free(selected); @@ -239,7 +310,7 @@ _untangle_free(void *data, static Eina_Iterator * _efl_ui_select_model_efl_model_properties_get(const Eo *obj, - Efl_Ui_Select_Model_Data *pd EINA_UNUSED) + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props, obj, EFL_UI_SELECT_MODEL_CLASS, @@ -250,22 +321,23 @@ _efl_ui_select_model_efl_model_properties_get(const Eo *obj, static Eina_Future * _efl_ui_select_model_efl_model_property_set(Eo *obj, - Efl_Ui_Select_Model_Data *pd, - const char *property, Eina_Value *value) + Efl_Ui_Select_Model_Data *pd, + const char *property, Eina_Value *value) { Eina_Value vf = EINA_VALUE_EMPTY; if (eina_streq("single_selection", property)) { - Eina_Bool single_selection = pd->single_selection; + Eina_Bool single_selection = pd->selection == EFL_UI_SELECT_MODE_SINGLE; + Eina_Bool new_selection; Eina_Bool changed; - vf = eina_value_bool_init(single_selection); - eina_value_convert(value, &vf); - eina_value_bool_get(&vf, &single_selection); + if (!eina_value_bool_get(value, &new_selection)) + return efl_loop_future_rejected(obj, EINVAL); - changed = (!pd->single_selection != !single_selection); - pd->single_selection = !!single_selection; + changed = (!!new_selection != !!single_selection); + if (new_selection) pd->selection = EFL_UI_SELECT_MODE_SINGLE; + else pd->selection = EFL_UI_SELECT_MODE_MULTI; if (changed) efl_model_properties_changed(obj, "single_selection"); @@ -276,6 +348,9 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, { unsigned long l = 0; + if (pd->selection == EFL_UI_SELECT_MODE_NONE) + return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_READ_ONLY); + if (!eina_value_ulong_convert(value, &l)) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE); @@ -293,6 +368,9 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, Eina_Value *prev; Eina_Future *chain; + if (pd->parent->selection == EFL_UI_SELECT_MODE_NONE) + return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE); + prev = efl_model_property_get(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), "selected"); success = eina_value_bool_get(prev, &prevflag); success &= eina_value_bool_convert(value, &newflag); @@ -303,7 +381,7 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, if (newflag == prevflag) return efl_loop_future_resolved(obj, eina_value_bool_init(newflag)); - single_selection = pd->parent->single_selection; + single_selection = !!(pd->parent->selection == EFL_UI_SELECT_MODE_SINGLE); // First store the new value in the boolean model we inherit from chain = efl_model_property_set(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), @@ -321,7 +399,12 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, i = efl_composite_model_index_get(obj); if (pd->parent->last == i && !newflag) - pd->parent->none = EINA_TRUE; + { + efl_replace(&pd->last_model, NULL); + pd->parent->none = EINA_TRUE; + + _efl_ui_select_model_fallback(pd); + } } else { @@ -362,7 +445,7 @@ static Eina_Value * _efl_ui_select_model_efl_model_property_get(const Eo *obj, Efl_Ui_Select_Model_Data *pd, const char *property) { if (eina_streq("single_selection", property)) - return eina_value_bool_new(pd->single_selection); + return eina_value_bool_new(pd->selection == EFL_UI_SELECT_MODE_SINGLE); // Last selected child if (eina_streq("child.selected", property)) { @@ -374,34 +457,239 @@ _efl_ui_select_model_efl_model_property_get(const Eo *obj, Efl_Ui_Select_Model_D // Redirect to are we ourself selected if (pd->parent && eina_streq("self.selected", property)) { + if (pd->parent->selection == EFL_UI_SELECT_MODE_NONE) + return eina_value_bool_new(EINA_FALSE); return efl_model_property_get(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), "selected"); } return efl_model_property_get(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS), property); } -static void -_efl_ui_select_model_single_selection_set(Eo *obj EINA_UNUSED, Efl_Ui_Select_Model_Data *pd, Eina_Bool enable) -{ - pd->single_selection = enable; -} - -static Eina_Bool -_efl_ui_select_model_single_selection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Select_Model_Data *pd) -{ - return pd->single_selection; -} - static Eina_Iterator * -_efl_ui_select_model_selected_get(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +_efl_ui_select_model_efl_ui_multi_selectable_async_selected_iterator_new(Eo *obj, + Efl_Ui_Select_Model_Data *pd) { + if (pd->parent && pd->parent->selection == EFL_UI_SELECT_MODE_NONE) + return eina_list_iterator_new(NULL); // Quick hack to get a valid empty iterator return efl_boolean_model_boolean_iterator_get(obj, "selected", EINA_TRUE); } static Eina_Iterator * -_efl_ui_select_model_unselected_get(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +_efl_ui_select_model_efl_ui_multi_selectable_async_unselected_iterator_new(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { return efl_boolean_model_boolean_iterator_get(obj, "selected", EINA_FALSE); } +static Efl_Ui_Selectable * +_efl_ui_select_model_efl_ui_single_selectable_last_selected_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Select_Model_Data *pd) +{ + return pd->last_model; +} + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_set(Eo *obj, + Efl_Ui_Select_Model_Data *pd, + Efl_Ui_Select_Mode mode) +{ + switch (mode) + { + case EFL_UI_SELECT_MODE_SINGLE: + mode = EFL_UI_SELECT_MODE_SINGLE; + if (pd->selection == EFL_UI_SELECT_MODE_MULTI) + efl_ui_multi_selectable_async_unselect_all(obj); + break; + case EFL_UI_SELECT_MODE_NONE: + if (pd->selection == EFL_UI_SELECT_MODE_MULTI) + efl_ui_multi_selectable_async_unselect_all(obj); + else if (pd->last_model) + { + Eina_Value unselect = eina_value_bool_init(EINA_FALSE); + + efl_model_property_set(pd->last_model, "self.selected", &unselect); + eina_value_flush(&unselect); + } + break; + case EFL_UI_SELECT_MODE_MULTI: + break; + default: + ERR("Unknown select mode passed to %s: %i.", efl_debug_name_get(obj), mode); + return; + } + + pd->selection = mode; + efl_model_properties_changed(obj, "single_selection", "child.selected"); +} + +static Efl_Ui_Select_Mode +_efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Select_Model_Data *pd) +{ + return pd->selection; +} + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_select_all(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +{ + unsigned long count, i; + + // Not the fastest way to implement it, but will reuse more code and be easier as a v1. + // It also make it not very async which could be noticable. + count = efl_model_children_count_get(obj); + + for (i = 0; i < count; i++) + { + Eina_Value p = eina_value_ulong_init(i); + + efl_model_property_set(obj, "child.selected", &p); + + eina_value_flush(&p); + } +} + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_unselect_all(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +{ + uint64_t count = efl_model_children_count_get(obj); + + efl_ui_multi_selectable_async_unselect_range(obj, 0, count - 1); +} + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_select_range(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED, + uint64_t a, uint64_t b) +{ + unsigned long count, i; + + // Not the fastest way to implement it, but will reuse more code and be easier as a v1. + // It also make it not very async which could be noticable. + count = MIN(efl_model_children_count_get(obj), b + 1); + + for (i = a; i < count; i++) + { + Eina_Value p = eina_value_ulong_init(i); + + efl_model_property_set(obj, "child.selected", &p); + + eina_value_flush(&p); + } +} + +static Eina_Value +_children_unselect_then(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v) +{ + Eo *target; + Eina_Value unselect; + unsigned int i, len; + + unselect = eina_value_bool_init(EINA_FALSE); + + EINA_VALUE_ARRAY_FOREACH(&v, len, i, target) + { + efl_model_property_set(target, "self.selected", &unselect); + } + + eina_value_flush(&unselect); + + return v; +} + +#define BATCH_MAX 100 + +static void +_efl_ui_select_model_efl_ui_multi_selectable_async_unselect_range(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED, + uint64_t a, uint64_t b) +{ + unsigned int count, batch, i; + + count = MIN(efl_model_children_count_get(obj), b + 1); + + // Fetch group request of children in batches not to big to allow for throttling + // In the callback edit said object property to be unselected + i = a; + batch = 0; + + while (i < count) + { + Eina_Future *f; + + batch = MIN(i + BATCH_MAX, count); + batch -= i; + + f = efl_model_children_slice_get(obj, i, batch); + efl_future_then(obj, f, .success_type = EINA_VALUE_TYPE_ARRAY, + .success = _children_unselect_then); + + i += batch; + } +} + +static void +_efl_ui_select_model_efl_ui_single_selectable_fallback_selection_set(Eo *obj, + Efl_Ui_Select_Model_Data *pd, + Efl_Ui_Selectable *fallback) +{ + Eina_Value *index; + + if (!efl_isa(fallback, EFL_UI_SELECT_MODEL_CLASS)) + { + ERR("Class of object '%s' does not provide the necessary interface for Efl.Ui.Select_Model.fallback.", efl_debug_name_get(fallback)); + return; + } + if (efl_parent_get(fallback) != obj) + { + ERR("Provided object '%s' for fallback isn't a child of '%s'.", + efl_debug_name_get(fallback), efl_debug_name_get(obj)); + return; + } + + efl_replace(&pd->fallback_model, fallback); + + if (!pd->none) return ; + + // When we provide a fallback, we should use it! + index = efl_model_property_get(fallback, EFL_COMPOSITE_MODEL_CHILD_INDEX); + efl_model_property_set(obj, "child.selected", index); + eina_value_free(index); +} + +static Efl_Ui_Selectable * +_efl_ui_select_model_efl_ui_single_selectable_fallback_selection_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Select_Model_Data *pd) +{ + return pd->fallback_model; +} + +static void +_efl_ui_select_model_efl_ui_selectable_selected_set(Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED, + Eina_Bool selected) +{ + Eina_Value set = eina_value_bool_init(selected); + + efl_model_property_set(obj, "self.selected", &set); + + eina_value_flush(&set); +} + +static Eina_Bool +_efl_ui_select_model_efl_ui_selectable_selected_get(const Eo *obj, + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) +{ + Eina_Value *selected; + Eina_Bool r = EINA_FALSE; + + selected = efl_model_property_get(obj, "self.selected"); + eina_value_bool_convert(selected, &r); + eina_value_free(selected); + + return r; +} + #include "efl_ui_select_model.eo.c" +#include "efl_ui_multi_selectable_async.eo.c" diff --git a/src/lib/elementary/efl_ui_select_model.eo b/src/lib/elementary/efl_ui_select_model.eo index 39624da903..4d94d2fa61 100644 --- a/src/lib/elementary/efl_ui_select_model.eo +++ b/src/lib/elementary/efl_ui_select_model.eo @@ -1,33 +1,23 @@ class @beta Efl.Ui.Select_Model extends Efl.Boolean_Model + implements Efl.Ui.Multi_Selectable_Async, + Efl.Ui.Selectable { [[Efl ui select model class]] - methods { - selected_get { - [[Gets an iterator of all the selected child of this model. - ]] - return: iterator; [[The iterator gives indices of selected children. - It is valid until any change is made on the model.]] - } - unselected_get { - [[Gets an iterator of all the child of this model that are not selected. - ]] - return: iterator; [[The iterator gives indices of unselected children. - It is valid until any change is made on the model.]] - } - @property single_selection { - [[Defines if we support only one exclusive selection at a time when set to $true. - - If disable with $false, it will have the behavior of a multi select mode. - ]] - values { - enable: bool; [[$true will enable the exclusive mode.]] - } - } - } implements { Efl.Object.constructor; + Efl.Object.invalidate; Efl.Model.property { get; set; } Efl.Model.properties { get; } + Efl.Ui.Single_Selectable.last_selected { get; } + Efl.Ui.Multi_Selectable_Async.selected_iterator_new; + Efl.Ui.Multi_Selectable_Async.unselected_iterator_new; + Efl.Ui.Multi_Selectable_Async.select_mode {get; set;} + Efl.Ui.Multi_Selectable_Async.select_all; + Efl.Ui.Multi_Selectable_Async.unselect_all; + Efl.Ui.Multi_Selectable_Async.select_range; + Efl.Ui.Multi_Selectable_Async.unselect_range; + Efl.Ui.Single_Selectable.fallback_selection {get; set;} + Efl.Ui.Selectable.selected {get; set;} } events { /* FIXME: The object is emitted in the event_info. This is redundant. */ diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index a1c001a7bb..5ef2b05be1 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -180,6 +180,7 @@ pub_eo_files = [ 'efl_ui_position_manager_grid.eo', 'efl_ui_selectable.eo', 'efl_ui_multi_selectable.eo', + 'efl_ui_multi_selectable_async.eo', 'efl_ui_single_selectable.eo', 'efl_ui_position_manager_data_access_v1.eo', 'efl_ui_tab_bar_default_item.eo', diff --git a/src/tests/elementary/efl_ui_test_select_model.c b/src/tests/elementary/efl_ui_test_select_model.c index e11155c0aa..e2b61c5677 100644 --- a/src/tests/elementary/efl_ui_test_select_model.c +++ b/src/tests/elementary/efl_ui_test_select_model.c @@ -111,12 +111,12 @@ EFL_START_TEST(efl_test_select_model) ecore_main_loop_begin(); - it = efl_ui_select_model_selected_get(model); + it = efl_ui_multi_selectable_async_selected_iterator_new(model); EINA_ITERATOR_FOREACH(it, index) fail_if(*index != 2); eina_iterator_free(it); - it = efl_ui_select_model_unselected_get(model); + it = efl_ui_multi_selectable_async_unselected_iterator_new(model); EINA_ITERATOR_FOREACH(it, index) fail_if(*index == 2); eina_iterator_free(it); From 832d300e203621c9c32cb186fef16a529cc4306b Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 18 Sep 2019 19:39:44 -0700 Subject: [PATCH 022/115] elementary: fix children removal in Efl.Ui.Select_Model by not remembering index and relying on underlayer infrastructure to do it for us. Differential Revision: https://phab.enlightenment.org/D10034 --- src/lib/elementary/efl_ui_select_model.c | 35 +++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c index 93db5b3a6f..b969441bbc 100644 --- a/src/lib/elementary/efl_ui_select_model.c +++ b/src/lib/elementary/efl_ui_select_model.c @@ -22,13 +22,22 @@ struct _Efl_Ui_Select_Model_Data Efl_Ui_Select_Model *fallback_model; Efl_Ui_Select_Model *last_model; - unsigned long last; Efl_Ui_Select_Mode selection; Eina_Bool none : 1; }; +static void +_efl_ui_select_model_child_removed(void *data, const Efl_Event *event) +{ + Efl_Ui_Select_Model_Data *pd = data; + Efl_Model_Children_Event *ev = event->info; + + if (ev->child == pd->last_model) + efl_replace(&pd->last_model, NULL); +} + static Eo* _efl_ui_select_model_efl_object_constructor(Eo *obj, Efl_Ui_Select_Model_Data *pd) @@ -39,8 +48,7 @@ _efl_ui_select_model_efl_object_constructor(Eo *obj, efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE); - efl_replace(&pd->last_model, NULL); - pd->last = 0; + efl_event_callback_add(obj, EFL_MODEL_EVENT_CHILD_REMOVED, _efl_ui_select_model_child_removed, pd); pd->none = EINA_TRUE; parent = efl_parent_get(obj); @@ -122,20 +130,16 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) { // select case pd->none = EINA_FALSE; - pd->last = efl_composite_model_index_get(child); efl_replace(&pd->last_model, child); efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_SELECTED, child); } else { // unselect case - unsigned long last; - - last = efl_composite_model_index_get(child); - if (pd->last == last) + // There should only be one model which represent the same data at all in memory + if (pd->last_model == child) // direct comparison of pointer is ok { efl_replace(&pd->last_model, NULL); - pd->last = 0; pd->none = EINA_TRUE; // Just in case we need to refill the fallback @@ -395,10 +399,7 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, // there is nothing special to do, just normal commit change will do. if (!newflag) { - unsigned int i; - - i = efl_composite_model_index_get(obj); - if (pd->parent->last == i && !newflag) + if (pd->parent->last_model == obj && !newflag) { efl_replace(&pd->last_model, NULL); pd->parent->none = EINA_TRUE; @@ -413,7 +414,7 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, // In this case we need to first unselect the previously selected one // and then commit the change to this one. - selected = pd->parent->last; + selected = efl_composite_model_index_get(pd->parent->last_model); // There was, need to unselect the previous one along setting the new value parent = efl_parent_get(obj); @@ -451,8 +452,10 @@ _efl_ui_select_model_efl_model_property_get(const Eo *obj, Efl_Ui_Select_Model_D { if (pd->none) return eina_value_error_new(EFL_MODEL_ERROR_INCORRECT_VALUE); - else - return eina_value_ulong_new(pd->last); + else if (pd->last_model) + return eina_value_ulong_new(efl_composite_model_index_get(pd->last_model)); + else // Nothing selected yet, try again later + return eina_value_error_new(EAGAIN); } // Redirect to are we ourself selected if (pd->parent && eina_streq("self.selected", property)) From 2e1317baedb844a490e96b574fcec3c1ef52c6d9 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 5 Jul 2019 14:03:13 -0700 Subject: [PATCH 023/115] elementary: introduce Efl.Ui.CollectionView a generic listing View. The idea of this widget is to provide to MVVM what Efl.Ui.Collection provide and leverage the same shared logic for layout. Co-authored-by: Mike Blumenkrantz Co-authored-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D9958 --- .../efl_ui_collection_view_example_1.c | 107 + src/examples/elementary/meson.build | 1 + src/lib/elementary/Efl_Ui.h | 2 +- .../elementary/efl_ui_collection_events.eo | 2 +- src/lib/elementary/efl_ui_collection_view.c | 2301 +++++++++++++++++ src/lib/elementary/efl_ui_collection_view.eo | 61 + .../efl_ui_collection_view_focus_manager.eo | 7 + src/lib/elementary/efl_ui_item.c | 23 + src/lib/elementary/efl_ui_item.eo | 12 + src/lib/elementary/efl_ui_item_private.h | 1 + .../elementary/efl_ui_position_manager_list.c | 35 +- src/lib/elementary/efl_ui_widget.c | 2 - src/lib/elementary/efl_ui_widget_factory.c | 33 +- src/lib/elementary/elm_priv.h | 1 + src/lib/elementary/meson.build | 3 + 15 files changed, 2555 insertions(+), 36 deletions(-) create mode 100644 src/examples/elementary/efl_ui_collection_view_example_1.c create mode 100644 src/lib/elementary/efl_ui_collection_view.c create mode 100644 src/lib/elementary/efl_ui_collection_view.eo create mode 100644 src/lib/elementary/efl_ui_collection_view_focus_manager.eo diff --git a/src/examples/elementary/efl_ui_collection_view_example_1.c b/src/examples/elementary/efl_ui_collection_view_example_1.c new file mode 100644 index 0000000000..72960651fb --- /dev/null +++ b/src/examples/elementary/efl_ui_collection_view_example_1.c @@ -0,0 +1,107 @@ +// gcc -o efl_ui_collection_view_example_1 efl_ui_collection_view_example_1.c `pkg-config --cflags --libs efl-ui + +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#else +# define EFL_BETA_API_SUPPORT 1 +#endif + +#include +#include +#include +#include +#include + +#define NUM_ITEMS 400 + +static Efl_Model* +_make_model(Evas_Object *win) +{ + Eina_Value vtext; + Efl_Generic_Model *model, *child; + unsigned int i; + char buf[256]; + + model = efl_add(EFL_GENERIC_MODEL_CLASS, win); + eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING); + + for (i = 0; i < (NUM_ITEMS); i++) + { + child = efl_model_child_add(model); + snprintf(buf, sizeof(buf), "Item # %i", i); + eina_value_set(&vtext, buf); + efl_model_property_set(child, "title", &vtext); + } + + eina_value_flush(&vtext); + return model; +} + +static void +_item_constructing(void *data EINA_UNUSED, const Efl_Event *ev) +{ + Efl_Gfx_Entity *item = ev->info; + + if (!efl_ui_item_calc_locked_get(item)) + efl_gfx_hint_size_min_set(item, EINA_SIZE2D(50, 50)); +} + +EAPI_MAIN void +efl_main(void *data EINA_UNUSED, const Efl_Event *ev) +{ + Efl_Ui_Factory *factory; + Evas_Object *win, *li; + Eo *model; + Eo *position_manager; + Efl_App *app = ev->object; + Eina_Accessor *ac; + Eina_Bool list = EINA_TRUE, multi = EINA_FALSE, none = EINA_FALSE; + Efl_Ui_Select_Mode mode = EFL_UI_SELECT_MODE_SINGLE; + const char *arg; + unsigned int i; + + ac = efl_core_command_line_command_access(app); + EINA_ACCESSOR_FOREACH(ac, i, arg) + { + if (eina_streq(arg, "grid")) list = EINA_FALSE; + if (eina_streq(arg, "multi")) multi = EINA_TRUE; + if (eina_streq(arg, "none")) none = EINA_TRUE; + } + eina_accessor_free(ac); + + if (multi) mode = EFL_UI_SELECT_MODE_MULTI; + if (none) mode = EFL_UI_SELECT_MODE_NONE; + + win = efl_add(EFL_UI_WIN_CLASS, app, + efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), + efl_ui_win_autohide_set(efl_added, EINA_TRUE)); + elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); + model = _make_model(win); + + factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); + efl_ui_property_bind(factory, "text", "title"); + + if (list) + { + position_manager = efl_new(EFL_UI_POSITION_MANAGER_LIST_CLASS); + efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); + } + else + { + position_manager = efl_new(EFL_UI_POSITION_MANAGER_GRID_CLASS); + efl_ui_widget_factory_item_class_set(factory, EFL_UI_GRID_DEFAULT_ITEM_CLASS); + efl_event_callback_add(factory, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, _item_constructing, NULL); + } + + li = efl_add(EFL_UI_COLLECTION_VIEW_CLASS, win, + efl_ui_collection_view_position_manager_set(efl_added, position_manager), + efl_ui_view_model_set(efl_added, model), + efl_ui_multi_selectable_async_select_mode_set(efl_added, mode), + efl_ui_collection_view_factory_set(efl_added, factory)); + + efl_content_set(win, li); + + //showall + efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 320)); +} +EFL_MAIN() diff --git a/src/examples/elementary/meson.build b/src/examples/elementary/meson.build index 53d1213d4c..53489299cb 100644 --- a/src/examples/elementary/meson.build +++ b/src/examples/elementary/meson.build @@ -114,6 +114,7 @@ examples = [ 'efl_ui_list_view_example_1', 'efl_ui_list_view_example_2', 'efl_ui_list_view_example_3', + 'efl_ui_collection_view_example_1', 'efl_canvas_layout_text', 'efl_ui_theme_example_01', 'efl_ui_theme_example_02', diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 2c899fa20c..baa945c24b 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -333,7 +333,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include - +# include # include # include diff --git a/src/lib/elementary/efl_ui_collection_events.eo b/src/lib/elementary/efl_ui_collection_events.eo index 9ef6a991df..653172564b 100644 --- a/src/lib/elementary/efl_ui_collection_events.eo +++ b/src/lib/elementary/efl_ui_collection_events.eo @@ -1,6 +1,6 @@ interface @beta Efl.Ui.Collection_Events { - [[Shared sets of events between @Efl.Ui.Collection and Efl.Ui.Collection_View.]] + [[Shared sets of events between @Efl.Ui.Collection and @Efl.Ui.Collection_View.]] event_prefix: efl_ui; events { item,pressed : Efl.Ui.Item; [[A $press event occurred over an item.]] diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c new file mode 100644 index 0000000000..d597c46d0b --- /dev/null +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -0,0 +1,2301 @@ +// Note: @1.23 Initial release has infrastructure to support more mode than homogeneous, but isn't exposed in the API nor supported. + +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#define ELM_LAYOUT_PROTECTED +#define EFL_UI_SCROLL_MANAGER_PROTECTED +#define EFL_UI_SCROLLBAR_PROTECTED +#define EFL_UI_WIDGET_FOCUS_MANAGER_PROTECTED + +#include +#include +#include "elm_widget.h" +#include "elm_priv.h" + +#include "efl_ui_collection_view_focus_manager.eo.h" + +#ifndef VIEWPORT_ENABLE +# undef VIEWPORT_ENABLE +#endif + +typedef struct _Efl_Ui_Collection_View_Data Efl_Ui_Collection_View_Data; +typedef struct _Efl_Ui_Collection_Viewport Efl_Ui_Collection_Viewport; +typedef struct _Efl_Ui_Collection_View_Focus_Manager_Data Efl_Ui_Collection_View_Focus_Manager_Data; +typedef struct _Efl_Ui_Collection_Item Efl_Ui_Collection_Item; +typedef struct _Efl_Ui_Collection_Item_Lookup Efl_Ui_Collection_Item_Lookup; +typedef struct _Efl_Ui_Collection_Request Efl_Ui_Collection_Request; + +struct _Efl_Ui_Collection_Item +{ + Efl_Gfx_Entity *entity; + Efl_Model *model; +}; + +struct _Efl_Ui_Collection_Item_Lookup +{ + EINA_RBTREE; + + uint64_t index; + Efl_Ui_Collection_Item item; +}; + +struct _Efl_Ui_Collection_Viewport +{ + Efl_Ui_Collection_Item *items; + + uint64_t offset; + uint16_t count; +}; + +struct _Efl_Ui_Collection_Request +{ + Eina_Future *f; + + uint64_t offset; + uint64_t length; + + Eina_Bool model_requested : 1; + Eina_Bool model_fetched : 1; + Eina_Bool need_entity : 1; + Eina_Bool entity_requested : 1; +}; + +struct _Efl_Ui_Collection_View_Data +{ + Efl_Ui_Factory *factory; + Efl_Ui_Position_Manager_Entity *manager; + Efl_Ui_Scroll_Manager *scroller; + Efl_Ui_Pan *pan; + Efl_Gfx_Entity *sizer; + Efl_Model *model; + Efl_Model *multi_selectable_async_model; + +#ifdef VIEWPORT_ENABLE + Efl_Ui_Collection_Viewport *viewport[3]; +#endif + Eina_Rbtree *cache; + + Eina_List *requests; // Array of Efl_Ui_Collection_Request in progress + + uint64_t start_id; + uint64_t end_id; + + Eina_Size2D content_min_size; + + Efl_Ui_Layout_Orientation direction; + Efl_Ui_Select_Mode mode; + + struct { + Eina_Bool w : 1; + Eina_Bool h : 1; + } match_content; + + Efl_Ui_Position_Manager_Request_Range current_range; +}; + +struct _Efl_Ui_Collection_View_Focus_Manager_Data +{ + Efl_Ui_Collection_View *collection; +}; + +static const char *COLLECTION_VIEW_MANAGED = "_collection_view.managed"; +static const char *COLLECTION_VIEW_MANAGED_YES = "yes"; + +#define MY_CLASS EFL_UI_COLLECTION_VIEW_CLASS + +#define MY_DATA_GET(obj, pd) \ + Efl_Ui_Collection_View_Data *pd = efl_data_scope_get(obj, MY_CLASS); + +static void _entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request); +static void _idle_cb(void *data, const Efl_Event *event); + +static int +_cache_tree_lookup(const Eina_Rbtree *node, const void *key, + int length EINA_UNUSED, void *data EINA_UNUSED) +{ + const Efl_Ui_Collection_Item_Lookup *n = (Efl_Ui_Collection_Item_Lookup *)node; + const uint64_t *index = key; + + if (n->index > *index) + return 1; + if (n->index < *index) + return -1; + return 0; +} + +static Eina_Rbtree_Direction +_cache_tree_cmp(const Eina_Rbtree *left, const Eina_Rbtree *right, void *data EINA_UNUSED) +{ + Efl_Ui_Collection_Item_Lookup *l = (Efl_Ui_Collection_Item_Lookup *)left; + Efl_Ui_Collection_Item_Lookup *r = (Efl_Ui_Collection_Item_Lookup *)right; + + return l->index < r->index ? EINA_RBTREE_LEFT : EINA_RBTREE_RIGHT; +} + +static Eina_Value +_undo_item_selected_then(Eo *item, void *data EINA_UNUSED, Eina_Error err) +{ + Eina_Value *get; + Eina_Bool item_selected = efl_ui_selectable_selected_get(item); + Eina_Bool model_selected = EINA_FALSE; + + get = efl_model_property_get(efl_ui_view_model_get(item), "self.selected"); + eina_value_bool_get(get, &model_selected); + eina_value_free(get); + + if ((!!model_selected) != (!!item_selected)) + efl_ui_selectable_selected_set(item, model_selected); + + return eina_value_error_init(err); +} + +static void +_selected_item_cb(void *data EINA_UNUSED, const Efl_Event *ev) +{ + // Link back property to model, maybe just trigger event on the item should be enough + Eina_Value *get; + Eina_Bool item_selected = efl_ui_selectable_selected_get(ev->object); + Eina_Bool model_selected = EINA_FALSE; + Eina_Value set = eina_value_bool_init(!!item_selected); + + get = efl_model_property_get(efl_ui_view_model_get(ev->object), "self.selected"); + eina_value_bool_get(get, &model_selected); + eina_value_free(get); + + if ((!!model_selected) != (!!item_selected)) + { + Eina_Future *f; + + f = efl_model_property_set(efl_ui_view_model_get(ev->object), "self.selected", &set); + + // In case the mode is preventing the change, we need to update the UI back. So handle error case + efl_future_then(ev->object, f, + .error = _undo_item_selected_then); + } + + eina_value_flush(&set); +} + +static void +_redirect_item_cb(void *data, const Efl_Event *ev) +{ + Eo *obj = data; + +#define REDIRECT_EVT(item_evt, item) \ + if (item_evt == ev->desc) efl_event_callback_call(obj, item, ev->object); + REDIRECT_EVT(EFL_INPUT_EVENT_PRESSED, EFL_UI_EVENT_ITEM_PRESSED); + REDIRECT_EVT(EFL_INPUT_EVENT_UNPRESSED, EFL_UI_EVENT_ITEM_UNPRESSED); + REDIRECT_EVT(EFL_INPUT_EVENT_LONGPRESSED, EFL_UI_EVENT_ITEM_LONGPRESSED); + REDIRECT_EVT(EFL_INPUT_EVENT_CLICKED_ANY, EFL_UI_EVENT_ITEM_CLICKED_ANY); + REDIRECT_EVT(EFL_INPUT_EVENT_CLICKED, EFL_UI_EVENT_ITEM_CLICKED); +#undef REDIRECT_EVT +} + +EFL_CALLBACKS_ARRAY_DEFINE(active_item_cbs, + { EFL_UI_EVENT_SELECTED_CHANGED, _selected_item_cb }, + { EFL_INPUT_EVENT_PRESSED, _redirect_item_cb }, + { EFL_INPUT_EVENT_UNPRESSED, _redirect_item_cb }, + { EFL_INPUT_EVENT_LONGPRESSED, _redirect_item_cb }, + { EFL_INPUT_EVENT_CLICKED, _redirect_item_cb }, + { EFL_INPUT_EVENT_CLICKED_ANY, _redirect_item_cb }); + +static void +_entity_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Factory *factory, + Efl_Ui_Collection_Item *item, Eina_Array *scheduled_release) +{ + Efl_Gfx_Entity *entities[1]; + + entities[0] = item->entity; + if (!entities[0]) return ; + + efl_event_callback_array_del(entities[0], active_item_cbs(), obj); + efl_replace(&item->entity, NULL); + efl_event_callback_call(obj, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_UNREALIZED, entities[0]); + if (!scheduled_release) + { + efl_ui_factory_release(factory, EINA_C_ARRAY_ITERATOR_NEW(entities)); + } + else + { + eina_array_push(scheduled_release, entities[0]); + } +} + +static void +_item_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Factory *factory, + Efl_Ui_Collection_Item *item, Eina_Array *scheduled_release) +{ + efl_replace(&item->model, NULL); + + _entity_cleanup(obj, factory, item, scheduled_release); +} + +static void +_cache_item_free(Eina_Rbtree *node, void *data) +{ + Efl_Ui_Collection_Item_Lookup *n = (void*) node; + MY_DATA_GET(data, pd); + + _item_cleanup(data, pd->factory, &n->item, NULL); + free(n); +} + +static void +_cache_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_View_Data *pd) +{ + eina_rbtree_delete(pd->cache, _cache_item_free, obj); + pd->cache = NULL; +} + +static void +_all_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_View_Data *pd) +{ + Efl_Ui_Collection_Request *request; + Eina_List *l, *ll; +#ifdef VIEWPORT_ENABLE + unsigned int i; +#endif + + _cache_cleanup(obj, pd); +#ifdef VIEWPORT_ENABLE + for (i = 0; i < 3; i++) + { + unsigned int j; + + if (!pd->viewport[i]) continue; + + for (j = 0; j < pd->viewport[i]->count; j++) + _item_cleanup(obj, pd->factory, &(pd->viewport[i]->items[j])); + } +#endif + + EINA_LIST_FOREACH_SAFE(pd->requests, l, ll, request) + eina_future_cancel(request->f); +} + +static inline Eina_Bool +_size_from_model(Efl_Model *model, Eina_Size2D *r, const char *width, const char *height) +{ + Eina_Value *vw, *vh; + Eina_Bool success = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(model, EINA_FALSE); + + vw = efl_model_property_get(model, width); + vh = efl_model_property_get(model, height); + + if (eina_value_type_get(vw) == EINA_VALUE_TYPE_ERROR || + eina_value_type_get(vh) == EINA_VALUE_TYPE_ERROR) + goto on_error; + + if (!eina_value_int_convert(vw, &(r->w))) r->w = 0; + if (!eina_value_int_convert(vh, &(r->h))) r->h = 0; + + success = EINA_TRUE; + + on_error: + eina_value_free(vw); + eina_value_free(vh); + + return success; +} + +static inline void +_size_to_model(Efl_Model *model, Eina_Size2D state) +{ + Eina_Value vw, vh; + + vw = eina_value_int_init(state.w); + vh = eina_value_int_init(state.h); + + efl_model_property_set(model, "self.width", &vw); + efl_model_property_set(model, "self.height", &vh); + + eina_value_flush(&vw); + eina_value_flush(&vh); +} + +#define ITEM_BASE_SIZE_FROM_MODEL(Model, Size) _size_from_model(Model, &Size, "item.width", "item.height") +#define ITEM_SIZE_FROM_MODEL(Model, Size) _size_from_model(Model, &Size, "self.width", "self.height") + +static Eina_List * +_request_add(Eina_List *requests, Efl_Ui_Collection_Request **request, + uint64_t index, Eina_Bool need_entity) +{ + if (!(*request)) goto create; + + if ((*request)->offset + (*request)->length == index) + { + if (need_entity) (*request)->need_entity = EINA_TRUE; + (*request)->length += 1; + return requests; + } + + requests = eina_list_append(requests, *request); + + create: + *request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!(*request)) return requests; + (*request)->offset = index; + (*request)->length = 1; + // At this point, we rely on the model caching ability to avoid recreating model + (*request)->model_requested = EINA_TRUE; + (*request)->need_entity = !!need_entity; + + return requests; +} + +static Eina_Value +_model_fetched_cb(Eo *obj, void *data, const Eina_Value v) +{ + MY_DATA_GET(obj, pd); + Efl_Ui_Collection_Request *request = data; + Efl_Model *child; + unsigned int i, len; + Eina_Bool request_entity = EINA_FALSE; + + request->model_fetched = EINA_TRUE; + EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) + { + Efl_Ui_Collection_Item_Lookup *insert; + Eina_Size2D item_size; +#ifdef VIEWPORT_ENABLE + unsigned int v; + + for (v = 0; v < 3; ++v) + { + if (!pd->viewport[v]) continue; + + if ((pd->viewport[v]->offset <= request->offset + i) && + (request->offset + i < pd->viewport[v]->offset + pd->viewport[v]->count)) + { + uint64_t index = request->offset + i - pd->viewport[v]->offset; + + efl_replace(&pd->viewport[v]->items[index].model, child); + child = NULL; + break; + } + } +#endif + + // When requesting a model, it should not be in the cache prior to the request + if (!child) continue; + + uint64_t search_index = request->offset + i; + + insert = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, + sizeof (search_index), _cache_tree_lookup, + NULL); + if (insert) + { + if (!insert->item.entity && request->need_entity) + { + //drop the old model here, overwrite with model + view + efl_replace(&insert->item.model, child); + } + else + ERR("Inserting a model that was already fetched, dropping new model %lu", search_index); + } + else + { + insert = calloc(1, sizeof (Efl_Ui_Collection_Item_Lookup)); + if (!insert) continue; + insert->index = request->offset + i; + insert->item.model = efl_ref(child); + pd->cache = eina_rbtree_inline_insert(pd->cache, EINA_RBTREE_GET(insert), _cache_tree_cmp, NULL); + } + + if (!ITEM_SIZE_FROM_MODEL(insert->item.model, item_size)) + request_entity = EINA_TRUE; + } + + if (request_entity) + { + request->need_entity = EINA_TRUE; + _entity_request(obj, request); + } + + return v; +} + +static void +_model_free_cb(Eo *o, void *data, const Eina_Future *dead_future EINA_UNUSED) +{ + MY_DATA_GET(o, pd); + Efl_Ui_Collection_Request *request = data; + + if (request->need_entity) + { + if (!request->entity_requested) + _entity_request(o, request); + } + else + { + pd->requests = eina_list_remove(pd->requests, request); + free(request); + } +} + +static Eina_Value +_entity_fetch_cb(Eo *obj, void *data EINA_UNUSED, const Eina_Value v) +{ + MY_DATA_GET(obj, pd); + Efl_Model *child; + Eina_Future *r; + Eina_Array tmp; + unsigned int i, len; + + eina_array_step_set(&tmp, sizeof (Eina_Array), 4); + + EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) + { + eina_array_push(&tmp, child); + } + + r = efl_ui_view_factory_create_with_event(pd->factory, eina_array_iterator_new(&tmp)); + + eina_array_flush(&tmp); + + return eina_future_as_value(r); +} + +static inline Eina_Bool +_entity_propagate(Efl_Model *model, Efl_Gfx_Entity *entity) +{ + Eina_Size2D item_size; + + if (efl_key_data_get(entity, "efl.ui.widget.factory.size_set")) + { + return EINA_FALSE; + } + + if (ITEM_SIZE_FROM_MODEL(model, item_size)) + { + efl_gfx_hint_size_min_set(entity, item_size); + efl_canvas_group_need_recalculate_set(entity, EINA_FALSE); + if (efl_isa(entity, EFL_UI_ITEM_CLASS)) efl_ui_item_calc_locked_set(entity, EINA_TRUE); + return EINA_FALSE; + } + + efl_canvas_group_calculate(entity); + item_size = efl_gfx_hint_size_combined_min_get(entity); + efl_canvas_group_need_recalculate_set(entity, EINA_FALSE); + + _size_to_model(model, item_size); + return EINA_TRUE; +} + +static Eina_Value +_entity_fetched_cb(Eo *obj, void *data, const Eina_Value v) +{ + MY_DATA_GET(obj, pd); + Efl_Ui_Collection_Request *request = data; + Efl_Gfx_Entity *child; + unsigned int i, len; + uint64_t updated_size_start_id, updated_entity_start_id; + Eina_Bool updated_size = EINA_FALSE, updated_entity = EINA_FALSE; + + EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) + { + Efl_Ui_Collection_Item_Lookup *lookup; + uint64_t search_index; + //unsigned int v; + + efl_key_data_set(child, COLLECTION_VIEW_MANAGED, COLLECTION_VIEW_MANAGED_YES); + /* fix eventing in scroller by ensuring collection items are in the scroller hierarchy */ + efl_ui_item_container_set(child, obj); + efl_ui_widget_sub_object_add(obj, child); + efl_canvas_group_member_add(pd->pan, child); + efl_ui_widget_focus_allow_set(child, EINA_FALSE); + efl_gfx_entity_visible_set(child, EINA_FALSE); + +#ifdef VIEWPORT_ENABLE + for (v = 0; v < 3; ++v) + { + if (!pd->viewport[v]) continue; + + if ((pd->viewport[v]->offset <= request->offset + i) && + (request->offset + i < pd->viewport[v]->offset + pd->viewport[v]->count)) + { + uint64_t index = request->offset + i - pd->viewport[v]->offset; + + if (pd->viewport[v]->items[index].entity) + { + ERR("Entity already existing for id %d", i); + efl_unref(pd->viewport[v]->items[index].entity); + efl_del(pd->viewport[v]->items[index].entity); + pd->viewport[v]->items[index].entity = NULL; + } + + efl_replace(&pd->viewport[v]->items[index].entity, child); + if (_entity_propagate(pd->viewport[v]->items[index].model, child)) + { + if (!updated_size) + { + updated_size = EINA_TRUE; + updated_size_start_id = index; + } + } + else + { + if (updated_size) + { + efl_ui_position_manager_entity_item_size_changed(pd->manager, + updated_size_start_id, + index - 1); + updated_size = EINA_FALSE; + } + } + child = NULL; + break; + } + } +#endif + + // When requesting an entity, the model should already be in the cache + if (!child) continue; + + search_index = request->offset + i; + + lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, + sizeof (search_index), _cache_tree_lookup, + NULL); + + if (!lookup) + { + Efl_Gfx_Entity *entities[1] = { child }; + efl_ui_factory_release(pd->factory, EINA_C_ARRAY_ITERATOR_NEW(entities)); + continue; + } + if (lookup->item.entity) + { + ERR("Entity already existing for id %lu", search_index); + _entity_cleanup(obj, pd->factory, &lookup->item, NULL); + } + + lookup->item.entity = efl_ref(child); + efl_event_callback_array_add(child, active_item_cbs(), obj); + efl_event_callback_call(obj, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, child); + + if (!updated_entity) + { + updated_entity = EINA_TRUE; + updated_entity_start_id = search_index; + } + + if (_entity_propagate(lookup->item.model, child)) + { + if (!updated_size) + { + updated_size = EINA_TRUE; + updated_size_start_id = search_index; + } + } + else + { + if (updated_size) + { + efl_ui_position_manager_entity_item_size_changed(pd->manager, + updated_size_start_id, + search_index - 1); + updated_size = EINA_FALSE; + } + }} + ; + + // Currently position manager will flush its entire size cache on update, so only do + // it when necessary to improve performance. + if (updated_size) + { + efl_ui_position_manager_entity_item_size_changed(pd->manager, + updated_size_start_id, + i - 1); + updated_size = EINA_FALSE; + } + + // Notify the position manager that new entity are ready to display + if (updated_entity) + { + efl_ui_position_manager_entity_entities_ready(pd->manager, + updated_entity_start_id, + i - 1); + + efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj); + efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj); + } + return v; +} + +static void +_entity_free_cb(Eo *o, void *data, const Eina_Future *dead_future EINA_UNUSED) +{ + MY_DATA_GET(o, pd); + Efl_Ui_Collection_Request *request = data; + + pd->requests = eina_list_remove(pd->requests, request); + free(request); +} + +static Eina_List * +_cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request, + Efl_Ui_Collection_View_Data *pd, + uint64_t search_index, + Efl_Ui_Position_Manager_Size_Batch_Entity *target, + Eina_Size2D item_base) +{ + Efl_Ui_Collection_Item_Lookup *lookup; + Efl_Model *model; + Eina_Size2D item_size = item_base; + + if (!pd->cache) goto not_found; + + lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, + sizeof (search_index), _cache_tree_lookup, + NULL); + if (!lookup) goto not_found; + + // In the cache we should always have model, so no need to check for it + model = lookup->item.model; + + // If we do not know the size + if (!ITEM_SIZE_FROM_MODEL(model, item_size)) + { + if (lookup->item.entity) + { + ERR("Got a model '%s' and an item '%s', but no size. Recalculating.", + efl_debug_name_get(model), efl_debug_name_get(lookup->item.entity)); + _entity_propagate(model, lookup->item.entity); + if (!ITEM_SIZE_FROM_MODEL(model, item_size)) + { + CRI("No size for itme '%s' after recalculating. This is bad.", + efl_debug_name_get(lookup->item.entity)); + } + } + else if (!ITEM_BASE_SIZE_FROM_MODEL(pd->model, item_size)) + { + INF("No base size yet available. Making things up."); + item_size.w = 1; + item_size.h = 1; + } + } + + target->size = item_size; + target->element_depth = 0; + target->depth_leader = EINA_FALSE; + return requests; + + not_found: + requests = _request_add(requests, request, search_index, EINA_FALSE); + + target->size = item_size; + target->element_depth = 0; + target->depth_leader = EINA_FALSE; + return requests; +} + +static Eina_List * +_cache_entity_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request, + Efl_Ui_Collection_View_Data *pd, + uint64_t search_index, + Efl_Ui_Position_Manager_Object_Batch_Entity *target) +{ + Efl_Ui_Collection_Item_Lookup *lookup; + + if (!pd->cache) goto not_found; + + lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &search_index, + sizeof (search_index), _cache_tree_lookup, + NULL); + if (!lookup) goto not_found; + if (!lookup->item.entity) goto not_found; + + if (target) target->entity = lookup->item.entity; + goto finish; + + not_found: + requests = _request_add(requests, request, search_index, EINA_TRUE); + + if (target) target->entity = NULL; + finish: + if (!target) return requests; + + target->element_depth = 0; + target->depth_leader = EINA_FALSE; + + return requests; +} + +static void +_entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request) +{ + if (request->model_requested && (!request->model_fetched)) return; + request->f = efl_future_then(obj, request->f, + .success_type = EINA_VALUE_TYPE_ARRAY, + .success = _entity_fetch_cb); + request->f = efl_future_then(obj, request->f, + .success_type = EINA_VALUE_TYPE_ARRAY, + .success = _entity_fetched_cb, + .data = request, + .free = _entity_free_cb); + request->entity_requested = EINA_TRUE; +} + +static inline void +_entity_inflight_request(Efl_Ui_Collection_View *obj, + Efl_Ui_Collection_Request *request, + Efl_Ui_Collection_Request *inflight) +{ + if (request->need_entity == EINA_FALSE) return ; + if (inflight->entity_requested) return ; + + _entity_request(obj, inflight); +} + +static Eina_List * +_batch_request_flush(Eina_List *requests, + Efl_Ui_Collection_View *obj, + Efl_Ui_Collection_View_Data *pd) +{ + Efl_Ui_Collection_Request *request; + Eina_List *ll, *next_list_item; + + EINA_LIST_FOREACH_SAFE(requests, ll, next_list_item, request) + { + // Check request intersection with all pending request + Efl_Ui_Collection_Request *inflight; + Efl_Model *model; + Eina_List *l; + + EINA_LIST_FOREACH(pd->requests, l, inflight) + { + uint64_t istart = inflight->offset; + uint64_t iend = inflight->offset + inflight->length; + uint64_t rstart = request->offset; + uint64_t rend = request->offset + request->length; + + // Way before + if (rend < istart) continue; + // Way after + if (rstart >= iend) continue; + + // request included in current inflight request + if (rstart >= istart && rend <= iend) + { + _entity_inflight_request(obj, request, inflight); + + // In this case no need to start a request + requests = eina_list_remove_list(requests, ll); + free(request); + request = NULL; + break; + } + + // request overflow left and right + if (rstart < istart && iend < rend) + { + // Remove the center portion of the request by emitting a new one + Efl_Ui_Collection_Request *rn; + + rn = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!rn) break; + + rn->offset = iend; + rn->length = rend - iend; + rn->model_requested = request->model_requested; + rn->need_entity = request->need_entity; + + requests = eina_list_append(requests, rn); + + request->length = istart - rstart; + _entity_inflight_request(obj, request, inflight); + continue; + } + + // request overflow left + if (rstart < istart && rend > istart && rend <= iend) + { + request->length = istart - rstart; + _entity_inflight_request(obj, request, inflight); + continue; + } + + // request overflow right + if (rstart >= istart && rstart < iend && iend <= rend) + { + request->offset = iend; + request->length = rend - iend; + _entity_inflight_request(obj, request, inflight); + continue; + } + } + + if (!request) continue; + + model = pd->model; + // Are we ready yet + if (!model) + { + requests = eina_list_remove_list(requests, ll); + free(request); + continue; + } + // Is the request inside the limit of the model? + if (request->offset >= efl_model_children_count_get(model)) + { + requests = eina_list_remove_list(requests, ll); + free(request); + continue; + } + // Is its limit outside the model limit? + if (request->offset + request->length >= efl_model_children_count_get(model)) + { + request->length = efl_model_children_count_get(model) - request->offset; + } + + // We now have a request, time to trigger a fetch + // We assume here that we are always fetching the model (model_requested must be true) + if (!request->model_requested) + { + CRI("Someone forgot to set model_requested for %lu to %lu.", + request->offset, request->offset + request->length); + request->model_requested = EINA_TRUE; + } + request->f = efl_model_children_slice_get(model, request->offset, request->length); + request->f = efl_future_then(obj, request->f, + .success = _model_fetched_cb, + .data = request, + .free = _model_free_cb); + + eina_list_move_list(&pd->requests, &requests, ll); + } + return NULL; +} + +static Efl_Ui_Position_Manager_Size_Batch_Result +_batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_Rw_Slice memory) +{ + MY_DATA_GET(data, pd); + Efl_Ui_Position_Manager_Size_Batch_Entity *sizes; + Efl_Ui_Collection_Request *request = NULL; + Efl_Ui_Position_Manager_Size_Batch_Result result = {0}; + Efl_Model *parent; + Eina_List *requests = NULL; + Eina_Size2D item_base = {0}; + unsigned int limit; + unsigned int idx = 0; + + // get the approximate value from the tree node + parent = pd->model; + + sizes = memory.mem; + //count = efl_model_children_count_get(parent); + limit = conf.range.end_id - conf.range.start_id; + ITEM_BASE_SIZE_FROM_MODEL(parent, item_base); + + // Look in the temporary cache now for the beginning of the buffer +#ifdef VIEWPORT_ENABLE + if (pd->viewport[0] && ((uint64_t)(conf.range.start_id + idx) < pd->viewport[0]->offset)) + { + while ((uint64_t)(conf.range.start_id + idx) < pd->viewport[0]->offset && idx < limit) + { + uint64_t search_index = conf.range.start_id + idx; + requests = _cache_size_fetch(requests, &request, pd, + search_index, &sizes[idx], item_base); + idx++; + } + } + + // Then look in our buffer view if the needed information can be found there + for (i = 0; i < 3; ++i) + { + if (!pd->viewport[i]) continue; + + while (idx < limit && + (pd->viewport[i]->offset <= conf.range.start_id + idx) && + (conf.range.start_id + idx < (pd->viewport[i]->offset + pd->viewport[i]->count))) + { + uint64_t offset = conf.range.start_id + idx - pd->viewport[i]->offset; + Efl_Model *model = pd->viewport[i]->items[offset].model; + Efl_Gfx_Entity *entity = pd->viewport[i]->items[offset].entity; + Eina_Bool entity_request = EINA_FALSE; + + if (model) + { + Eina_Size2D item_size; + Eina_Bool found = EINA_FALSE; + + if (ITEM_SIZE_FROM_MODEL(model, item_size)) + found = EINA_TRUE; + if (!found && entity) + { + item_size = efl_gfx_hint_size_combined_min_get(entity); + //if the size is 0 here, then we are running into trouble, + //fetch size from the parent model, where some fallback is defined + if (item_size.h == 0 && item_size.w == 0) + { + item_size = item_base; + found = EINA_TRUE; + } + else + { + _size_to_model(model, item_size); + found = EINA_TRUE; + } + + } + + if (found) + { + sizes[idx].size = item_size; + sizes[idx].element_depth = 0; + sizes[idx].depth_leader = EINA_FALSE; + goto done; + } + + // We will need an entity to calculate this size + entity_request = EINA_TRUE; + } + // No data, add to the requests + requests = _request_add(requests, &request, conf.range.start_id + idx, entity_request); + + sizes[idx].size = item_base; + sizes[idx].element_depth = 0; + sizes[idx].depth_leader = EINA_FALSE; + + done: + idx++; + } + } + + // Look in the temporary cache now for the end of the buffer + while (idx < limit) + { + uint64_t search_index = conf.range.start_id + idx; + requests = _cache_size_fetch(requests, &request, pd, + search_index, &sizes[idx], item_base); + idx++; + } +#endif + + /* if (conf.cache_request) */ + /* { */ + /* printf("CACHING SIZE CALL\n"); */ + /* while (idx < limit) */ + /* { */ + /* sizes[idx].depth_leader = EINA_FALSE; */ + /* sizes[idx].element_depth = 0; */ + /* sizes[idx].size = pd->last_base; */ + /* idx++; */ + /* } */ + /* fprintf(stderr, "read with no fetch\n"); */ + /* } */ + /* else */ + { + while (idx < limit) + { + uint64_t search_index = conf.range.start_id + idx; + requests = _cache_size_fetch(requests, &request, pd, + search_index, &sizes[idx], item_base); + idx++; + } + + + // Done, but flush request first + if (request) requests = eina_list_append(requests, request); + + requests = _batch_request_flush(requests, data, pd); + } + + // Get the amount of filled item + result.filled_items = limit; + + return result; +} + +static Efl_Ui_Position_Manager_Object_Batch_Result +_batch_entity_cb(void *data, Efl_Ui_Position_Manager_Request_Range range, Eina_Rw_Slice memory) +{ + MY_DATA_GET(data, pd); + Efl_Ui_Position_Manager_Object_Batch_Entity *entities; + Efl_Ui_Collection_Request *request = NULL; + Efl_Ui_Position_Manager_Object_Batch_Result result = {0}; + Eina_List *requests = NULL; +#ifdef VIEWPORT_ENABLE + Efl_Model *parent; +#endif + unsigned int limit; + unsigned int idx = 0; + + //parent = pd->model; + + entities = memory.mem; + //count = efl_model_children_count_get(parent); + limit = range.end_id - range.start_id;; + + // Look in the temporary cache now for the beginning of the buffer +#ifdef VIEWPORT_ENABLE + if (pd->viewport[0] && ((uint64_t)(range.start_id + idx) < pd->viewport[0]->offset)) + { + while (idx < limit && (uint64_t)(range.start_id + idx) < pd->viewport[0]->offset) + { + uint64_t search_index = range.start_id + idx; + + requests = _cache_entity_fetch(requests, &request, pd, + search_index, &entities[idx]); + + idx++; + } + } + + // Then look in our buffer view if the needed information can be found there + for (i = 0; i < 3; ++i) + { + if (!pd->viewport[i]) continue; + + while (idx < limit && + (pd->viewport[i]->offset <= range.start_id + idx) && + (range.start_id + idx < (pd->viewport[i]->offset + pd->viewport[i]->count))) + { + uint64_t offset = range.start_id + idx - pd->viewport[i]->offset; + Efl_Gfx_Entity *entity = pd->viewport[i]->items[offset].entity; + + if (!entity) + { + // No data, add to the requests + requests = _request_add(requests, &request, range.start_id + idx, EINA_TRUE); + + entities[idx].entity = NULL; + entities[idx].depth_leader = EINA_FALSE; + entities[idx].element_depth = 0; + } + else + { + entities[idx].entity = entity; + entities[idx].depth_leader = EINA_FALSE; + entities[idx].element_depth = 0; + } + + idx++; + } + } +#endif + + // Look in the temporary cache now for the end of the buffer + while (idx < limit) + { + uint64_t search_index = range.start_id + idx; + + requests = _cache_entity_fetch(requests, &request, pd, + search_index, &entities[idx]); + + idx++; + } + // Done, but flush request first + if (request) + { + requests = eina_list_append(requests, request); + } + + requests = _batch_request_flush(requests, data, pd); + + // Get the amount of filled item + result.filled_items = limit; + + return result; +} + + +#if 0 +static void +_batch_free_cb(void *data) +{ + efl_unref(data); +} +#endif + +static void +flush_min_size(Eo *obj, Efl_Ui_Collection_View_Data *pd) +{ + Eina_Size2D tmp = pd->content_min_size; + + if (!pd->match_content.w) + tmp.w = -1; + + if (!pd->match_content.h) + tmp.h = -1; + + efl_gfx_hint_size_restricted_min_set(obj, tmp); +} + +static void +_manager_content_size_changed_cb(void *data, const Efl_Event *ev) +{ + Eina_Size2D *size = ev->info; + MY_DATA_GET(data, pd); + + efl_gfx_entity_size_set(pd->sizer, *size); +} + +static void +_manager_content_min_size_changed_cb(void *data, const Efl_Event *ev) +{ + Eina_Size2D *size = ev->info; + MY_DATA_GET(data, pd); + + pd->content_min_size = *size; + + flush_min_size(data, pd); +} + +#ifdef VIEWPORT_ENABLE +static Eina_List * +_viewport_walk_fill(Eina_List *requests, + Efl_Ui_Collection_View *obj, + Efl_Ui_Collection_View_Data *pd, + Efl_Ui_Collection_Viewport *viewport) +{ + Efl_Ui_Collection_Request *current = NULL; + unsigned int j; + + for (j = 0; j < viewport->count; j++) + { + Efl_Ui_Collection_Item_Lookup *lookup; + uint64_t index = viewport->offset + j; + + if (viewport->items[j].model) goto check_entity; + + lookup = (void*) eina_rbtree_inline_lookup(pd->cache, &index, + sizeof (index), _cache_tree_lookup, + NULL); + + if (lookup) + { + efl_replace(&viewport->items[j].model, lookup->item.model); + efl_replace(&viewport->items[j].entity, lookup->item.entity); + efl_replace(&lookup->item.entity, NULL); // Necessary to avoid premature release + + pd->cache = eina_rbtree_inline_remove(pd->cache, EINA_RBTREE_GET(lookup), + _cache_tree_cmp, NULL); + _cache_item_free(EINA_RBTREE_GET(lookup), obj); + } + + check_entity: + if (viewport->items[j].entity) continue ; + requests = _request_add(requests, ¤t, index, EINA_TRUE); + } + + // We do break request per viewport, just in case we generate to big batch at once + if (current) requests = eina_list_append(requests, current); + + return requests; +} + +#endif + +// An RbTree has the nice property of sorting content. The smaller than the root being in +// son[1] and the greater than the root in son[0]. Using this we can efficiently walk the +// tree once to take note of all the item that need cleaning. +static void +_mark_lesser(Efl_Ui_Collection_Item_Lookup *root, Eina_Array *mark, const unsigned int lower) +{ + if (!root) return ; + + if (root->index < lower) + { + eina_array_push(mark, root); + _mark_lesser((void*) EINA_RBTREE_GET(root)->son[1], mark, lower); + } + else + { + _mark_lesser((void*) EINA_RBTREE_GET(root)->son[0], mark, lower); + _mark_lesser((void*) EINA_RBTREE_GET(root)->son[1], mark, lower); + } +} + +static void +_mark_ge(Efl_Ui_Collection_Item_Lookup *root, Eina_Array *mark, const unsigned int upper) +{ + if (!root) return ; + + if (root->index >= upper) + { + eina_array_push(mark, root); + _mark_ge((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + _mark_ge((void*) EINA_RBTREE_GET(root)->son[1], mark, upper); + } + else + { + _mark_ge((void*) EINA_RBTREE_GET(root)->son[0], mark, upper); + } +} + +// we walk the tree twice, once for everything below the limit and once for everything above +// then we do free each item individually. +static void +_idle_cb(void *data, const Efl_Event *event EINA_UNUSED) +{ + Efl_Ui_Collection_Item_Lookup *lookup; + Eina_Array mark; + Eina_Array scheduled_release; + MY_DATA_GET(data, pd); + const unsigned int length = pd->current_range.end_id - pd->current_range.start_id; + const unsigned int lower_end = MAX((long)pd->current_range.start_id - (long)length/2, 0); + const unsigned int upper_end = pd->current_range.end_id + length/2; + Eina_Array_Iterator iterator; + unsigned int i; + + eina_array_step_set(&mark, sizeof (Eina_Array), 16); + eina_array_step_set(&scheduled_release, sizeof (Eina_Array), 16); + + _mark_lesser((void*) pd->cache, &mark, lower_end); + _mark_ge((void*) pd->cache, &mark, upper_end); + + EINA_ARRAY_ITER_NEXT(&mark, i, lookup, iterator) + { + pd->cache = (void*) eina_rbtree_inline_remove(pd->cache, + EINA_RBTREE_GET(lookup), + _cache_tree_cmp, NULL); + _item_cleanup(data, pd->factory, &lookup->item, &scheduled_release); + free(lookup); + } + eina_array_flush(&mark); + + efl_ui_factory_release(pd->factory, eina_array_iterator_new(&scheduled_release)); + eina_array_flush(&scheduled_release); + + efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, data); +} + +#ifndef VIEWPORT_ENABLE +static void +_manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev) +{ + Efl_Ui_Position_Manager_Range_Update *event = ev->info; + unsigned int count; + unsigned int lower_end; + unsigned int upper_end; + long length; + Efl_Ui_Collection_Request *request = NULL; + Eina_List *requests = NULL; + unsigned int idx; + MY_DATA_GET(data, pd); + + pd->current_range.start_id = event->start_id; + pd->current_range.end_id = event->end_id; + + count = efl_model_children_count_get(efl_ui_view_model_get(data)); + + length = pd->current_range.end_id - pd->current_range.start_id; + lower_end = MAX((long)pd->current_range.start_id - (length / 2), 0); + upper_end = MIN(pd->current_range.end_id + (length / 2), count); + + idx = lower_end; + while (idx < upper_end) + { + uint64_t search_index = idx; + + requests = _cache_entity_fetch(requests, &request, pd, + search_index, NULL); + + idx++; + } + // Done, but flush request first + if (request) requests = eina_list_append(requests, request); + + requests = _batch_request_flush(requests, data, pd); +} +#endif + +#ifdef VIEWPORT_ENABLE +static void +_manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev) +{ + Efl_Ui_Position_Manager_Range_Update *event = ev->info; + MY_DATA_GET(data, pd); + Eina_List *requests = NULL; + long baseid; + unsigned int delta, marginup, margindown; + uint64_t upperlimit_offset, lowerlimit_offset; + unsigned int i; + + pd->start_id = event->start_id; + pd->end_id = event->end_id; + + delta = pd->end_id - pd->start_id; + + // First time setting up the viewport, so trigger request as we see fit + if (!pd->viewport[0]) + { + baseid = pd->start_id - delta; + + for (i = 0; i < 3; i++) + { + pd->viewport[i] = calloc(1, sizeof (Efl_Ui_Collection_Viewport)); + if (!pd->viewport[i]) continue; + + pd->viewport[i]->offset = MAX(baseid + delta * i, 0); + pd->viewport[i]->count = delta; + pd->viewport[i]->items = calloc(delta, sizeof (Efl_Ui_Collection_Item)); + if (!pd->viewport[i]->items) continue ; + + requests = _viewport_walk_fill(requests, data, pd, pd->viewport[i]); + } + + goto flush_requests; + } + + // Compute limit offset + upperlimit_offset = delta * 3 + pd->viewport[0]->offset; + lowerlimit_offset = 0; + + // Adjust the viewport for size or to much offset change in two step + + // Trying to resize first if there size is in bigger/smaller than 25% of the original size + margindown = delta * 75 / 100; + marginup = delta * 125 / 100; + if (margindown < pd->viewport[0]->count && + pd->viewport[0]->count < marginup) + { + // Trying to do the resize in an optimized way is complex, let's do it simple + Efl_Ui_Collection_Item *items[3]; + unsigned int j = 0, t = 1; + + for (i = 0; i < 3; i++) + { + unsigned int m; + + items[i] = calloc(delta, sizeof (Efl_Ui_Collection_Item)); + if (!items[i]) continue; + + for (m = 0; m < delta && t < 3; m++) + { + items[i][m] = pd->viewport[t]->items[j]; + + j++; + if (j < pd->viewport[t]->count) continue; + + j = 0; + t++; + if (t == 3) break; + } + + // Preserve last updated index to later build a request + if (t == 3) + { + upperlimit_offset = pd->viewport[0]->offset + i * delta + m; + + t = 4; // So that we never come back here again + } + } + + // For now destroy leftover object, could be cached + for (i = t; i < 3; i++) + { + for (; j < pd->viewport[i]->count; j++) + { + _item_cleanup(pd->factory, &pd->viewport[i]->items[j]); + } + j = 0; + } + + // And now define viewport back + for (i = 0; i < 3; i++) + { + free(pd->viewport[i]->items); + pd->viewport[i]->items = items[i]; + pd->viewport[i]->count = delta; + pd->viewport[i]->offset = pd->viewport[0]->offset + delta * i; + } + } + + // We decided that resizing was unecessary + delta = pd->viewport[0]->count; + + // Try to keep the visual viewport in between half of the first and last viewport + + // start_id is in the first half of the first viewport, assume upward move + // start_id + delta is in the second half of the last viewport, assume upward move + if (pd->viewport[0]->offset + delta / 2 < pd->start_id || + pd->start_id + delta > pd->viewport[2]->offset + delta / 2) + { + // We could optimize this to actually just move viewport around in most cases + Efl_Ui_Collection_Item *items[3]; + unsigned int j = 0, t = 0; + uint64_t target, current; + + // Case where are at the top + if (pd->start_id < delta && pd->viewport[0]->offset == 0) goto build_request; + + // Trying to adjust the offset to maintain it in the center viewport +/- delta/2 + baseid = (pd->start_id < delta) ? 0 : pd->start_id - delta; + + // Lookup for starting point + lowerlimit_offset = pd->viewport[0]->offset; + target = baseid; + + // cleanup before target + for (current = pd->viewport[t]->offset; current < target; current++) + { + _item_cleanup(pd->factory, &pd->viewport[t]->items[j]); + + j++; + if (j < pd->viewport[t]->count) continue; + + j = 0; + t++; + if (t == 3) break; + } + + // Allocation and copy + for (i = 0; i < 3; i++) + { + unsigned int m; + + items[i] = calloc(delta, sizeof (Efl_Ui_Collection_Item)); + if (!items[i]) continue; + + for (m = 0; m < delta && t < 3; m++, target++) + { + if (target < pd->viewport[t]->offset) continue ; + items[i][m] = pd->viewport[t]->items[j]; + + j++; + if (j < pd->viewport[t]->count) continue; + + j = 0; + t++; + if (t == 3) break; + } + + // Preserve last updated index to later build a request + if (t == 3) + { + if (upperlimit_offset > pd->viewport[0]->offset + i * delta + m) + { + upperlimit_offset = pd->viewport[0]->offset + i * delta + m; + } + + t = 4; // So that we never come back here again + } + } + + // For now destroy leftover object, could be cached + for (i = t; i < 3; i++) + { + for (; j < pd->viewport[i]->count; j++) + { + _item_cleanup(pd->factory, &pd->viewport[i]->items[j]); + } + j = 0; + } + + // And now define viewport back + for (i = 0; i < 3; i++) + { + free(pd->viewport[i]->items); + pd->viewport[i]->items = items[i]; + pd->viewport[i]->offset = baseid + delta * i; + } + } + + build_request: + // Check if the first viewport has all the lower part of it filled with objects + if (pd->viewport[0]->offset < lowerlimit_offset) + { + Efl_Ui_Collection_Request *request; + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (request) return ; + + request->offset = lowerlimit_offset; + // This length work over multiple viewport as they are contiguous + request->length = lowerlimit_offset - pd->viewport[0]->offset; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + } + + // Check if the last viewport has all the upper part of it filler with objects + if (pd->viewport[2]->offset + pd->viewport[2]->count > upperlimit_offset) + { + Efl_Ui_Collection_Request *request; + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (request) return ; + + request->offset = upperlimit_offset; + // This length work over multiple viewport as they are contiguous + request->length = pd->viewport[2]->offset + pd->viewport[2]->count - upperlimit_offset; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + } + + flush_requests: + requests = _batch_request_flush(requests, data, pd); +} +#endif + +EFL_CALLBACKS_ARRAY_DEFINE(manager_cbs, + { EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_SIZE_CHANGED, _manager_content_size_changed_cb }, + { EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_MIN_SIZE_CHANGED, _manager_content_min_size_changed_cb }, + { EFL_UI_POSITION_MANAGER_ENTITY_EVENT_VISIBLE_RANGE_CHANGED, _manager_content_visible_range_changed_cb } +) + +static void +_item_scroll_internal(Eo *obj EINA_UNUSED, + Efl_Ui_Collection_View_Data *pd, + uint64_t index, + double align EINA_UNUSED, + Eina_Bool anim) +{ + Eina_Rect ipos, view; + Eina_Position2D vpos; + + if (!pd->scroller) return; + + ipos = efl_ui_position_manager_entity_position_single_item(pd->manager, index); + view = efl_ui_scrollable_viewport_geometry_get(pd->scroller); + vpos = efl_ui_scrollable_content_pos_get(pd->scroller); + + ipos.x = ipos.x + vpos.x - view.x; + ipos.y = ipos.y + vpos.y - view.y; + + //FIXME scrollable needs some sort of align, the docs do not even garantee to completly move in the element + efl_ui_scrollable_scroll(pd->scroller, ipos, anim); +} + +// Exported function + +EOLIAN static void +_efl_ui_collection_view_factory_set(Eo *obj EINA_UNUSED, Efl_Ui_Collection_View_Data *pd, + Efl_Ui_Factory *factory) +{ + if (pd->factory) efl_ui_property_bind(pd->factory, "selected", NULL); + efl_replace(&pd->factory, factory); + if (pd->factory) efl_ui_property_bind(pd->factory, "selected", "self.selected"); +} + +EOLIAN static Efl_Ui_Factory * +_efl_ui_collection_view_factory_get(const Eo *obj EINA_UNUSED, Efl_Ui_Collection_View_Data *pd) +{ + return pd->factory; +} + +static void +_unref_cb(void *data) +{ + Eo *obj = data; + + efl_unref(obj); +} + +EOLIAN static void +_efl_ui_collection_view_position_manager_set(Eo *obj, Efl_Ui_Collection_View_Data *pd, + Efl_Ui_Position_Manager_Entity *manager) +{ + Efl_Model *model; + unsigned int count; + + if (manager) + EINA_SAFETY_ON_FALSE_RETURN(efl_isa(manager, EFL_UI_POSITION_MANAGER_ENTITY_INTERFACE)); + + if (pd->manager) + { + efl_event_callback_array_del(pd->manager, manager_cbs(), obj); + efl_del(pd->manager); + } + pd->manager = manager; + if (!pd->manager) return; + + // Start watching change on model from here on + model = pd->model; + count = model ? efl_model_children_count_get(model) : 0; + + efl_parent_set(pd->manager, obj); + efl_event_callback_array_add(pd->manager, manager_cbs(), obj); + switch(efl_ui_position_manager_entity_version(pd->manager, 1)) + { + case 1: + efl_ui_position_manager_data_access_v1_data_access_set(pd->manager, + efl_ref(obj), _batch_entity_cb, _unref_cb, + efl_ref(obj), _batch_size_cb, _unref_cb, + count); + break; + } + + if (efl_finalized_get(obj)) + efl_ui_position_manager_entity_viewport_set(pd->manager, efl_ui_scrollable_viewport_geometry_get(obj)); + efl_ui_layout_orientation_set(pd->manager, pd->direction); +} + +EOLIAN static Efl_Ui_Position_Manager_Entity * +_efl_ui_collection_view_position_manager_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Collection_View_Data *pd) +{ + return pd->manager; +} + +static void +_efl_model_count_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) +{ + // We are not triggering efl_ui_position_manager_entity_data_access_set as it is can + // only be slow, we rely on child added/removed instead (If we were to not rely on + // child added/removed we could maybe use count changed) +} + +static void +_efl_model_properties_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) +{ + // We could here watch if the global base size item change and notify of a global change + // But I can not find a proper way to do it for the object that are not visible, which + // is kind of the point... +} + +static void +_cache_cleanup_above(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_View_Data *pd, unsigned int index) +{ + Efl_Ui_Collection_Item_Lookup *lookup; + Eina_Array scheduled_release; + Eina_Array mark; + Eina_Array_Iterator iterator; + unsigned int i; + + eina_array_step_set(&mark, sizeof (Eina_Array), 16); + eina_array_step_set(&scheduled_release, sizeof (Eina_Array), 16); + + _mark_ge((void*) pd->cache, &mark, index); + + EINA_ARRAY_ITER_NEXT(&mark, i, lookup, iterator) + { + pd->cache = (void*) eina_rbtree_inline_remove(pd->cache, + EINA_RBTREE_GET(lookup), + _cache_tree_cmp, NULL); + _item_cleanup(obj, pd->factory, &lookup->item, &scheduled_release); + free(lookup); + } + eina_array_flush(&mark); + + efl_ui_factory_release(pd->factory, eina_array_iterator_new(&scheduled_release)); + eina_array_flush(&scheduled_release); +} + +static void +_efl_model_child_added(void *data, const Efl_Event *event) +{ + // At the moment model only append child, but let's try to handle it theorically correct + Efl_Model_Children_Event *ev = event->info; + MY_DATA_GET(data, pd); +#ifdef VIEWPORT_ENABLE + Eina_List *requests = NULL; + unsigned int i; +#endif + + _cache_cleanup_above(data, pd, ev->index); + + // Check if we really have something to do +#ifdef VIEWPORT_ENABLE + if (!pd->viewport[0]) goto notify_manager; + + // Insert the child in the viewport if necessary + for (i = 0; i < 3; i++) + { + Efl_Ui_Collection_Request *request; + unsigned int o; + unsigned int j; + + if (ev->index < pd->viewport[i]->offset) + { + pd->viewport[i]->offset++; + continue; + } + if (pd->viewport[i]->offset + pd->viewport[i]->count < ev->index) + { + continue; + } + + for (j = 2; j > i; j--) + { + _item_cleanup(pd->factory, &pd->viewport[j]->items[pd->viewport[j]->count - 1]); + memmove(&pd->viewport[j]->items[1], + &pd->viewport[j]->items[0], + (pd->viewport[j]->count - 1) * sizeof (Efl_Ui_Collection_Item)); + pd->viewport[j]->items[0] = pd->viewport[j - 1]->items[pd->viewport[j - 1]->count - 1]; + pd->viewport[j - 1]->items[pd->viewport[j - 1]->count - 1].entity = NULL; + pd->viewport[j - 1]->items[pd->viewport[j - 1]->count - 1].model = NULL; + } + o = ev->index - pd->viewport[i]->offset; + memmove(&pd->viewport[j]->items[o], + &pd->viewport[j]->items[o + 1], + (pd->viewport[j]->count - 1 - o) * sizeof (Efl_Ui_Collection_Item)); + pd->viewport[j]->items[o].entity = NULL; + pd->viewport[j]->items[o].model = efl_ref(ev->child); + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!request) break; + request->offset = ev->index; + request->length = 1; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + + requests = _batch_request_flush(requests, data, pd); + + break; + } + + notify_manager: +#endif + // FIXME this function must be called with an entity + efl_ui_position_manager_entity_item_added(pd->manager, ev->index, NULL); +} + +static void +_efl_model_child_removed(void *data, const Efl_Event *event) +{ + Efl_Model_Children_Event *ev = event->info; + MY_DATA_GET(data, pd); + Eina_List *requests = NULL; + Efl_Ui_Collection_Request *request = NULL; +#ifdef VIEWPORT_ENABLE + Eina_List *requests = NULL; + unsigned int i; +#endif + unsigned int upper_end; + long length; + unsigned int count; + + // FIXME: later optimization, instead of reloading everyone, we could actually track index and self + // update would be more efficient, but it is also more tricky + _cache_cleanup_above(data, pd, ev->index); + + count = efl_model_children_count_get(event->object); + length = pd->current_range.end_id - pd->current_range.start_id; + upper_end = MIN(pd->current_range.end_id + (length / 2), count); + + // Check if we really have something to do +#ifdef VIEWPORT_ENABLE + if (!pd->viewport[0]) goto notify_manager; + + // Insert the child in the viewport if necessary + for (i = 0; i < 3; i++) + { + Efl_Ui_Collection_Request *request; + unsigned int o; + + if (ev->index < pd->viewport[i]->offset) + { + pd->viewport[i]->offset--; + continue; + } + if (pd->viewport[i]->offset + pd->viewport[i]->count < ev->index) + { + continue; + } + + o = ev->index - pd->viewport[i]->offset; + _item_cleanup(pd->factory, &pd->viewport[i]->items[o]); + for (; i < 3; i++) + { + memmove(&pd->viewport[i]->items[o], + &pd->viewport[i]->items[o + 1], + (pd->viewport[i]->count - 1 - o) * sizeof (Efl_Ui_Collection_Item)); + if (i + 1 < 3) + { + pd->viewport[i]->items[pd->viewport[i]->count - 1] = pd->viewport[i + 1]->items[0]; + } + else + { + pd->viewport[i]->items[pd->viewport[i]->count - 1].entity = NULL; + pd->viewport[i]->items[pd->viewport[i]->count - 1].model = NULL; + } + o = 0; + } + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!request) break; + request->offset = pd->viewport[2]->offset + pd->viewport[i]->count - 1; + request->length = 1; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + + requests = _batch_request_flush(requests, data, pd); + + break; + } + + notify_manager: +#endif + requests = _request_add(requests, &request, ev->index, EINA_TRUE); + request->length = upper_end - ev->index; + + if (request->length > 0) + { + requests = eina_list_append(requests, request); + requests = _batch_request_flush(requests, data, pd); + } + + efl_ui_position_manager_entity_item_removed(pd->manager, ev->index, NULL); +} + +EFL_CALLBACKS_ARRAY_DEFINE(model_cbs, + { EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _efl_model_count_changed }, + { EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_properties_changed }, + { EFL_MODEL_EVENT_CHILD_ADDED, _efl_model_child_added }, + { EFL_MODEL_EVENT_CHILD_REMOVED, _efl_model_child_removed }) + +static void +_efl_ui_collection_view_model_changed(void *data, const Efl_Event *event) +{ + Efl_Model_Changed_Event *ev = event->info; + Eina_List *requests = NULL; + MY_DATA_GET(data, pd); + Eina_Iterator *it; + const char *property; + Efl_Model *model = NULL; + unsigned int count; + Efl_Model *mselect = NULL; + Eina_Bool selection = EINA_FALSE, sizing = EINA_FALSE; + + if (ev->previous) efl_event_callback_array_del(ev->previous, model_cbs(), data); + if (ev->current) efl_event_callback_array_add(ev->current, model_cbs(), data); + + // Cleanup all object, pending request and refetch everything + _all_cleanup(data, pd); + + efl_replace(&pd->model, NULL); + + if (!ev->current) + { + if (pd->multi_selectable_async_model) + { + efl_event_callback_forwarder_del(pd->multi_selectable_async_model, + EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, + data); + efl_composite_detach(data, pd->multi_selectable_async_model); + efl_replace(&pd->multi_selectable_async_model, NULL); + } + return ; + } + + it = efl_model_properties_get(ev->current); + EINA_ITERATOR_FOREACH(it, property) + { + // Check if the model provide selection + if (eina_streq(property, "child.selected")) + selection = EINA_TRUE; + // Check if the model provide sizing logic + else if (eina_streq(property, _efl_model_property_itemw) || + eina_streq(property, _efl_model_property_itemh)) + sizing = EINA_TRUE; + } + eina_iterator_free(it); + + if (selection) + { + // Search the composition of model for the one providing MULTI_SELECTABLE_ASYNC + mselect = ev->current; + while (mselect && + !efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE) && + efl_isa(mselect, EFL_COMPOSITE_MODEL_CLASS)) + mselect = efl_ui_view_model_get(mselect); + + if (!efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE)) + { + mselect = NULL; + selection = EINA_FALSE; + } + } + + // Try to build the minimal chain of necessary model for collection view + model = ev->current; + + // Build and connect the selection model properly + if (!mselect) + { + mselect = model = efl_add(EFL_UI_SELECT_MODEL_CLASS, data, + efl_ui_view_model_set(efl_added, model)); + } + if (pd->multi_selectable_async_model) + { + efl_event_callback_forwarder_del(pd->multi_selectable_async_model, + EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, + data); + efl_composite_detach(data, pd->multi_selectable_async_model); + } + efl_replace(&pd->multi_selectable_async_model, mselect); + efl_composite_attach(data, pd->multi_selectable_async_model); + efl_event_callback_forwarder_add(pd->multi_selectable_async_model, + EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, + data); + + if (!sizing) model = efl_add(EFL_UI_HOMOGENEOUS_MODEL_CLASS, data, + efl_ui_view_model_set(efl_added, model)); + + count = efl_model_children_count_get(model); + +#ifdef VIEWPORT_ENABLE + for (i = 0; i < 3; i++) + { + Efl_Ui_Collection_Request *request; + + if (!pd->viewport[i]) continue ; + if (pd->viewport[i]->count == 0) continue ; + + request = calloc(1, sizeof (Efl_Ui_Collection_Request)); + if (!request) continue ; + + request->offset = pd->viewport[i]->offset; + request->length = pd->viewport[i]->count; + request->model_requested = EINA_TRUE; + request->need_entity = EINA_TRUE; + + requests = eina_list_append(requests, request); + } +#endif + requests = _batch_request_flush(requests, data, pd); + + pd->model = model; + efl_ui_position_manager_entity_item_size_changed(pd->manager, 0, count - 1); + switch(efl_ui_position_manager_entity_version(pd->manager, 1)) + { + case 1: + efl_ui_position_manager_data_access_v1_data_access_set(pd->manager, + efl_ref(data), _batch_entity_cb, _unref_cb, + efl_ref(data), _batch_size_cb, _unref_cb, + count); + break; + } + + +} + +static void +_pan_viewport_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED) +{ + MY_DATA_GET(data, pd); + Eina_Rect rect = efl_ui_scrollable_viewport_geometry_get(data); + + efl_ui_position_manager_entity_viewport_set(pd->manager, rect); +} + +static void +_pan_position_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED) +{ + MY_DATA_GET(data, pd); + Eina_Position2D pos = efl_ui_pan_position_get(pd->pan); + Eina_Position2D max = efl_ui_pan_position_max_get(pd->pan); + Eina_Vector2 rpos = {0.0, 0.0}; + + if (max.x > 0.0) + rpos.x = (double)pos.x/(double)max.x; + if (max.y > 0.0) + rpos.y = (double)pos.y/(double)max.y; + + efl_ui_position_manager_entity_scroll_position_set(pd->manager, rpos.x, rpos.y); +} + +EFL_CALLBACKS_ARRAY_DEFINE(pan_events_cb, + {EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, _pan_position_changed_cb}, + {EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _pan_viewport_changed_cb}, + {EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _pan_viewport_changed_cb}, +) + +EOLIAN static Efl_Object * +_efl_ui_collection_view_efl_object_constructor(Eo *obj, Efl_Ui_Collection_View_Data *pd) +{ + pd->direction = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; + obj = efl_constructor(efl_super(obj, EFL_UI_COLLECTION_VIEW_CLASS)); + + if (!elm_widget_theme_klass_get(obj)) + elm_widget_theme_klass_set(obj, "collection"); + + efl_wref_add(efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(obj)), &pd->sizer); + efl_gfx_color_set(pd->sizer, 0, 0, 0, 0); + + efl_wref_add(efl_add(EFL_UI_PAN_CLASS, obj), &pd->pan); + efl_content_set(pd->pan, pd->sizer); + efl_event_callback_array_add(pd->pan, pan_events_cb(), obj); + + efl_wref_add(efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj), &pd->scroller); + efl_composite_attach(obj, pd->scroller); + efl_ui_mirrored_set(pd->scroller, efl_ui_mirrored_get(obj)); + efl_ui_scroll_manager_pan_set(pd->scroller, pd->pan); + + efl_ui_scroll_connector_bind(obj, pd->scroller); + + efl_event_callback_add(obj, EFL_UI_VIEW_EVENT_MODEL_CHANGED, + _efl_ui_collection_view_model_changed, obj); + + return obj; +} + +EOLIAN static void +_efl_ui_collection_view_efl_object_invalidate(Eo *obj, + Efl_Ui_Collection_View_Data *pd) +{ + efl_ui_collection_view_position_manager_set(obj, NULL); + efl_event_callback_del(obj, EFL_UI_VIEW_EVENT_MODEL_CHANGED, + _efl_ui_collection_view_model_changed, obj); + + _all_cleanup(obj, pd); + + efl_invalidate(efl_super(obj, EFL_UI_COLLECTION_VIEW_CLASS)); +} + +EOLIAN static void +_efl_ui_collection_view_efl_ui_layout_orientable_orientation_set(Eo *obj EINA_UNUSED, + Efl_Ui_Collection_View_Data *pd, + Efl_Ui_Layout_Orientation dir) +{ + if (pd->direction == dir) return; + + pd->direction = dir; + if (pd->manager) efl_ui_layout_orientation_set(pd->manager, dir); +} + +EOLIAN static Efl_Ui_Layout_Orientation +_efl_ui_collection_view_efl_ui_layout_orientable_orientation_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Collection_View_Data *pd) +{ + return pd->direction; +} + +EOLIAN static Eina_Error +_efl_ui_collection_view_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Collection_View_Data *pd) +{ + Eina_Error res; + + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_ERROR_GENERIC); + res = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); + if (res == EFL_UI_THEME_APPLY_ERROR_GENERIC) return res; + efl_ui_mirrored_set(pd->scroller, efl_ui_mirrored_get(obj)); + efl_content_set(efl_part(wd->resize_obj, "efl.content"), pd->pan); + + return res; +} + +EOLIAN static void +_efl_ui_collection_view_efl_ui_scrollable_match_content_set(Eo *obj, Efl_Ui_Collection_View_Data *pd, Eina_Bool w, Eina_Bool h) +{ + if (pd->match_content.w == w && pd->match_content.h == h) + return; + + pd->match_content.w = w; + pd->match_content.h = h; + + efl_ui_scrollable_match_content_set(pd->scroller, w, h); + flush_min_size(obj, pd); +} + +EOLIAN static Efl_Ui_Focus_Manager * +_efl_ui_collection_view_efl_ui_widget_focus_manager_focus_manager_create(Eo *obj, Efl_Ui_Collection_View_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *root) +{ + Efl_Ui_Collection_View_Focus_Manager_Data *mpd; + Eo *manager = efl_add(EFL_UI_COLLECTION_VIEW_FOCUS_MANAGER_CLASS, obj, + efl_ui_focus_manager_root_set(efl_added, root)); + + mpd = efl_data_scope_get(manager, EFL_UI_COLLECTION_VIEW_FOCUS_MANAGER_CLASS); + mpd->collection = obj; + + return manager; +} + +EOLIAN static Efl_Ui_Focus_Object * +_efl_ui_collection_view_efl_ui_focus_manager_move(Eo *obj, Efl_Ui_Collection_View_Data *pd, Efl_Ui_Focus_Direction direction) +{ + Eo *new_obj, *focus; + Eina_Size2D step; + + new_obj = efl_ui_focus_manager_move(efl_super(obj, MY_CLASS), direction); + focus = efl_ui_focus_manager_focus_get(obj); + step = efl_gfx_hint_size_combined_min_get(focus); + if (!new_obj) + { + Eina_Rect pos = efl_gfx_entity_geometry_get(focus); + Eina_Rect view = efl_ui_scrollable_viewport_geometry_get(pd->scroller); + Eina_Position2D vpos = efl_ui_scrollable_content_pos_get(pd->scroller); + + pos.x = pos.x + vpos.x - view.x; + pos.y = pos.y + vpos.y - view.y; + Eina_Position2D max = efl_ui_pan_position_max_get(pd->pan); + + if (direction == EFL_UI_FOCUS_DIRECTION_RIGHT) + { + if (pos.x < max.x) + { + pos.x = MIN(max.x, pos.x + step.w); + efl_ui_scrollable_scroll(obj, pos, EINA_TRUE); + new_obj = focus; + } + } + else if (direction == EFL_UI_FOCUS_DIRECTION_LEFT) + { + if (pos.x > 0) + { + pos.x = MAX(0, pos.x - step.w); + efl_ui_scrollable_scroll(obj, pos, EINA_TRUE); + new_obj = focus; + } + } + else if (direction == EFL_UI_FOCUS_DIRECTION_UP) + { + if (pos.y > 0) + { + pos.y = MAX(0, pos.y - step.h); + efl_ui_scrollable_scroll(obj, pos, EINA_TRUE); + new_obj = focus; + } + } + else if (direction == EFL_UI_FOCUS_DIRECTION_DOWN) + { + if (pos.y < max.y) + { + pos.y = MAX(0, pos.y + step.h); + efl_ui_scrollable_scroll(obj, pos, EINA_TRUE); + new_obj = focus; + } + } + } + else + { + Efl_Model *model; + Eina_Value *vindex; + uint64_t index; + + model = efl_ui_view_model_get(new_obj); + vindex = efl_model_property_get(model, "child.index"); + if (eina_value_uint64_convert(vindex, &index)) + _item_scroll_internal(obj, pd, index, .0, EINA_TRUE); + eina_value_free(vindex); + } + + return new_obj; +} + +#include "efl_ui_collection_view.eo.c" + +#define ITEM_IS_OUTSIDE_VISIBLE(id) id < cpd->start_id || id > cpd->end_id + +static Efl_Ui_Item * +_find_item(Eo *obj EINA_UNUSED, Efl_Ui_Collection_View_Data *pd EINA_UNUSED, Eo *focused_element) +{ + if (!focused_element) return NULL; + + while (focused_element && + efl_key_data_get(focused_element, COLLECTION_VIEW_MANAGED) != COLLECTION_VIEW_MANAGED_YES) + { + focused_element = efl_ui_widget_parent_get(focused_element); + } + + return focused_element; +} + +static inline void +_assert_item_available(Eo *item, int new_id, Efl_Ui_Collection_View_Data *pd) +{ + efl_gfx_entity_visible_set(item, EINA_TRUE); + efl_gfx_entity_geometry_set(item, efl_ui_position_manager_entity_position_single_item(pd->manager, new_id)); +} +EOLIAN static void +_efl_ui_collection_view_focus_manager_efl_ui_focus_manager_manager_focus_set(Eo *obj, Efl_Ui_Collection_View_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *focus) +{ + MY_DATA_GET(pd->collection, cpd); + Efl_Ui_Item *item = NULL; + uint64_t item_id; + + if (focus == efl_ui_focus_manager_root_get(obj)) + { + // Find last item + item_id = efl_model_children_count_get(cpd->model) - 1; + } + else + { + Efl_Model *model; + Eina_Value *vindex; + + item = _find_item(obj, cpd, focus); + if (!item) return ; + + model = efl_ui_view_model_get(item); + vindex = efl_model_property_get(model, "child.index"); + if (!eina_value_uint64_convert(vindex, &item_id)) return; + eina_value_free(vindex); + } + + // If this is NULL then we are before finalize, we cannot serve any sane value here + if (!cpd->manager) return ; + + if (ITEM_IS_OUTSIDE_VISIBLE(item_id)) + { + _assert_item_available(item, item_id, cpd); + } + efl_ui_focus_manager_focus_set(efl_super(obj, EFL_UI_COLLECTION_VIEW_FOCUS_MANAGER_CLASS), focus); +} + +EOLIAN static Efl_Ui_Focus_Object * +_efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, Efl_Ui_Collection_View_Focus_Manager_Data *pd, Efl_Ui_Focus_Direction direction, Efl_Ui_Focus_Object *child, Eina_Bool logical) +{ + MY_DATA_GET(pd->collection, cpd); + Efl_Ui_Item *new_item, *item; + unsigned int item_id; + + if (!child) + child = efl_ui_focus_manager_focus_get(obj); + + item = _find_item(obj, cpd, child); + + //if this is NULL then we are before finalize, we cannot serve any sane value here + if (!cpd->manager) return NULL; + if (!item) return NULL; + + item_id = efl_ui_item_index_get(item); + + if (ITEM_IS_OUTSIDE_VISIBLE(item_id)) + { + int new_id; + + new_id = efl_ui_position_manager_entity_relative_item(cpd->manager, + efl_ui_item_index_get(item), + direction); + if (new_id == -1) + { + new_item = NULL; + } + else + { +#ifdef VIEWPORT_ENABLE + unsigned int i; + + for (i = 0; i < 3; i++) + { + if (!cpd->viewport[i]) continue; + + if (!((cpd->viewport[i]->offset <= (unsigned int) new_id) && + ((unsigned int) new_id < cpd->viewport[i]->offset + cpd->viewport[i]->count))) + continue; + + new_item = cpd->viewport[i]->items[new_id - cpd->viewport[i]->offset].entity; + // We shouldn't get in a case where the available item is NULL + if (!new_item) break; // Just in case + _assert_item_available(new_item, new_id, cpd); + } +#endif + } + } + else + { + new_item = efl_ui_focus_manager_request_move(efl_super(obj, EFL_UI_COLLECTION_VIEW_FOCUS_MANAGER_CLASS), direction, child, logical); + } + + return new_item; +} + +#include "efl_ui_collection_view_focus_manager.eo.c" diff --git a/src/lib/elementary/efl_ui_collection_view.eo b/src/lib/elementary/efl_ui_collection_view.eo new file mode 100644 index 0000000000..d0efbf347a --- /dev/null +++ b/src/lib/elementary/efl_ui_collection_view.eo @@ -0,0 +1,61 @@ +class @beta Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements + Efl.Ui.Layout_Orientable, + Efl.Ui.Selectable, + Efl.Ui.Multi_Selectable_Async, + Efl.Ui.Focus.Manager_Sub, + Efl.Ui.Widget_Focus_Manager, + Efl.Ui.Collection_Events + composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar, Efl.Ui.Multi_Selectable_Async +{ + [[This widget displays a list of items in an arrangement controlled by an external @.position_manager + object. By using different @.position_manager objects this widget can show unidimensional lists or + two-dimensional grids of items, for example. + + This class is intended to act as a base for widgets like List_View or Grid_View, + which hide this complexity from the user. + + Items are generated by the @Efl.Ui.Factory defined with .factory.set to match the content of the + @Efl.Model defined with @Efl.Ui.View.model.set. They are dynamically created/destroyed to only have + the one that are necessary to display all the one that are to far out of the viewport will not be + created to lighten the usage for very large list. + + The direction of the arrangement can be controlled through @Efl.Ui.Layout_Orientable.orientation. + + If all items do not fit in the current widget size scrolling facilities are provided. + + Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable_Async.select_mode + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Async.selected_iterator_new. + ]] + methods { + @property factory { + [[Define the factory used to create all the items.]] + get {} + set {} + values { + factory: Efl.Ui.Factory; [[The factory.]] + } + } + @property position_manager { + [[Position manager object that handles placement of items.]] + values { + position_manager : Efl.Ui.Position_Manager.Entity @move; [[The objects ownership is passed to the item container.]] + } + } + } + implements { + Efl.Object.constructor; + Efl.Object.invalidate; + + Efl.Ui.Layout_Orientable.orientation { get; set; } + + Efl.Ui.Widget.theme_apply; + + Efl.Ui.Scrollable.match_content { set; } + Efl.Ui.Widget_Focus_Manager.focus_manager_create; + Efl.Ui.Focus.Manager.move; + } + events { + item,realized : Efl.Ui.Item; [[Event triggered when an @Efl.Ui.Item has been provided by the @Efl.Ui.Factory and is about to be used.]] + item,unrealized : Efl.Ui.Item; [[Event triggered when the @Efl.Ui.Collection_View is about to give an @Efl.Ui.Item back to the @Efl.Ui.Factory.]] + } +} diff --git a/src/lib/elementary/efl_ui_collection_view_focus_manager.eo b/src/lib/elementary/efl_ui_collection_view_focus_manager.eo new file mode 100644 index 0000000000..bd4e27727b --- /dev/null +++ b/src/lib/elementary/efl_ui_collection_view_focus_manager.eo @@ -0,0 +1,7 @@ +class @beta Efl.Ui.Collection_View_Focus_Manager extends Efl.Ui.Focus.Manager_Calc { + [[Internal class which implements collection specific behaviour, cannot be used outside of collection]] + implements { + Efl.Ui.Focus.Manager.manager_focus { set; } + Efl.Ui.Focus.Manager.request_move; + } +} diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c index b454555497..7cdfe16424 100644 --- a/src/lib/elementary/efl_ui_item.c +++ b/src/lib/elementary/efl_ui_item.c @@ -208,6 +208,29 @@ _efl_ui_item_item_parent_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd) return pd->parent; } +EOLIAN static void +_efl_ui_item_calc_locked_set(Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd, Eina_Bool locked) +{ + pd->locked = !!locked; +} + +EOLIAN static Eina_Bool +_efl_ui_item_calc_locked_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd) +{ + return pd->locked; +} + +EOLIAN static void +_efl_ui_item_efl_canvas_group_group_need_recalculate_set(Eo *obj, Efl_Ui_Item_Data *pd EINA_UNUSED, Eina_Bool value) +{ + // Prevent recalc when the item are stored in the cache + // As due to async behavior, we can still have text updated from future that just finished after + // we have left the releasing stage of factories. This is the simplest way to prevent those later + // update. + if (pd->locked) return; + efl_canvas_group_need_recalculate_set(efl_super(obj, EFL_UI_ITEM_CLASS), value); +} + ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_item, Efl_Ui_Item_Data) #include "efl_ui_item.eo.c" diff --git a/src/lib/elementary/efl_ui_item.eo b/src/lib/elementary/efl_ui_item.eo index 0e841f5df9..9f05b1ea1f 100644 --- a/src/lib/elementary/efl_ui_item.eo +++ b/src/lib/elementary/efl_ui_item.eo @@ -54,6 +54,17 @@ abstract Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectable, Ef parent : Efl.Ui.Item; } } + @property calc_locked { + [[If the item has its calc locked it will not trigger @Efl.Canvas.Group.group_need_recalculate.set done. + + This is done automatically by @Efl.Ui.Widget_Factory, but you can use this information to meaningfully set the hint when items are not @.calc_locked. + ]] + set {} + get {} + values { + locked: bool; [[If set to $true, no more @Efl.Canvas.Group.group_need_recalculate.set]] + } + } } implements { Efl.Object.constructor; @@ -61,5 +72,6 @@ abstract Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectable, Ef Efl.Object.destructor; Efl.Ui.Selectable.selected {get; set;} Efl.Ui.Widget.widget_input_event_handler; + Efl.Canvas.Group.group_need_recalculate { set; } } } diff --git a/src/lib/elementary/efl_ui_item_private.h b/src/lib/elementary/efl_ui_item_private.h index cd8300b6a2..5c1ef268bf 100644 --- a/src/lib/elementary/efl_ui_item_private.h +++ b/src/lib/elementary/efl_ui_item_private.h @@ -11,6 +11,7 @@ typedef struct _Efl_Ui_Item_Data // Boolean Data Eina_Bool selected : 1; /* State for item selected */ + Eina_Bool locked : 1; } Efl_Ui_Item_Data; diff --git a/src/lib/elementary/efl_ui_position_manager_list.c b/src/lib/elementary/efl_ui_position_manager_list.c index cee6730137..0adb498322 100644 --- a/src/lib/elementary/efl_ui_position_manager_list.c +++ b/src/lib/elementary/efl_ui_position_manager_list.c @@ -36,6 +36,14 @@ typedef struct { * Every other walk of the items is at max the maximum number of items you get into the maximum distance between the average item size and a actaul item size. */ +static void +cache_invalidate(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd) +{ + if (pd->size_cache) + free(pd->size_cache); + pd->size_cache = NULL; +} + static void cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd) { @@ -82,19 +90,15 @@ cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd) } pd->size_cache[i + 1] = pd->size_cache[i] + step; pd->maximum_min_size = MAX(pd->maximum_min_size, min); + /* no point iterating further if size calc can't be done yet */ + //if ((!i) && (!pd->maximum_min_size)) break; } pd->average_item_size = pd->size_cache[pd->size]/pd->size; + if ((!pd->average_item_size) && (!pd->maximum_min_size)) + cache_invalidate(obj, pd); } -static void -cache_invalidate(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd) -{ - if (pd->size_cache) - free(pd->size_cache); - pd->size_cache = NULL; -} - -static inline int +static int cache_access(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, unsigned int idx) { EINA_SAFETY_ON_FALSE_RETURN_VAL(idx <= pd->size, 0); @@ -105,7 +109,12 @@ static void recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd) { Eina_Size2D min_size = EINA_SIZE2D(-1, -1); + Eina_Size2D pabs_size = pd->abs_size; + int pmin_size = pd->maximum_min_size; + cache_require(obj, pd); + /* deferred */ + if (!pd->size_cache) return; pd->abs_size = pd->viewport.size; @@ -116,8 +125,8 @@ recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd) else pd->abs_size.w = MAX(cache_access(obj, pd, pd->size), pd->abs_size.w); } - - efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_SIZE_CHANGED, &pd->abs_size); + if ((pabs_size.w != pd->abs_size.w) || (pabs_size.h != pd->abs_size.h)) + efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_SIZE_CHANGED, &pd->abs_size); if (pd->dir == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) { @@ -127,8 +136,8 @@ recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd) { min_size.h = pd->maximum_min_size; } - - efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_MIN_SIZE_CHANGED, &min_size); + if ((pd->maximum_min_size > 0) && (pmin_size > 0) && (pd->maximum_min_size != pmin_size)) + efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_MIN_SIZE_CHANGED, &min_size); } static inline Vis_Segment diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 6835688c52..d98ee78fa1 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -5816,8 +5816,6 @@ _efl_ui_property_bind_get(Eo *obj, Efl_Ui_Widget_Data *pd, Efl_Ui_Property_Bound value = efl_model_property_get(pd->properties.model, prop->property); target = prop->part ? efl_part(obj, prop->part) : obj; - fprintf(stderr, "setting: %s for %s from %s\n", - eina_value_to_string(value), prop->property, efl_debug_name_get(pd->properties.model)); err = efl_property_reflection_set(target, prop->key, eina_value_reference_copy(value)); eina_value_free(value); diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index 0be3e302d2..b1c339d4bc 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -95,6 +95,9 @@ _efl_ui_widget_factory_constructing(void *data EINA_UNUSED, const Efl_Event *ev) model = efl_ui_view_model_get(ui_view); + // Enable recalculate in case we do not know the size of the item + efl_canvas_group_need_recalculate_set(ui_view, EINA_TRUE); + // Fetch min size from model if available to avoid recalculcating it width = efl_model_property_get(model, "self.width"); height = efl_model_property_get(model, "self.height"); @@ -106,12 +109,14 @@ _efl_ui_widget_factory_constructing(void *data EINA_UNUSED, const Efl_Event *ev) if (!eina_value_int_convert(width, &s.w)) s.w = 0; if (!eina_value_int_convert(height, &s.h)) s.h = 0; - /* efl_event_freeze(ui_view); */ - efl_key_data_set(ui_view, "efl.ui.widget.factory.size_set", (void*)EINA_TRUE); efl_gfx_hint_size_min_set(ui_view, s); + efl_canvas_group_need_recalculate_set(ui_view, EINA_FALSE); + if (efl_isa(ui_view, EFL_UI_ITEM_CLASS)) efl_ui_item_calc_locked_set(ui_view, EINA_TRUE); } eina_value_free(width); eina_value_free(height); + + efl_key_data_set(ui_view, "efl.ui.widget.factory.size_check", (void*)EINA_TRUE); } @@ -121,7 +126,7 @@ _efl_ui_widget_factory_building(void *data, const Efl_Event *ev) Efl_Gfx_Entity *ui_view = ev->info; Efl_Ui_Widget_Factory_Data *pd = data; const Efl_Model *model; - Eina_Value *property, *width, *height; + Eina_Value *property; Efl_Ui_Bind_Part_Data *bpd; Eina_Iterator *it; char *style; @@ -146,22 +151,6 @@ _efl_ui_widget_factory_building(void *data, const Efl_Event *ev) } eina_iterator_free(it); - // Fetch min size from model if available to avoid recalculcating it - width = efl_model_property_get(model, "self.width"); - height = efl_model_property_get(model, "self.height"); - if (eina_value_type_get(width) != EINA_VALUE_TYPE_ERROR && - eina_value_type_get(height) != EINA_VALUE_TYPE_ERROR) - { - Eina_Size2D s; - - if (!eina_value_int_convert(width, &s.w)) s.w = 0; - if (!eina_value_int_convert(height, &s.h)) s.h = 0; - - efl_gfx_hint_size_min_set(ui_view, s); - } - eina_value_free(width); - eina_value_free(height); - // As we have already waited for the property to be ready, we should get the right style now if (!pd->style) return ; @@ -173,6 +162,8 @@ _efl_ui_widget_factory_building(void *data, const Efl_Event *ev) free(style); eina_value_free(property); + + efl_key_data_set(ui_view, "efl.ui.widget.factory.cached", NULL); } static void @@ -185,6 +176,7 @@ _efl_ui_widget_factory_releasing(void *data, const Efl_Event *ev) efl_key_data_set(ui_view, "efl.ui.widget.factory.size_set", NULL); efl_key_data_set(ui_view, "efl.ui.widget.factory.size_check", NULL); + if (efl_isa(ui_view, EFL_UI_ITEM_CLASS)) efl_ui_item_calc_locked_set(ui_view, EINA_TRUE); // Bind all property before the object is finalize it = eina_hash_iterator_data_new(pd->parts); @@ -200,6 +192,9 @@ _efl_ui_widget_factory_releasing(void *data, const Efl_Event *ev) eina_iterator_free(it); efl_ui_view_model_set(ui_view, NULL); + + // Prevent any recalc to happen when an object is in the cache or during shutdown of the object + efl_canvas_group_need_recalculate_set(ui_view, EINA_FALSE); } EFL_CALLBACKS_ARRAY_DEFINE(item_callbacks, diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index f1b959b69f..f7223ae6b4 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -165,6 +165,7 @@ # include "efl_ui_focus_parent_provider_standard.eo.h" # include "efl_ui_selection_manager.eo.h" # include "efl_datetime_manager.eo.h" + extern const char *_efl_model_property_itemw; extern const char *_efl_model_property_itemh; extern const char *_efl_model_property_selfw; diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 5ef2b05be1..2e48c5a39a 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -186,6 +186,8 @@ pub_eo_files = [ 'efl_ui_tab_bar_default_item.eo', 'efl_ui_select_model.eo', 'efl_ui_view_model.eo', + 'efl_ui_collection_view.eo', + 'efl_ui_collection_view_focus_manager.eo', ] foreach eo_file : pub_eo_files @@ -947,6 +949,7 @@ elementary_src = [ 'efl_ui_tab_bar_default_item.c', 'efl_ui_select_model.c', 'efl_ui_view_model.c', + 'efl_ui_collection_view.c', ] elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl] From 78b69d45b57ce43ac0373a4f10ac548a3a458dbf Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Thu, 19 Sep 2019 11:19:56 -0700 Subject: [PATCH 024/115] elementary: migrate Efl.Ui.List_View to use Efl.Ui.Collection_View. Differential Revision: https://phab.enlightenment.org/D10035 --- .../elementary/efl_ui_list_view_example_1.c | 38 +- .../elementary/efl_ui_list_view_example_2.c | 3 +- .../elementary/efl_ui_list_view_example_3.c | 54 +- src/lib/elementary/Efl_Ui.h | 1 + src/lib/elementary/efl_ui_list_view.c | 1031 +---------------- src/lib/elementary/efl_ui_list_view.eo | 102 +- src/lib/elementary/efl_ui_list_view_model.eo | 41 - src/lib/elementary/efl_ui_list_view_pan.eo | 12 - .../efl_ui_list_view_precise_layouter.c | 728 ------------ .../efl_ui_list_view_precise_layouter.eo | 10 - src/lib/elementary/efl_ui_list_view_private.h | 78 -- .../elementary/efl_ui_list_view_relayout.eo | 30 - .../elementary/efl_ui_list_view_seg_array.c | 477 -------- .../elementary/efl_ui_list_view_seg_array.h | 42 - src/lib/elementary/efl_ui_list_view_types.eot | 12 - src/lib/elementary/meson.build | 9 - 16 files changed, 45 insertions(+), 2623 deletions(-) delete mode 100644 src/lib/elementary/efl_ui_list_view_model.eo delete mode 100644 src/lib/elementary/efl_ui_list_view_pan.eo delete mode 100644 src/lib/elementary/efl_ui_list_view_precise_layouter.c delete mode 100644 src/lib/elementary/efl_ui_list_view_precise_layouter.eo delete mode 100644 src/lib/elementary/efl_ui_list_view_private.h delete mode 100644 src/lib/elementary/efl_ui_list_view_relayout.eo delete mode 100644 src/lib/elementary/efl_ui_list_view_seg_array.c delete mode 100644 src/lib/elementary/efl_ui_list_view_seg_array.h delete mode 100644 src/lib/elementary/efl_ui_list_view_types.eot diff --git a/src/examples/elementary/efl_ui_list_view_example_1.c b/src/examples/elementary/efl_ui_list_view_example_1.c index 757082aa9d..5c1f4f5fe1 100644 --- a/src/examples/elementary/efl_ui_list_view_example_1.c +++ b/src/examples/elementary/efl_ui_list_view_example_1.c @@ -14,39 +14,20 @@ #define NUM_ITEMS 400 -const char *styles[] = { - "odd", - "even" - }; - -char edj_path[PATH_MAX]; - static void _realized_cb(void *data EINA_UNUSED, const Efl_Event *event) { - Efl_Ui_List_View_Item_Event *ie = event->info; - if (!ie->layout) return; + Efl_Gfx_Entity *layout = event->info; - Efl_Ui_Layout *layout = ie->layout; elm_object_focus_allow_set(layout, EINA_TRUE); } -/* -static void -_unrealized_cb(void *data EINA_UNUSED, const Efl_Event *event) -{ - Efl_Ui_List_View_Item_Event *ie = event->info; - - efl_ui_view_model_set(ie->layout, NULL); - efl_del(ie->layout); -} -*/ static Efl_Model* _make_model(Evas_Object *win) { Eina_Value vtext; Efl_Generic_Model *model, *child; - unsigned int i, s; + unsigned int i; char buf[256]; model = efl_add(EFL_GENERIC_MODEL_CLASS, win); @@ -54,10 +35,7 @@ _make_model(Evas_Object *win) for (i = 0; i < (NUM_ITEMS); i++) { - s = i%2; child = efl_model_child_add(model); - eina_value_set(&vtext, styles[s]); - efl_model_property_set(child, "odd_style", &vtext); snprintf(buf, sizeof(buf), "Item # %i", i); eina_value_set(&vtext, buf); @@ -88,17 +66,13 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); - efl_ui_property_bind(factory, "signal/efl,state,%v", "odd_style"); - efl_ui_property_bind(factory, "signal/efl,state,%{selected;unselected}", "selected"); efl_ui_property_bind(factory, "efl.text", "title"); - li = efl_add(EFL_UI_LIST_VIEW_CLASS, win - , efl_ui_list_view_layout_factory_set(efl_added, factory) - , efl_ui_view_model_set(efl_added, selmodel) - ); + li = efl_add(EFL_UI_LIST_VIEW_CLASS, win, + efl_ui_collection_view_factory_set(efl_added, factory), + efl_ui_view_model_set(efl_added, selmodel)); - efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_cb, NULL); -// efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL); + efl_event_callback_add(li, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, _realized_cb, NULL); elm_win_resize_object_add(win, li); evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); diff --git a/src/examples/elementary/efl_ui_list_view_example_2.c b/src/examples/elementary/efl_ui_list_view_example_2.c index 5a4d680614..3464af5841 100644 --- a/src/examples/elementary/efl_ui_list_view_example_2.c +++ b/src/examples/elementary/efl_ui_list_view_example_2.c @@ -37,13 +37,12 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) efl_ui_property_bind(factory, "efl.text", "filename"); li = efl_add(EFL_UI_LIST_VIEW_CLASS, win); - efl_ui_list_view_layout_factory_set(li, factory); + efl_ui_collection_view_factory_set(li, factory); efl_ui_view_model_set(li, model); evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); - imgf = efl_add(EFL_UI_IMAGE_FACTORY_CLASS, win); efl_ui_property_bind(imgf, "", "path"); //connect to "path" property efl_ui_factory_bind(factory, "efl.icon", imgf); diff --git a/src/examples/elementary/efl_ui_list_view_example_3.c b/src/examples/elementary/efl_ui_list_view_example_3.c index 5a233b3430..ca839bcf59 100644 --- a/src/examples/elementary/efl_ui_list_view_example_3.c +++ b/src/examples/elementary/efl_ui_list_view_example_3.c @@ -52,17 +52,15 @@ static void _cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Priv_Data *priv = (Priv_Data*)data; - efl_unref(priv->model); + efl_del(priv->model); } static void -_focused(void *data, const Efl_Event *event) +_selected(void *data, const Efl_Event *event) { Priv_Data *priv = (Priv_Data*)data; - Evas_Object *focused = efl_ui_focus_manager_focus_get(event->object); - if (focused) - priv->selected = focused; + priv->selected = efl_ui_single_selectable_last_selected_get(event->object); } static void @@ -77,7 +75,7 @@ _bt_add_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_ child = efl_model_child_add(priv->model); eina_value_set(&vtext, elm_object_text_get(priv->e_name)); - efl_model_property_set(child, "name", &vtext); + efl_model_property_set(child, "filename", &vtext); eina_value_set(&vtext, elm_object_text_get(priv->e_occ)); efl_model_property_set(child, "occupation", &vtext); @@ -95,7 +93,6 @@ _bt_del_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_ Priv_Data *priv = (Priv_Data*)data; Eo *child = NULL; - //l = efl_ui_focus_manager_focus_get(priv->list1); if(priv->selected) { printf("focused %p\n", priv->selected); @@ -113,21 +110,21 @@ static void _bt_none_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *li = data; - efl_ui_list_view_select_mode_set(li, ELM_OBJECT_SELECT_MODE_NONE); + efl_ui_multi_selectable_async_select_mode_set(li, EFL_UI_SELECT_MODE_NONE); } static void -_bt_donly_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_bt_donly_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - Evas_Object *li = data; - efl_ui_list_view_select_mode_set(li, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + /* Evas_Object *li = data; */ + /* efl_ui_multi_selectable_async_select_mode_set(li, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); */ } static void _bt_default_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *li = data; - efl_ui_list_view_select_mode_set(li, ELM_OBJECT_SELECT_MODE_DEFAULT); + efl_ui_multi_selectable_async_select_mode_set(li, EFL_UI_SELECT_MODE_SINGLE); } static void @@ -146,28 +143,21 @@ _bt_unset_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EIN static void _realized_1_cb(void *data EINA_UNUSED, const Efl_Event *event) { - Efl_Ui_List_View_Item_Event *ie = event->info; + Efl_Gfx_Entity *layout = event->info; - evas_object_size_hint_weight_set(ie->layout, EVAS_HINT_EXPAND, 0); - evas_object_size_hint_align_set(ie->layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - efl_ui_property_bind(ie->layout, "efl.text", "name"); - efl_ui_property_bind(ie->layout, "signal/efl,state,%v", "odd_style"); + efl_ui_property_bind(layout, "efl.text", "filename"); } static void _realized_2_cb(void *data EINA_UNUSED, const Efl_Event *event) { - Efl_Ui_List_View_Item_Event *ie = event->info; - printf("relized 2\n"); + Efl_Gfx_Entity *layout = event->info; - elm_object_focus_allow_set(ie->layout, EINA_TRUE); - evas_object_size_hint_weight_set(ie->layout, EVAS_HINT_EXPAND, 0); - evas_object_size_hint_align_set(ie->layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - efl_ui_property_bind(ie->layout, "efl.text", "occupation"); + efl_ui_property_bind(layout, "efl.text", "occupation"); } static Efl_Model* -_make_model() +_make_model(void) { Eina_Value vtext, value; Efl_Generic_Model *model, *child; @@ -182,11 +172,8 @@ _make_model() { child = efl_model_child_add(model); - i%2 ? eina_value_set(&vtext, "even") : eina_value_set(&vtext, "odd"); - efl_model_property_set(child, "odd_style", &vtext); - eina_value_set(&vtext, texts[(i % len)]); - efl_model_property_set(child, "name", &vtext); + efl_model_property_set(child, "filename", &vtext); eina_value_set(&vtext, subtexts[(i % len)]); efl_model_property_set(child, "occupation", &vtext); @@ -226,21 +213,20 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); priv->list1 = efl_add(EFL_UI_LIST_VIEW_CLASS, win, efl_ui_view_model_set(efl_added, priv->model)); - efl_event_callback_add(priv->list1, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_1_cb, priv); + efl_event_callback_add(priv->list1, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, _realized_1_cb, priv); evas_object_size_hint_weight_set(priv->list1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(priv->list1, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(bx, priv->list1); - efl_ui_list_view_layout_factory_set(priv->list1, factory); + efl_ui_collection_view_factory_set(priv->list1, factory); factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); efl_ui_property_bind(factory, "efl.text", "filename"); - efl_ui_property_bind(factory, "signal/efl,state,%v", "selected"); efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); priv->list2 = efl_add(EFL_UI_LIST_VIEW_CLASS, win, efl_ui_view_model_set(efl_added, priv->model)); - efl_event_callback_add(priv->list2, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_2_cb, priv->list2); + efl_event_callback_add(priv->list2, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED, _realized_2_cb, priv->list2); evas_object_size_hint_weight_set(priv->list2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(priv->list2, EVAS_HINT_FILL, EVAS_HINT_FILL); - efl_ui_list_view_layout_factory_set(priv->list2, factory); + efl_ui_collection_view_factory_set(priv->list2, factory); vbx = elm_box_add(win); elm_box_pack_end(bx, vbx); @@ -313,7 +299,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) elm_box_pack_end(vbx, bt); elm_box_pack_end(bx, priv->list2); - efl_event_callback_add(priv->list2, EFL_UI_FOCUS_MANAGER_EVENT_MANAGER_FOCUS_CHANGED, _focused ,priv); + efl_event_callback_add(priv->list2, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, _selected, priv); evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, priv); diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index baa945c24b..7f0c2ab4e9 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -334,6 +334,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include +# include # include # include diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c index cee52e1132..efc3dfe50e 100644 --- a/src/lib/elementary/efl_ui_list_view.c +++ b/src/lib/elementary/efl_ui_list_view.c @@ -1,1041 +1,22 @@ #ifdef HAVE_CONFIG_H # include "elementary_config.h" #endif -#define EFL_ACCESS_OBJECT_PROTECTED -#define EFL_ACCESS_SELECTION_PROTECTED -#define EFL_UI_SCROLL_MANAGER_PROTECTED -#define EFL_UI_SCROLLBAR_PROTECTED -#define EFL_UI_FOCUS_COMPOSITION_PROTECTED -#define EFL_UI_WIDGET_FOCUS_MANAGER_PROTECTED -#include "elm_priv.h" -#include "efl_ui_list_view_private.h" -#include "efl_ui_list_view_precise_layouter.eo.h" +#include -#include +#define MY_CLASS EFL_UI_LIST_VIEW_CLASS +#define MY_CLASS_PFX efl_ui_list_view -#define MY_CLASS EFL_UI_LIST_VIEW_CLASS #define MY_CLASS_NAME "Efl.Ui.List_View" -#define MY_PAN_CLASS EFL_UI_LIST_VIEW_PAN_CLASS - -#define SIG_CHILD_ADDED "child,added" -#define SIG_CHILD_REMOVED "child,removed" -#define SELECTED_PROP "selected" - -static const Evas_Smart_Cb_Description _smart_callbacks[] = { - {SIG_CHILD_ADDED, ""}, - {SIG_CHILD_REMOVED, ""}, - {NULL, NULL} -}; - -void _efl_ui_list_view_custom_layout(Efl_Ui_List_View *); -void _efl_ui_list_view_item_select_set(Efl_Ui_List_View_Layout_Item*, Eina_Bool); - -static Eina_Bool _key_action_move(Evas_Object *obj, const char *params); -static Eina_Bool _key_action_select(Evas_Object *obj, const char *params); -static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params); - -static const Elm_Action key_actions[] = { - {"move", _key_action_move}, - {"select", _key_action_select}, - {"escape", _key_action_escape}, - {NULL, NULL} -}; - -EOLIAN static void -_efl_ui_list_view_pan_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd) -{ - efl_canvas_group_need_recalculate_set(obj, EINA_FALSE); - evas_object_smart_changed(psd->wobj); -} - - -EOLIAN static void -_efl_ui_list_view_pan_efl_ui_pan_pan_position_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd, Eina_Position2D pos) -{ - if ((pos.x == psd->gmt.x) && (pos.y == psd->gmt.y)) return; - - psd->gmt.x = pos.x; - psd->gmt.y = pos.y; - - efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, &pos); - evas_object_smart_changed(psd->wobj); -} - -EOLIAN static Eina_Position2D -_efl_ui_list_view_pan_efl_ui_pan_pan_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd) -{ - return psd->gmt.pos; -} - -EOLIAN static Eina_Position2D -_efl_ui_list_view_pan_efl_ui_pan_pan_position_max_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd) -{ - EFL_UI_LIST_VIEW_DATA_GET(psd->wobj, pd); - Eina_Rect vgmt = {}; - Eina_Size2D min = {}; - - vgmt = efl_ui_scrollable_viewport_geometry_get(pd->scrl_mgr); - min = efl_ui_list_view_model_min_size_get(psd->wobj); - - min.w = min.w - vgmt.w; - if (min.w < 0) min.w = 0; - min.h = min.h - vgmt.h; - if (min.h < 0) min.h = 0; - - return EINA_POSITION2D(min.w, min.h); -} - -EOLIAN static Eina_Position2D -_efl_ui_list_view_pan_efl_ui_pan_pan_position_min_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd EINA_UNUSED) -{ - return EINA_POSITION2D(0, 0); -} - -EOLIAN static Eina_Size2D -_efl_ui_list_view_pan_efl_ui_pan_content_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Pan_Data *psd) -{ - Eina_Size2D min = {}; - min = efl_ui_list_view_model_min_size_get(psd->wobj); - - return min; -} - -EOLIAN static void -_efl_ui_list_view_pan_efl_object_destructor(Eo *obj, Efl_Ui_List_View_Pan_Data *psd EINA_UNUSED) -{ - efl_destructor(efl_super(obj, MY_PAN_CLASS)); -} - -#include "efl_ui_list_view_pan.eo.c" - -static Eina_Bool -_efl_model_properties_has(Efl_Model *model, Eina_Stringshare *propfind) -{ - Eina_Iterator *properties; - const char *property; - Eina_Bool ret = EINA_FALSE; - - EINA_SAFETY_ON_NULL_RETURN_VAL(model, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(propfind, EINA_FALSE); - - properties = efl_model_properties_get(model); - EINA_ITERATOR_FOREACH(properties, property) - { - if (property == propfind || - !strcmp(property, propfind)) - { - ret = EINA_TRUE; - break; - } - } - eina_iterator_free(properties); - - return ret; -} - -static void -_list_element_focused(void *data EINA_UNUSED, const Efl_Event *ev) -{ - Eina_Rect geom; - Eina_Position2D pos; - Efl_Ui_Focus_Object *focused = efl_ui_focus_manager_focus_get(ev->object); - - if (!focused) return; - - EFL_UI_LIST_VIEW_DATA_GET(ev->object, pd); - geom = efl_ui_focus_object_focus_geometry_get(focused); - pos = efl_ui_scrollable_content_pos_get(pd->scrl_mgr); - - geom.x += pos.x; - geom.y += pos.y; - efl_ui_scrollable_scroll(pd->scrl_mgr, geom, EINA_TRUE); -} - -static void -_on_item_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info) -{ - Evas_Event_Mouse_Down *ev = event_info; - Efl_Ui_List_View_Layout_Item *item = data; - Eina_Value *v; - Eina_Bool select; - - if (ev->button != 1) return; - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; - - v = efl_model_property_get(item->children, SELECTED_PROP); - if (!eina_value_get(v, &select)) - { - WRN("Could not get the select value"); - eina_value_free(v); - return; - } - _efl_ui_list_view_item_select_set(item, !select); - eina_value_free(v); -} - -EOLIAN static void -_efl_ui_list_view_select_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Elm_Object_Select_Mode mode) -{ - if (pd->select_mode == mode) - return; - - pd->select_mode = mode; -} - -EOLIAN static Elm_Object_Select_Mode -_efl_ui_list_view_select_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->select_mode; -} - -EOLIAN static void -_efl_ui_list_view_default_style_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Eina_Stringshare *style) -{ - eina_stringshare_replace(&pd->style, style); -} - -EOLIAN static Eina_Stringshare * -_efl_ui_list_view_default_style_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->style; -} - -EOLIAN static void -_efl_ui_list_view_homogeneous_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Eina_Bool homogeneous) -{ - pd->homogeneous = homogeneous; -} - -EOLIAN static Eina_Bool -_efl_ui_list_view_homogeneous_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->homogeneous; -} - -EOLIAN static void -_efl_ui_list_view_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_List_View_Data *pd, Eina_Position2D pos) -{ - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) - return; - - efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos); - evas_object_smart_changed(pd->obj); -} - -EOLIAN static void -_efl_ui_list_view_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_List_View_Data *pd, Eina_Size2D size) -{ - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h)) - return; - - efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size); - - evas_object_smart_changed(pd->obj); -} - -EOLIAN static void -_efl_ui_list_view_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - if (!pd->model) - return; - - efl_ui_list_view_relayout_layout_do(pd->relayout, pd->obj, pd->seg_array_first, pd->seg_array); - -} - -EOLIAN static void -_efl_ui_list_view_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_List_View_Data *pd EINA_UNUSED, Evas_Object *member) -{ - efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member); -} - -//Scrollable Implement -static void -_efl_ui_list_view_bar_read_and_update(Eo *obj) -{ - EFL_UI_LIST_VIEW_DATA_GET(obj, pd); - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - double vx, vy; - - edje_object_part_drag_value_get - (wd->resize_obj, "efl.dragable.vbar", NULL, &vy); - edje_object_part_drag_value_get - (wd->resize_obj, "efl.dragable.hbar", &vx, NULL); - - efl_ui_scrollbar_bar_position_set(pd->scrl_mgr, vx, vy); - - efl_canvas_group_change(pd->pan_obj); -} - -static void -_efl_ui_list_view_reload_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - EFL_UI_LIST_VIEW_DATA_GET(data, pd); - - efl_ui_scrollbar_bar_visibility_update(pd->scrl_mgr); -} - -static void -_efl_ui_list_view_vbar_drag_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - _efl_ui_list_view_bar_read_and_update(data); - - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAGGED, &type); -} - -static void -_efl_ui_list_view_vbar_press_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESSED, &type); -} - -static void -_efl_ui_list_view_vbar_unpress_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESSED, &type); -} - -static void -_efl_ui_list_view_edje_drag_start_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - EFL_UI_LIST_VIEW_DATA_GET(data, pd); - - _efl_ui_list_view_bar_read_and_update(data); - - pd->scrl_freeze = efl_ui_scrollable_scroll_freeze_get(pd->scrl_mgr); - efl_ui_scrollable_scroll_freeze_set(pd->scrl_mgr, EINA_TRUE); - efl_event_callback_call(data, EFL_UI_EVENT_SCROLL_DRAG_STARTED, NULL); -} - -static void -_efl_ui_list_view_edje_drag_stop_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - EFL_UI_LIST_VIEW_DATA_GET(data, pd); - - _efl_ui_list_view_bar_read_and_update(data); - - efl_ui_scrollable_scroll_freeze_set(pd->scrl_mgr, pd->scrl_freeze); - efl_event_callback_call(data, EFL_UI_EVENT_SCROLL_DRAG_FINISHED, NULL); -} - -static void -_efl_ui_list_view_edje_drag_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - _efl_ui_list_view_bar_read_and_update(data); -} - -static void -_efl_ui_list_view_hbar_drag_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - _efl_ui_list_view_bar_read_and_update(data); - - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAGGED, &type); -} - -static void -_efl_ui_list_view_hbar_press_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESSED, &type); -} - -static void -_efl_ui_list_view_hbar_unpress_cb(void *data, - Evas_Object *obj EINA_UNUSED, - const char *emission EINA_UNUSED, - const char *source EINA_UNUSED) -{ - Efl_Ui_Layout_Orientation type = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL; - efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESSED, &type); -} - -static void -_efl_ui_list_view_bar_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) -{ - Eo *obj = data; - EFL_UI_LIST_VIEW_DATA_GET(obj, pd); - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - - double width = 0.0, height = 0.0; - - efl_ui_scrollbar_bar_size_get(pd->scrl_mgr, &width, &height); - - edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.hbar", width, 1.0); - edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.vbar", 1.0, height); -} - -static void -_efl_ui_list_view_bar_pos_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) -{ - Eo *obj = data; - EFL_UI_LIST_VIEW_DATA_GET(obj, pd); - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - - double posx = 0.0, posy = 0.0; - - efl_ui_scrollbar_bar_position_get(pd->scrl_mgr, &posx, &posy); - - edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.hbar", posx, 0.0); - edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.vbar", 0.0, posy); -} - -static void -_efl_ui_list_view_bar_show_cb(void *data, const Efl_Event *event) -{ - Eo *obj = data; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); - - if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,show,hbar", "efl"); - else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,show,vbar", "efl"); -} - -static void -_efl_ui_list_view_bar_hide_cb(void *data, const Efl_Event *event) -{ - Eo *obj = data; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); - - if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,hide,hbar", "efl"); - else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,hide,vbar", "efl"); -} - -static Eina_Bool -_efl_ui_list_view_efl_layout_signal_signal_callback_add(Eo *obj, Efl_Ui_List_View_Data *pd EINA_UNUSED, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb) -{ - Eina_Bool ok; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - - ok = efl_layout_signal_callback_add(wd->resize_obj, emission, source, func_data, func, func_free_cb); - - return ok; -} - -static Eina_Bool -_efl_ui_list_view_efl_layout_signal_signal_callback_del(Eo *obj, Efl_Ui_List_View_Data *pd EINA_UNUSED, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb) -{ - Eina_Bool ok; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - - ok = efl_layout_signal_callback_del(wd->resize_obj, emission, source, func_data, func, func_free_cb); - - return ok; -} - -static void -_efl_ui_list_view_edje_object_attach(Eo *obj) -{ - efl_layout_signal_callback_add - (obj, "reload", "efl", - obj, _efl_ui_list_view_reload_cb, NULL); - //Vertical bar - efl_layout_signal_callback_add - (obj, "drag", "efl.dragable.vbar", - obj, _efl_ui_list_view_vbar_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,set", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,start", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_start_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,stop", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_stop_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,step", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,page", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "efl,vbar,press", "efl", - obj, _efl_ui_list_view_vbar_press_cb, NULL); - efl_layout_signal_callback_add - (obj, "efl,vbar,unpress", "efl", - obj, _efl_ui_list_view_vbar_unpress_cb, NULL); - - //Horizontal bar - efl_layout_signal_callback_add - (obj, "drag", "efl.dragable.hbar", - obj, _efl_ui_list_view_hbar_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,set", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,start", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_start_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,stop", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_stop_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,step", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "drag,page", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_add - (obj, "efl,hbar,press", "efl", - obj, _efl_ui_list_view_hbar_press_cb, NULL); - efl_layout_signal_callback_add - (obj, "efl,hbar,unpress", "efl", - obj, _efl_ui_list_view_hbar_unpress_cb, NULL); -} - -static void -_efl_ui_list_view_edje_object_detach(Evas_Object *obj) -{ - efl_layout_signal_callback_del - (obj, "reload", "efl", - obj, _efl_ui_list_view_reload_cb, NULL); - //Vertical bar - efl_layout_signal_callback_del - (obj, "drag", "efl.dragable.vbar", - obj, _efl_ui_list_view_vbar_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,set", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,start", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_start_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,stop", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_stop_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,step", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,page", "efl.dragable.vbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "efl,vbar,press", "efl", - obj, _efl_ui_list_view_vbar_press_cb, NULL); - efl_layout_signal_callback_del - (obj, "efl,vbar,unpress", "efl", - obj, _efl_ui_list_view_vbar_unpress_cb, NULL); - - //Horizontal bar - efl_layout_signal_callback_del - (obj, "drag", "efl.dragable.hbar", - obj, _efl_ui_list_view_hbar_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,set", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,start", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_start_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,stop", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_stop_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,step", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "drag,page", "efl.dragable.hbar", - obj, _efl_ui_list_view_edje_drag_cb, NULL); - efl_layout_signal_callback_del - (obj, "efl,hbar,press", "efl", - obj, _efl_ui_list_view_hbar_press_cb, NULL); - efl_layout_signal_callback_del - (obj, "efl,hbar,unpress", "efl", - obj, _efl_ui_list_view_hbar_unpress_cb, NULL); -} - -EOLIAN static void -_efl_ui_list_view_efl_canvas_group_group_add(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - Efl_Ui_List_View_Pan_Data *pan_data; - Eina_Size2D min = {}; - Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable; - Evas_Object *o; - - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - - efl_canvas_group_add(efl_super(obj, MY_CLASS)); - - elm_widget_can_focus_set(obj, EINA_TRUE); - - if (!elm_layout_theme_set(obj, "list_view", "base", elm_widget_style_get(obj))) - CRI("Failed to set layout!"); - - pd->scrl_mgr = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj, - efl_ui_mirrored_set(efl_added, efl_ui_mirrored_get(obj))); - efl_composite_attach(obj, pd->scrl_mgr); - pd->pan_obj = efl_add(MY_PAN_CLASS, obj); - pan_data = efl_data_scope_get(pd->pan_obj, MY_PAN_CLASS); - pan_data->wobj = obj; - - efl_ui_scroll_manager_pan_set(pd->scrl_mgr, pd->pan_obj); - efl_ui_scrollable_bounce_enabled_set(pd->scrl_mgr, bounce, bounce); - - edje_object_part_swallow(wd->resize_obj, "efl.content", pd->pan_obj); - edje_object_freeze(wd->resize_obj); - o = (Evas_Object *)edje_object_part_object_get(wd->resize_obj, "efl.dragable.vbar"); - edje_object_thaw(wd->resize_obj); - efl_gfx_stack_raise_to_top((Eo *)o); - - efl_gfx_entity_visible_set(pd->pan_obj, EINA_TRUE); - efl_access_object_access_type_set(obj, EFL_ACCESS_TYPE_DISABLED); - - edje_object_size_min_calc(wd->resize_obj, &min.w, &min.h); - efl_gfx_hint_size_restricted_min_set(obj, min); - - efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED, - _efl_ui_list_view_bar_size_changed_cb, obj); - efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_POS_CHANGED, - _efl_ui_list_view_bar_pos_changed_cb, obj); - efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SHOW, - _efl_ui_list_view_bar_show_cb, obj); - efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_HIDE, - _efl_ui_list_view_bar_hide_cb, obj); - - _efl_ui_list_view_edje_object_attach(obj); -} - -EOLIAN static void -_efl_ui_list_view_efl_canvas_group_group_del(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - efl_ui_list_view_relayout_model_set(pd->relayout, NULL); - - ELM_SAFE_FREE(pd->pan_obj, efl_del); - efl_canvas_group_del(efl_super(obj, MY_CLASS)); -} - -EOLIAN static Efl_Ui_Focus_Manager* -_efl_ui_list_view_efl_ui_widget_focus_manager_focus_manager_create(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *root) -{ - if (!pd->manager) - pd->manager = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, obj, - efl_ui_focus_manager_root_set(efl_added, root)); - - return pd->manager; -} - -EOLIAN static Eo * -_efl_ui_list_view_efl_object_finalize(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - if (!pd->factory) - { - pd->factory = efl_new(EFL_UI_LAYOUT_FACTORY_CLASS); - efl_ui_layout_factory_theme_config(pd->factory, "list_item", NULL, "default"); - } - - if(!pd->relayout) - { - pd->relayout = efl_new(EFL_UI_LIST_VIEW_PRECISE_LAYOUTER_CLASS); - efl_ui_list_view_relayout_model_set(pd->relayout, pd->model); - } - return obj; -} - -EOLIAN static Eo * -_efl_ui_list_view_efl_object_constructor(Eo *obj, Efl_Ui_List_View_Data *pd) +static Eo * +_efl_ui_list_view_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) { obj = efl_constructor(efl_super(obj, MY_CLASS)); - pd->obj = obj; - efl_canvas_object_type_set(obj, MY_CLASS_NAME); - evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); - efl_access_object_role_set(obj, EFL_ACCESS_ROLE_LIST); - pd->seg_array = efl_ui_list_view_seg_array_setup(32); - - efl_event_callback_add(obj, EFL_UI_FOCUS_MANAGER_EVENT_MANAGER_FOCUS_CHANGED, _list_element_focused, NULL); - - efl_ui_focus_composition_logical_mode_set(obj, EINA_TRUE); - - pd->style = eina_stringshare_add(elm_widget_style_get(obj)); - - pd->factory = NULL; - pd->min.w = 0; - pd->min.h = 0; + efl_ui_collection_view_position_manager_set(obj, efl_new(EFL_UI_POSITION_MANAGER_LIST_CLASS)); return obj; } -EOLIAN static void -_efl_ui_list_view_efl_object_destructor(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - efl_event_callback_del(obj, EFL_UI_FOCUS_MANAGER_EVENT_MANAGER_FOCUS_CHANGED, - _list_element_focused, NULL); - - _efl_ui_list_view_edje_object_detach(obj); - - efl_replace(&pd->model, NULL); - efl_replace(&pd->relayout, NULL); - efl_replace(&pd->factory, NULL); - - efl_ui_list_view_seg_array_free(pd->seg_array); - - eina_stringshare_del(pd->style); - efl_destructor(efl_super(obj, MY_CLASS)); -} - -EOLIAN static void -_efl_ui_list_view_layout_factory_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Efl_Ui_Factory *factory) -{ - efl_replace(&pd->factory, factory); -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, Efl_Model *model) -{ - if (!efl_replace(&pd->model, model)) - return; - - efl_ui_list_view_seg_array_flush(pd->seg_array); - - if (pd->relayout) - efl_ui_list_view_relayout_model_set(pd->relayout, pd->model); - - evas_object_smart_changed(pd->obj); -} - -EOLIAN static Efl_Model * -_efl_ui_list_view_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->model; -} - -EOLIAN int -_efl_ui_list_view_efl_access_selection_selected_children_count_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return eina_list_count(pd->selected_items); -} - -EOLIAN Eo* -_efl_ui_list_view_efl_access_selection_selected_child_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd, int child_index) -{ - if(child_index < (int) eina_list_count(pd->selected_items)) - { - Efl_Ui_List_View_Layout_Item* items = eina_list_nth(pd->selected_items, child_index); - return items[child_index].layout; - } - else - return NULL; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_child_select(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, int child_index EINA_UNUSED) -{ - return EINA_FALSE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_selected_child_deselect(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, int child_index EINA_UNUSED) -{ - return EINA_FALSE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_is_child_selected(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, int child_index EINA_UNUSED) -{ - return EINA_FALSE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_all_children_select(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED) -{ - return EINA_TRUE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_access_selection_clear(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED) -{ - return EINA_TRUE; -} - -EOLIAN Eina_Bool -_efl_ui_list_view_efl_access_selection_child_deselect(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, int child_index EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_key_action_move(Evas_Object *obj EINA_UNUSED, const char *params EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_key_action_select(Evas_Object *obj EINA_UNUSED, const char *params EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED) -{ - efl_ui_focus_manager_reset_history(obj); - return EINA_TRUE; -} - -void -_efl_ui_list_view_item_select_set(Efl_Ui_List_View_Layout_Item *item, Eina_Bool selected) -{ - Eina_Stringshare *sprop; - assert(item != NULL); - assert(item->children != NULL); - - selected = !!selected; - - sprop = eina_stringshare_add(SELECTED_PROP); - - if (_efl_model_properties_has(item->children, sprop)) - { - Eina_Value v; - eina_value_setup(&v, EINA_VALUE_TYPE_BOOL); - eina_value_set(&v, selected); - efl_model_property_set(item->children, sprop, &v); - eina_value_flush(&v); - } - eina_stringshare_del(sprop); -} - -static Eina_Value -_children_slice_then(void * data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) -{ - Efl_Ui_List_View_Data *pd = data; - - if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ERROR) - goto on_error; - - efl_ui_list_view_seg_array_insert_value(pd->seg_array, pd->slice.start, v); - - pd->seg_array_first = pd->slice.start; - pd->slice.start = pd->slice.count = 0; - pd->slice.future = NULL; - - efl_ui_list_view_relayout_layout_do(pd->relayout, pd->obj, pd->seg_array_first, pd->seg_array); - on_error: - return v; -} - -/* EFL UI LIST MODEL INTERFACE */ -EOLIAN static Eina_Size2D -_efl_ui_list_view_efl_ui_list_view_model_min_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return pd->min; -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_list_view_model_min_size_set(Eo *obj, Efl_Ui_List_View_Data *pd, Eina_Size2D min) -{ - Eina_Size2D sz; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - - pd->min.w = min.w; - pd->min.h = min.h; - - efl_gfx_hint_size_min_set(wd->resize_obj, EINA_SIZE2D(pd->min.w, pd->min.h)); - sz = pd->min; - efl_event_callback_call(pd->pan_obj, EFL_UI_PAN_EVENT_PAN_CONTENT_SIZE_CHANGED, &sz); -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_focus_composition_prepare(Eo *obj, Efl_Ui_List_View_Data *pd) -{ - Eina_List *order = efl_ui_list_view_relayout_elements_get(pd->relayout); - efl_ui_focus_composition_elements_set(obj, order); -} - -EOLIAN Eina_List* -_efl_ui_list_view_efl_access_object_access_children_get(const Eo *obj, Efl_Ui_List_View_Data *pd) -{ - Eina_List *ret = NULL, *ret2 = NULL; - - ret = efl_ui_list_view_relayout_elements_get(pd->relayout); - ret2 = efl_access_object_access_children_get(efl_super(obj, EFL_UI_LIST_VIEW_CLASS)); - - return eina_list_merge(ret, ret2); -} - -EOLIAN static Eina_Bool -_efl_ui_list_view_efl_ui_widget_focus_state_apply(Eo *obj, Efl_Ui_List_View_Data *pd EINA_UNUSED, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect EINA_UNUSED) -{ - return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj); -} - -typedef struct _Efl_Ui_List_Vuew_Layout_Item_Tracking Efl_Ui_List_View_Layout_Item_Tracking; -struct _Efl_Ui_List_Vuew_Layout_Item_Tracking -{ - Efl_Ui_List_View_Layout_Item *item; - Efl_Ui_List_View_Data *pd; -}; - -static Eina_Value -_content_created(Eo *obj, void *data, const Eina_Value value) -{ - Efl_Ui_List_View_Layout_Item_Tracking *tracking = data; - Efl_Ui_List_View_Layout_Item *item = tracking->item; - Efl_Ui_List_View_Item_Event evt; - - if (eina_value_array_count(&value) != 1) return eina_value_error_init(EINVAL); - eina_value_array_get(&value, 0, &item->layout); - - efl_canvas_group_member_add(tracking->pd->pan_obj, item->layout); - evas_object_event_callback_add(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item); - - if (_elm_config->atspi_mode) - { - efl_access_added(item->layout); - efl_access_children_changed_added_signal_emit(obj, item->layout); - } - - evt.child = item->children; - evt.layout = item->layout; - evt.index = efl_ui_list_view_item_index_get(item); - efl_event_callback_call(obj, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, &evt); - - tracking->item->layout_request = NULL; - efl_ui_list_view_relayout_content_created(tracking->pd->relayout, item); - - efl_ui_focus_composition_dirty(obj); - evas_object_show(item->layout); - - return value; -} - -static void -_clean_request(Eo *obj EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED) -{ - Efl_Ui_List_View_Layout_Item_Tracking *tracking = data; - - tracking->item->layout_request = NULL; - free(tracking); -} - -EOLIAN static Efl_Ui_List_View_Layout_Item * -_efl_ui_list_view_efl_ui_list_view_model_realize(Eo *obj, Efl_Ui_List_View_Data *pd, Efl_Ui_List_View_Layout_Item *item) -{ - Efl_Ui_List_View_Layout_Item_Tracking *tracking; - Efl_Model *childrens[1]; - EINA_SAFETY_ON_NULL_RETURN_VAL(item->children, item); - - if (!item->children) return item; - - if (item->layout_request) eina_future_cancel(item->layout_request); - - tracking = calloc(1, sizeof (Efl_Ui_List_View_Layout_Item_Tracking)); - if (!tracking) return item; - - tracking->item = item; - tracking->pd = pd; - childrens[0] = item->children; - - item->layout_request = efl_ui_view_factory_create_with_event(pd->factory, EINA_C_ARRAY_ITERATOR_NEW(childrens)); - item->layout_request = efl_future_then(obj, item->layout_request, - .success = _content_created, - .success_type = EINA_VALUE_TYPE_ARRAY, - .data = tracking, - .free = _clean_request); - - return item; -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_list_view_model_unrealize(Eo *obj, Efl_Ui_List_View_Data *pd, Efl_Ui_List_View_Layout_Item *item) -{ - Efl_Ui_List_View_Item_Event evt; - Efl_Gfx_Entity *entities[1]; - EINA_SAFETY_ON_NULL_RETURN(item); - - if (!item->layout) - return; - - // First check if the item has been fully realized - if (item->layout_request) - { - eina_future_cancel(item->layout_request); - return ; - } - - evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item); - if (elm_object_focus_allow_get(item->layout)) - { - if (efl_ui_focus_object_focus_get(item->layout)) - efl_ui_focus_object_focus_set(item->layout, EINA_FALSE); - efl_ui_focus_manager_calc_unregister(obj, item->layout); - } - evas_object_hide(item->layout); - evas_object_move(item->layout, -9999, -9999); - - evt.child = item->children; - evt.layout = item->layout; - evt.index = efl_ui_list_view_item_index_get(item); - efl_event_callback_call(obj, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, &evt); - - efl_canvas_group_member_remove(obj, pd->pan_obj); - entities[0] = item->layout; - efl_ui_factory_release(pd->factory, EINA_C_ARRAY_ITERATOR_NEW(entities)); - item->layout = NULL; -} - -EOLIAN static void -_efl_ui_list_view_efl_ui_list_view_model_load_range_set(Eo* obj, Efl_Ui_List_View_Data* pd, int first, int count) -{ - if (pd->slice.future) return ; - - pd->slice.start = first; - pd->slice.count = count; - - if (efl_model_children_count_get(pd->model)) - { - Eina_Future *f = efl_model_children_slice_get(pd->model, first, count); - f = eina_future_then(f, _children_slice_then, pd, NULL); - pd->slice.future = efl_future_then(obj, f); - } -} - -EOLIAN static int -_efl_ui_list_view_efl_ui_list_view_model_model_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) -{ - return efl_model_children_count_get(pd->model); -} - -ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_list_view, Efl_Ui_List_View_Data) - -/* Internal EO APIs and hidden overrides */ - -#define EFL_UI_LIST_VIEW_EXTRA_OPS \ - EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_list_view) - #include "efl_ui_list_view.eo.c" -#include "efl_ui_list_view_relayout.eo.c" -#include "efl_ui_list_view_model.eo.c" diff --git a/src/lib/elementary/efl_ui_list_view.eo b/src/lib/elementary/efl_ui_list_view.eo index d552ce4793..c4de87da5a 100644 --- a/src/lib/elementary/efl_ui_list_view.eo +++ b/src/lib/elementary/efl_ui_list_view.eo @@ -1,97 +1,17 @@ -import elm_general; - -struct @beta Efl.Ui.List_View_Item_Event +class @beta Efl.Ui.List_View extends Efl.Ui.Collection_View { - [[Information related to item events.]] // TODO: This needs to be filled in. - layout: Efl.Ui.Layout; [[TBD]] - child: Efl.Model; [[TBD]] - index: int; [[TBD]] -} -class @beta Efl.Ui.List_View extends Efl.Ui.Layout_Base implements - Efl.Access.Widget.Action, Efl.Access.Selection, - Efl.Ui.Focus.Composition, Efl.Ui.Focus.Manager_Sub, - Efl.Ui.Container_Selectable, Efl.Ui.List_View_Model, - Efl.Ui.Widget_Focus_Manager - composites - Efl.Ui.Scrollable, Efl.Ui.Scrollbar -{ - methods { - @property homogeneous { - [[When in homogeneous mode, all items have the same height and width. - Otherwise, each item's size is respected. - ]] - get { - } - set { - } - values { - homogeneous: bool; [[Homogeneous mode setting. Default is $false.]] - } - } - @property select_mode { - [[Listview select mode.]] - get {} - set {} - values { - mode: Elm.Object.Select_Mode(Elm.Object.Select_Mode.max); [[The select mode.]] - } - } - @property default_style { - [[TBD]] // TODO: This needs to be filled in. Does not seem to be in use. - values { - style: stringshare; [[TBD]] - } - } - @property layout_factory { - [[Listview layout factory set.]] - set {} - values { - factory: Efl.Ui.Factory; [[The factory.]] - } - } - } - events { - item,realized : Efl.Ui.List_View_Item_Event; - item,unrealized : Efl.Ui.List_View_Item_Event; - item,focused : Efl.Ui.List_View_Item_Event; - item,unfocused : Efl.Ui.List_View_Item_Event; - item,highlighted : Efl.Ui.List_View_Item_Event; - item,unhighlighted : Efl.Ui.List_View_Item_Event; - } + [[A scrollable list of @Efl.Ui.Item objects, typically @Efl.Ui.List_Default_Item objects. + Items are added asynchronously by an @Efl.Ui.Factory from the definition of an @Efl.Model. + + The orientation (vertical or horizontal) of the list can be set with + @Efl.Ui.Layout_Orientable.orientation. + + Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable_Async.select_mode + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Async.selected_iterator_new. + ]] + data: null; implements { Efl.Object.constructor; - Efl.Object.finalize; - Efl.Object.destructor; - Efl.Gfx.Entity.position { set; } - Efl.Gfx.Entity.size { set; } - // Smart obj - Efl.Canvas.Group.group_member_add; - Efl.Canvas.Group.group_calculate; - - Efl.Ui.List_View_Model.load_range { set;} - Efl.Ui.List_View_Model.realize; - Efl.Ui.List_View_Model.unrealize; - Efl.Ui.List_View_Model.model_size { get; } - Efl.Ui.List_View_Model.min_size { get; set; } - - // Widget - Efl.Ui.Widget_Focus_Manager.focus_manager_create; - Efl.Ui.Widget.widget_input_event_handler; - Efl.Ui.Widget.focus_state_apply; - Efl.Ui.Focus.Composition.prepare; - Efl.Ui.View.model { get; set; } - - Efl.Layout.Signal.signal_callback_add; - Efl.Layout.Signal.signal_callback_del; - Efl.Access.Object.access_children { get; } - Efl.Access.Selection.selected_children_count { get; } - Efl.Access.Selection.selected_child { get; } - Efl.Access.Selection.selected_child_deselect; - Efl.Access.Selection.child_select; - Efl.Access.Selection.child_deselect; - Efl.Access.Selection.is_child_selected; - Efl.Access.Selection.all_children_select; - Efl.Access.Selection.access_selection_clear; } } diff --git a/src/lib/elementary/efl_ui_list_view_model.eo b/src/lib/elementary/efl_ui_list_view_model.eo deleted file mode 100644 index cf4780ed5f..0000000000 --- a/src/lib/elementary/efl_ui_list_view_model.eo +++ /dev/null @@ -1,41 +0,0 @@ -import efl_ui_list_view_types; - -interface @beta Efl.Ui.List_View_Model -{ - methods { - @property load_range { - set {} - values { - first: int; - count: int; - } - } - realize { - params { - item: ptr(Efl.Ui.List_View_Layout_Item); - } - return: ptr(Efl.Ui.List_View_Layout_Item); - } - unrealize { - params { - item: ptr(Efl.Ui.List_View_Layout_Item); - } - } - @property model_size { - get {} - values { - s: int; - } - } - @property min_size { - [[Minimal content size.]] - set {} - get {} - values { - min: Eina.Size2D; - } - } - - - } -} diff --git a/src/lib/elementary/efl_ui_list_view_pan.eo b/src/lib/elementary/efl_ui_list_view_pan.eo deleted file mode 100644 index 1bd72a8300..0000000000 --- a/src/lib/elementary/efl_ui_list_view_pan.eo +++ /dev/null @@ -1,12 +0,0 @@ -class @beta Efl.Ui.List_View_Pan extends Efl.Ui.Pan -{ - [[Elementary Efl_Ui_List_View pan class]] - implements { - Efl.Object.destructor; - Efl.Ui.Pan.content_size { get; } - Efl.Ui.Pan.pan_position { get; set; } - Efl.Ui.Pan.pan_position_min { get; } - Efl.Ui.Pan.pan_position_max { get; } - Efl.Canvas.Group.group_calculate; - } -} diff --git a/src/lib/elementary/efl_ui_list_view_precise_layouter.c b/src/lib/elementary/efl_ui_list_view_precise_layouter.c deleted file mode 100644 index a7ee6ec102..0000000000 --- a/src/lib/elementary/efl_ui_list_view_precise_layouter.c +++ /dev/null @@ -1,728 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include - -#include - -#include "elm_priv.h" -#include "efl_ui_list_view_relayout.eo.h" -#include "efl_ui_list_view_seg_array.h" - -#define MY_CLASS EFL_UI_LIST_VIEW_PRECISE_LAYOUTER_CLASS - -typedef struct _Efl_Ui_List_View_Precise_Layouter_Data -{ - Efl_Model* model; - Efl_Ui_List_View_Model *modeler; - Ecore_Job *calc_job; - Efl_Ui_List_View_Seg_Array *seg_array; - - Eina_Size2D min; - - unsigned int calc_progress; - - int count_total; - - Eina_Bool initialized : 1; - Eina_Bool recalc : 1; - Eina_Bool resize : 1; -} Efl_Ui_List_View_Precise_Layouter_Data; - -typedef struct _Efl_Ui_List_View_Precise_Layouter_Node_Data -{ - Eina_Size2D min; - Eina_Size2D size; - - Eina_Bool realized; -} Efl_Ui_List_View_Precise_Layouter_Node_Data; - -typedef struct _Efl_Ui_List_View_Precise_Layouter_Callback_Data -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd; - Efl_Ui_List_View_Layout_Item *item; -} Efl_Ui_List_View_Precise_Layouter_Callback_Data; - -#include "efl_ui_list_view_precise_layouter.eo.h" - -static void _efl_ui_list_view_relayout_layout_do(Efl_Ui_List_View_Precise_Layouter_Data *); -static Eina_Bool _initilize(Eo *, Efl_Ui_List_View_Precise_Layouter_Data*, Efl_Ui_List_View_Model*, Efl_Ui_List_View_Seg_Array*); -static void _finalize(Eo *, Efl_Ui_List_View_Precise_Layouter_Data*); -static void _node_realize(Efl_Ui_List_View_Precise_Layouter_Data*, Efl_Ui_List_View_Seg_Array_Node*); -static void _node_unrealize(Efl_Ui_List_View_Precise_Layouter_Data*, Efl_Ui_List_View_Seg_Array_Node*); - -static void -_item_size_calc(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layout_Item* item) -{ - int boxx, boxy, boxw, boxh, boxl, boxr, boxt, boxb, pad[4]; - double align[2]; - Eina_Bool fill[2]; - Eina_Size2D max; - - efl_gfx_hint_margin_get(item->layout, &pad[0], &pad[1], &pad[2], &pad[3]); - evas_object_geometry_get(pd->modeler, &boxx, &boxy, &boxw, &boxh); - efl_gfx_hint_margin_get(pd->modeler, &boxl, &boxr, &boxt, &boxb); - efl_gfx_hint_align_get(item->layout, &align[0], &align[1]); - efl_gfx_hint_fill_get(item->layout, &fill[0], &fill[1]); - max = efl_gfx_hint_size_combined_max_get(item->layout); - - // box outer margin - boxw -= boxl + boxr; - boxh -= boxt + boxb; - boxx += boxl; - boxy += boxt; - - if (EINA_DBL_EQ(align[0], -1)) - { - align[0] = 0.5; - fill[0] = EINA_TRUE; - } - else if (align[0] < 0) - { - align[0] = 0; - } - if (EINA_DBL_EQ(align[1], -1)) - { - align[1] = 0.5; - fill[1] = EINA_TRUE; - } - else if (align[1] < 0) - { - align[1] = 0; - } - - if (align[0] > 1) align[0] = 1; - if (align[1] > 1) align[1] = 1; - - if (max.w <= 0) max.w = INT_MAX; - if (max.h <= 0) max.h = INT_MAX; - if (max.w < item->min.w) max.w = item->min.w; - if (max.h < item->min.h) max.h = item->min.h; - - // horizontally - if (max.w < INT_MAX) - { - item->size.w = MIN(MAX(item->min.w - pad[0] - pad[1], max.w), boxw); - item->pos.x = boxx + pad[0]; - } - else if (fill[0]) - { - // fill x - item->size.w = boxw - pad[0] - pad[1]; - item->pos.x = boxx + pad[0]; - } - else - { - item->size.w = item->min.w - pad[0] - pad[1]; - item->pos.x = boxx + ((boxw - item->size.w) * align[0]) + pad[0]; - } - - // vertically - if (max.h < INT_MAX) - { - item->size.h = MIN(MAX(item->min.h - pad[2] - pad[3], max.h), boxh); - item->pos.y = boxy + pad[2]; - } - else if (fill[1]) - { - // fill y - item->size.h = item->min.h - pad[2] - pad[3]; - item->pos.y = boxy + pad[2]; - } - else - { - item->size.h = item->min.h - pad[2] - pad[3]; - item->pos.y = boxy + ((item->min.h - item->size.h) * align[1]) + pad[2]; - } -} - -static Eina_Size2D -_item_min_calc(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layout_Item* item) -{ - Efl_Ui_List_View_Seg_Array_Node *itemnode = item->tree_node; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata; - Efl_Ui_List_View_Layout_Item *layout_item; - int i, pad[4]; - - Eina_Size2D min = efl_gfx_hint_size_combined_min_get(item->layout); - - efl_gfx_hint_margin_get(item->layout, &pad[0], &pad[1], &pad[2], &pad[3]); - min.w += pad[0] + pad[1]; - min.h += pad[2] + pad[3]; - - if (item->min.h == min.h && item->min.w == min.w) - return min; - - EINA_SAFETY_ON_NULL_RETURN_VAL(itemnode, min); - EINA_SAFETY_ON_NULL_RETURN_VAL(itemnode->layout_data, min); - nodedata = itemnode->layout_data; - - pd->min.h += min.h - item->min.h; - nodedata->min.h += min.h - item->min.h; - - if (nodedata->min.w <= min.w) - nodedata->min.w = min.w; - else if (nodedata->min.w == item->min.w) - { - nodedata->min.w = 0; - for (i = 0; i != itemnode->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)itemnode->pointers[i]; - if (nodedata->min.w < layout_item->min.w) - nodedata->min.w = layout_item->min.w; - - if (item->min.w == layout_item->min.w) - break; - } - } - - if (pd->min.w <= min.w) - pd->min.w = min.w; - else if (pd->min.w == item->min.w) - { - Efl_Ui_List_View_Seg_Array_Node *node2; - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - pd->min.w = min.w; - - EINA_ACCESSOR_FOREACH(nodes, i, node2) - { - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata2 = node2->layout_data; - if (pd->min.w < nodedata2->min.w) - pd->min.w = nodedata2->min.w; - - if (item->min.w == nodedata2->min.w) - break; - } - eina_accessor_free(nodes); - } - - item->min.w = min.w; - item->min.h = min.h; - return item->min; -} - -static void -_on_item_size_hint_change(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data = data; - Efl_Ui_List_View_Precise_Layouter_Data *pd = cb_data->pd; - Efl_Ui_List_View_Layout_Item *item = cb_data->item;; - Efl_Ui_List_View_Seg_Array_Node *node = item->tree_node; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; - - _item_min_calc(pd, item); - if (!nodedata->realized) - { - free(evas_object_event_callback_del(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change)); - efl_ui_list_view_model_unrealize(pd->modeler, item); - } -} - -static void -_on_modeler_resize(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd = data; - pd->resize = EINA_TRUE; -} - -typedef struct _Request Request; -struct _Request -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd; - unsigned int index; -}; - -static Eina_Value -_children_get(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) -{ - Request *r = data; - - if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ERROR) - goto on_error; - - efl_ui_list_view_seg_array_insert_value(r->pd->seg_array, r->index, v); - r->pd->recalc = EINA_TRUE; - evas_object_smart_changed(r->pd->modeler); - - on_error: - free(r); - return v; -} - -static void -_child_added_cb(void *data, const Efl_Event *event) -{ - Efl_Model_Children_Event* evt = event->info; - Efl_Ui_List_View_Precise_Layouter_Data *pd = data; - Eina_Future *f; - Request *r; - - r = calloc(1, sizeof (Request)); - if (!r) return; - - r->index = evt->index; - r->pd = pd; - - f = efl_model_children_slice_get(pd->model, evt->index, 1); - f = eina_future_then(f, _children_get, r, NULL); -} - -static void -_child_removed_cb(void *data, const Efl_Event *event) -{ - Efl_Model_Children_Event* evt = event->info; - Efl_Ui_List_View_Precise_Layouter_Data *pd = data; - Efl_Ui_List_View_Layout_Item *layout_item, *litem; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata; - Efl_Ui_List_View_Seg_Array_Node *itemnode; - int i; - - litem = efl_ui_list_view_seg_array_remove(pd->seg_array, evt->index); - if (!litem) return; - - itemnode = litem->tree_node; - nodedata = itemnode->layout_data; - - free(evas_object_event_callback_del(litem->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change)); - - pd->min.h -= litem->min.h; - nodedata->min.h -= litem->min.h; - - if (nodedata->min.w == litem->min.w) - nodedata->min.w = 0; - - for (i = 0; i != itemnode->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)itemnode->pointers[i]; - if (nodedata->min.w < layout_item->min.w) - nodedata->min.w = layout_item->min.w; - - if (litem->min.w == layout_item->min.w) - { - nodedata->min.w = layout_item->min.w; - break; - } - } - - if (pd->min.w == litem->min.w) - { - Efl_Ui_List_View_Seg_Array_Node *node2; - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - pd->min.w = 0; - - EINA_ACCESSOR_FOREACH(nodes, i, node2) - { - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata2 = node2->layout_data; - if (pd->min.w < nodedata2->min.w) - pd->min.w = nodedata2->min.w; - - if (litem->min.w == nodedata2->min.w) - break; - } - eina_accessor_free(nodes); - } - efl_ui_list_view_model_unrealize(pd->modeler, litem); - - free(litem); - pd->recalc = EINA_TRUE; - evas_object_smart_changed(pd->modeler); -} - -static void -_child_count_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd = data; - pd->count_total = efl_model_children_count_get(pd->model); - if (pd->count_total) - efl_event_callback_del(pd->model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _child_count_changed_cb, pd); -} - -static Eina_Bool -_initilize(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Model *modeler, Efl_Ui_List_View_Seg_Array *seg_array) -{ - if(pd->initialized) - return EINA_TRUE; - - efl_replace(&pd->modeler, modeler); - - if(!pd->model || !pd->modeler) - return EINA_FALSE; - - pd->recalc = EINA_TRUE; - pd->initialized = EINA_TRUE; - - pd->seg_array = seg_array; - - efl_ui_list_view_model_load_range_set(pd->modeler, 0, pd->count_total); // load all - efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILD_ADDED, _child_added_cb, pd); - efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILD_REMOVED, _child_removed_cb, pd); - - evas_object_event_callback_add(modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd); - pd->min.w = 0; - pd->min.h = 0; - - return EINA_TRUE; -} - -static void -_finalize(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - Efl_Ui_List_View_Seg_Array_Node* node; - int i = 0; - - if (pd->model) - { - efl_event_callback_del(pd->model, EFL_MODEL_EVENT_CHILD_ADDED, _child_added_cb, pd); - efl_event_callback_del(pd->model, EFL_MODEL_EVENT_CHILD_REMOVED, _child_removed_cb, pd); - pd->count_total = 0; - } - - if (pd->seg_array) - { - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - EINA_ACCESSOR_FOREACH(nodes, i, node) - { - _node_unrealize(pd, node); - free(node->layout_data); - } - - eina_accessor_free(nodes); - } - - pd->min.w = 0; - pd->min.h = 0; - - if (pd->modeler) - { - evas_object_event_callback_del_full(pd->modeler, EVAS_CALLBACK_RESIZE, _on_modeler_resize, pd); - efl_ui_list_view_model_min_size_set(pd->modeler, pd->min); - } - - pd->seg_array = NULL; - efl_replace(&pd->modeler, NULL); - - pd->initialized = EINA_FALSE; - pd->recalc = EINA_TRUE; -} - -static void -_node_realize(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Seg_Array_Node *node) -{ - Efl_Ui_List_View_Layout_Item* layout_item; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; - int i; - - EINA_SAFETY_ON_NULL_RETURN(nodedata); - if (nodedata->realized) - return; - - nodedata->realized = EINA_TRUE; - - for (i = 0; i != node->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i]; - efl_ui_list_view_model_realize(pd->modeler, layout_item); - } -} - -static void -_node_unrealize(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Seg_Array_Node *node) -{ - Efl_Ui_List_View_Layout_Item* layout_item; - Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; - int i; - - EINA_SAFETY_ON_NULL_RETURN(nodedata); - if (!nodedata->realized) - return; - - nodedata->realized = EINA_FALSE; - - for (i = 0; i != node->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i]; - if (layout_item->layout) - { - cb_data = evas_object_event_callback_del(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change); - free(cb_data); - efl_ui_list_view_model_unrealize(pd->modeler, layout_item); - } - } -} - -static void -_calc_range(Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - Efl_Ui_List_View_Seg_Array_Node *node; - Evas_Coord ch, ny; - Eina_Rect vgmt; - Eina_Position2D spos; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata; - int i; - - vgmt = efl_ui_scrollable_viewport_geometry_get(pd->modeler); - spos = efl_ui_scrollable_content_pos_get(pd->modeler); - - ny = spos.y - (vgmt.h / 2); - if (ny < 0) spos.y = 0; - else spos.y = ny; - vgmt.h *= 2; - - ch = 0; - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - EINA_ACCESSOR_FOREACH(nodes, i, node) - { - nodedata = node->layout_data; - if (!nodedata || !nodedata->min.h) - continue; - - if ((ch > spos.y || nodedata->min.h + ch > spos.y) && (ch < (spos.y + vgmt.h) || nodedata->min.h + ch < spos.y + vgmt.h)) - _node_realize(pd, node); - else - _node_unrealize(pd, node); - - ch += nodedata->min.h; - } - eina_accessor_free(nodes); -} - -static void -_calc_size_job(void *data) -{ - Efl_Ui_List_View_Precise_Layouter_Data *pd; - Efl_Ui_List_View_Seg_Array_Node *node; - Efl_Ui_List_View_Layout_Item *layout_item; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata; - Eo *obj = data; - int i; - double start_time = ecore_time_get(); - - EINA_SAFETY_ON_NULL_RETURN(data); - pd = efl_data_scope_get(obj, MY_CLASS); - if (EINA_UNLIKELY(!pd)) return; - - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - while (eina_accessor_data_get(nodes, pd->calc_progress, (void **)&node)) - { - pd->calc_progress++; - if (!node->layout_data) - node->layout_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Node_Data)); - - nodedata = node->layout_data; - if (pd->calc_progress == 1) - nodedata->realized = EINA_TRUE; - - for (i = 0; i != node->length; ++i) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i]; - EINA_SAFETY_ON_NULL_RETURN(layout_item); - - // cache size of new items - if ((layout_item->min.w == 0) && (layout_item->min.h == 0) && (!layout_item->layout)) - efl_ui_list_view_model_realize(pd->modeler, layout_item); - } - - if ( (ecore_time_get() - start_time ) > 0.01 ) - { - ecore_job_del(pd->calc_job); - pd->calc_job = ecore_job_add(_calc_size_job, obj); - eina_accessor_free(nodes); - return; - } - } - eina_accessor_free(nodes); - pd->calc_progress = 0; - pd->calc_job = NULL; - pd->recalc = EINA_FALSE; -} - -EOLIAN static Efl_Object * -_efl_ui_list_view_precise_layouter_efl_object_constructor(Eo *obj, Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - obj = efl_constructor(efl_super(obj, MY_CLASS)); - pd->initialized = EINA_FALSE; - - return obj; -} - -EOLIAN static void -_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_content_created(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layout_Item *item) -{ - Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data; - EINA_SAFETY_ON_NULL_RETURN(item); - EINA_SAFETY_ON_NULL_RETURN(item->layout); - Efl_Ui_List_View_Seg_Array_Node *node = item->tree_node; - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; - - Eina_Size2D min = _item_min_calc(pd, item); - - if (min.w && min.h && !nodedata->realized) - { - efl_ui_list_view_model_unrealize(pd->modeler, item); - return; - } - - cb_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Callback_Data)); - if (!cb_data) return; - cb_data->pd = pd; - cb_data->item = item; - evas_object_event_callback_add(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data); - - _item_size_calc(pd, item); -} - -EOLIAN static Eina_List * -_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_elements_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - Eina_List *elements_order = NULL; - Efl_Ui_List_View_Layout_Item* layout_item; - Efl_Ui_List_View_Seg_Array_Node *items_node; - int i, j = 0; - - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - EINA_ACCESSOR_FOREACH(nodes, i, items_node) - { - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = items_node->layout_data; - if (!nodedata || !nodedata->realized) - continue; - - for (j = 0; j != items_node->length;++j) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)items_node->pointers[j]; - if (layout_item->layout) - elements_order = eina_list_append(elements_order, layout_item->layout); - } - } - - eina_accessor_free(nodes); - return elements_order; -} - -EOLIAN static void -_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_model_set(Eo *obj, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Model *model) -{ - _finalize(obj, pd); - - efl_replace(&pd->model, model); - - if (pd->model) - { - pd->count_total = efl_model_children_count_get(pd->model); - if (pd->count_total && pd->modeler) - efl_ui_list_view_model_load_range_set(pd->modeler, 0, pd->count_total); // load all - else - efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _child_count_changed_cb, pd); - } -} - -static void -_efl_ui_list_view_relayout_layout_do(Efl_Ui_List_View_Precise_Layouter_Data *pd) -{ - Eina_Rect vgmt; - Eina_Position2D spos; - double cur_pos = 0; - Efl_Ui_List_View_Layout_Item* layout_item; - Efl_Ui_List_View_Seg_Array_Node *items_node; - int i, j = 0; - int boxx, boxy, boxw, boxh, extra = 0, rounding = 0; - int boxl = 0, boxr = 0, boxt = 0, boxb = 0; - - _calc_range(pd); - - evas_object_geometry_get(pd->modeler, &boxx, &boxy, &boxw, &boxh); - efl_gfx_hint_margin_get(pd->modeler, &boxl, &boxr, &boxt, &boxb); - - // box outer margin - boxw -= boxl + boxr; - boxh -= boxt + boxb; - boxx += boxl; - boxy += boxt; - - // available space. if <0 we overflow - extra = boxh - pd->min.h; - if (extra < 0) extra = 0; - - efl_ui_list_view_model_min_size_set(pd->modeler, pd->min); - - vgmt = efl_ui_scrollable_viewport_geometry_get(pd->modeler); - spos = efl_ui_scrollable_content_pos_get(pd->modeler); - - Eina_Accessor *nodes = efl_ui_list_view_seg_array_node_accessor_get(pd->seg_array); - EINA_ACCESSOR_FOREACH(nodes, i, items_node) - { - Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = items_node->layout_data; - if (!items_node->layout_data) - continue; - - if (!nodedata->realized) - { - cur_pos += nodedata->min.h; - continue; - } - - for (j = 0; j != items_node->length;++j) - { - layout_item = (Efl_Ui_List_View_Layout_Item *)items_node->pointers[j]; - double x, y, w, h; - double weight_x, weight_y; - if (!(layout_item->min.w && layout_item->min.h)) - continue; - - // extra rounding up (compensate cumulative error) - if ((i == (pd->count_total - 1)) && (cur_pos - floor(cur_pos) >= 0.5)) - rounding = 1; - - if (layout_item->layout) - { - if (pd->resize) - _item_size_calc(pd, layout_item); - - efl_gfx_hint_weight_get(layout_item->layout, &weight_x, &weight_y); - } - else - { - cur_pos += layout_item->size.h; - continue; - } - - x = layout_item->pos.x; - y = layout_item->pos.y + cur_pos; - w = layout_item->size.w; - h = layout_item->size.h + rounding + weight_y * extra; - cur_pos += h; - - if (w < pd->min.w) w = pd->min.w; - if (w > vgmt.w) w = vgmt.w; - - evas_object_geometry_set(layout_item->layout, (x + 0 - spos.x), (y + 0 - spos.y), w, h); - } - } - eina_accessor_free(nodes); - - pd->resize = EINA_FALSE; -} - -EOLIAN static void -_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_layout_do - (Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd - , Efl_Ui_List_View_Model *modeler, int first EINA_UNUSED, Efl_Ui_List_View_Seg_Array *seg_array) -{ - if (!_initilize(obj, pd, modeler, seg_array) || !pd->seg_array) - return; - - if (!pd->calc_job && pd->recalc && efl_ui_list_view_seg_array_count(seg_array) > 0) - { - // cache size of new items - pd->calc_progress = 0; - pd->calc_job = ecore_job_add(_calc_size_job, obj); - return; - } - - _efl_ui_list_view_relayout_layout_do(pd); -} - -#include "efl_ui_list_view_precise_layouter.eo.c" diff --git a/src/lib/elementary/efl_ui_list_view_precise_layouter.eo b/src/lib/elementary/efl_ui_list_view_precise_layouter.eo deleted file mode 100644 index 0a83c0a08b..0000000000 --- a/src/lib/elementary/efl_ui_list_view_precise_layouter.eo +++ /dev/null @@ -1,10 +0,0 @@ -class @beta Efl.Ui.List_View_Precise_Layouter extends Efl.Object implements Efl.Ui.List_View_Relayout -{ - implements { - Efl.Object.constructor; - Efl.Ui.List_View_Relayout.layout_do; - Efl.Ui.List_View_Relayout.content_created; - Efl.Ui.List_View_Relayout.model { set; } - Efl.Ui.List_View_Relayout.elements { get; } - } -} diff --git a/src/lib/elementary/efl_ui_list_view_private.h b/src/lib/elementary/efl_ui_list_view_private.h deleted file mode 100644 index 2443cf4438..0000000000 --- a/src/lib/elementary/efl_ui_list_view_private.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef EFL_UI_LIST_VIEW_PRIVATE_H -#define EFL_UI_LIST_VIEW_PRIVATE_H - -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include -#include "efl_ui_list_view_relayout.eo.h" -#include "efl_ui_list_view_pan.eo.h" -#include "elm_priv.h" - -typedef struct _Efl_Ui_List_View_Data Efl_Ui_List_View_Data; -int efl_ui_list_view_item_index_get(Efl_Ui_List_View_Layout_Item *item); - -#include "efl_ui_list_view_seg_array.h" - -struct _Efl_Ui_List_View_Data -{ - Eo *obj; - Eo *scrl_mgr; - Efl_Ui_List_View_Pan *pan_obj; - Efl_Model *model; - - Eina_Stringshare *style; - - struct { - Eina_Future *future; - - int start; - int count; - } slice; - - Efl_Ui_Layout_Factory *factory; - Eina_List *selected_items; - - Efl_Ui_Focus_Manager *manager; - Efl_Ui_List_View_Relayout *relayout; - Efl_Ui_List_View_Seg_Array *seg_array; - int seg_array_first; - - Elm_Object_Select_Mode select_mode; - Eina_Size2D min; - - Eina_Bool homogeneous : 1; - Eina_Bool scrl_freeze : 1; -}; - -typedef struct _Efl_Ui_List_View_Pan_Data Efl_Ui_List_View_Pan_Data; - -struct _Efl_Ui_List_View_Pan_Data -{ - Eo *wobj; - Eina_Rect gmt; -}; - -#define EFL_UI_LIST_VIEW_DATA_GET(o, ptr) \ - Efl_Ui_List_View_Data * ptr = efl_data_scope_get(o, EFL_UI_LIST_VIEW_CLASS) - -#define EFL_UI_LIST_VIEW_DATA_GET_OR_RETURN(o, ptr) \ - EFL_UI_LIST_VIEW_DATA_GET(o, ptr); \ - if (EINA_UNLIKELY(!ptr)) \ - { \ - ERR("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return; \ - } - -#define EFL_UI_LIST_VIEW_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ - EFL_UI_LIST_VIEW_DATA_GET(o, ptr); \ - if (EINA_UNLIKELY(!ptr)) \ - { \ - ERR("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return val; \ - } - -#endif diff --git a/src/lib/elementary/efl_ui_list_view_relayout.eo b/src/lib/elementary/efl_ui_list_view_relayout.eo deleted file mode 100644 index 07b5dc65bb..0000000000 --- a/src/lib/elementary/efl_ui_list_view_relayout.eo +++ /dev/null @@ -1,30 +0,0 @@ -interface @beta Efl.Ui.List_View_Relayout -{ - methods { - layout_do { - params { - modeler: Efl.Ui.List_View_Model; - first: int; - children: ptr(Efl_Ui_List_View_Seg_Array); - } - } - content_created { - params { - item: ptr(Efl.Ui.List_View_Layout_Item); - } - } - @property model { - [[Model that is/will be ]] - set {} - values { - model: Efl.Model; [[Efl model]] - } - } - @property elements { - get {} - values { - elements: list; [[The order to use]] - } - } - } -} diff --git a/src/lib/elementary/efl_ui_list_view_seg_array.c b/src/lib/elementary/efl_ui_list_view_seg_array.c deleted file mode 100644 index 50f33b340b..0000000000 --- a/src/lib/elementary/efl_ui_list_view_seg_array.c +++ /dev/null @@ -1,477 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include "elm_priv.h" -#include - -#include "efl_ui_list_view_private.h" -#include "efl_ui_list_view_seg_array.h" - -static int -_search_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int length EINA_UNUSED, void* data EINA_UNUSED) -{ - Efl_Ui_List_View_Seg_Array_Node const* node = (void const*)rbtree; - int index = *(int*)key; - if(index < node->first) - { - return 1; - } - else if(index < node->first + node->length) - { - return 0; - } - else - { - return -1; - } -} - -static int -_insert_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int length EINA_UNUSED, void* data EINA_UNUSED) -{ - Efl_Ui_List_View_Seg_Array_Node const* node = (void const*)rbtree; - int index = *(int*)key; - if(index < node->first) - { - return 1; - } - else if(index < node->first + node->max) - { - return 0; - } - else - { - return -1; - } -} - -static Eina_Rbtree_Direction -_rbtree_compare(Efl_Ui_List_View_Seg_Array_Node const* left, - Efl_Ui_List_View_Seg_Array_Node const* right, void* data EINA_UNUSED) -{ - if(left->first < right->first) - return EINA_RBTREE_LEFT; - else - return EINA_RBTREE_RIGHT; -} - -static void -_free_node(Efl_Ui_List_View_Seg_Array_Node* node, void* data EINA_UNUSED) -{ - int i = 0; - - while (i < node->length) - { - Efl_Ui_List_View_Layout_Item* item = node->pointers[i]; - efl_unref(item->children); - free(item); - ++i; - } - - free(node); -} - -static Efl_Ui_List_View_Seg_Array_Node* -_alloc_node(Efl_Ui_List_View_Seg_Array* pd, int first) -{ - Efl_Ui_List_View_Seg_Array_Node* node; - node = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array_Node) + pd->step_size*sizeof(Efl_Ui_List_View_Layout_Item*)); - if (!node) return NULL; - node->first = first; - node->max = pd->step_size; - pd->root = (void*)eina_rbtree_inline_insert(EINA_RBTREE_GET(pd->root), EINA_RBTREE_GET(node), - EINA_RBTREE_CMP_NODE_CB(&_rbtree_compare), NULL); - pd->node_count++; - return node; -} - -static Efl_Ui_List_View_Layout_Item* -_create_item_partial(Efl_Model* model) -{ - Efl_Ui_List_View_Layout_Item* item = calloc(1, sizeof(Efl_Ui_List_View_Layout_Item)); - if (!item) return NULL; - item->children = efl_ref(model); - return item; -} - -static Efl_Ui_List_View_Layout_Item* -_create_item(Efl_Model* model, Efl_Ui_List_View_Seg_Array_Node* node, unsigned int index) -{ - Efl_Ui_List_View_Layout_Item* item = _create_item_partial(model); - item->index_offset = index - node->first; - item->tree_node = node; - return item; -} - -static void -_efl_ui_list_view_seg_array_insert_at_node(Efl_Ui_List_View_Seg_Array* pd, int index, - Efl_Ui_List_View_Layout_Item* item, Efl_Ui_List_View_Seg_Array_Node* node) -{ - Eina_Iterator* iterator; - int pos; - - if(node && node->length != node->max && (index - node->first) <= node->length) - { - pos = index - node->first; - item->tree_node = node; - item->index_offset = pos; - if(pos < node->length) - { - assert(node->length != node->max); - - memmove(&node->pointers[pos], &node->pointers[pos+1], sizeof(node->pointers[pos])*(node->length - pos)); - node->pointers[pos] = item; - node->length++; - } - else - { - assert(pos == node->length); - - assert(node->length != node->max); - node->pointers[pos] = item; - node->length++; - } - } - else - { - node = _alloc_node(pd, index); - node->pointers[0] = item; - node->length++; - item->index_offset = 0; - item->tree_node = node; - } - - node = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT]; - iterator = eina_rbtree_iterator_infix((void*)node); - while(eina_iterator_next(iterator, (void**)&node)) - { - node->first++; - } - - eina_iterator_free(iterator); -} - -static void -_efl_ui_list_view_seg_array_insert_object(Efl_Ui_List_View_Seg_Array *pd, unsigned int index, Efl_Model *children) -{ - Efl_Ui_List_View_Seg_Array_Node *node; - - node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root), - &index, sizeof(index), &_insert_lookup_cb, NULL); - if (!node) - { - node = _alloc_node(pd, index); - } - - assert(node->length < node->max); - node->pointers[node->length] = _create_item(children, node, index); - node->length++; - pd->count++; -} - -typedef struct _Efl_Ui_List_View_Segarray_Eina_Accessor -{ - Eina_Accessor vtable; - Efl_Ui_List_View_Seg_Array* seg_array; -} Efl_Ui_List_View_Segarray_Eina_Accessor; - -static Eina_Bool -_efl_ui_list_view_seg_array_accessor_get_at(Efl_Ui_List_View_Segarray_Eina_Accessor* acc, - int idx, void** data) -{ - Efl_Ui_List_View_Seg_Array_Node* node; - node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(acc->seg_array->root), - &idx, sizeof(idx), &_search_lookup_cb, NULL); - if (node && (node->first <= idx && node->first + node->length > idx)) - { - int i = idx - node->first; - Efl_Ui_List_View_Layout_Item* item = node->pointers[i]; - *data = item; - return EINA_TRUE; - } - return EINA_FALSE; -} - -static void* -_efl_ui_list_view_seg_array_accessor_get_container(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - return NULL; -} - -static void -_efl_ui_list_view_seg_array_accessor_free(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - free(acc); -} - -static Eina_Bool -_efl_ui_list_view_seg_array_accessor_lock(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_efl_ui_list_view_seg_array_accessor_unlock(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Accessor* -_efl_ui_list_view_seg_array_accessor_clone(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED) -{ - return &acc->vtable; -} - -static void -_efl_ui_list_view_seg_array_accessor_setup(Efl_Ui_List_View_Segarray_Eina_Accessor* acc, Efl_Ui_List_View_Seg_Array* seg_array) -{ - EINA_MAGIC_SET(&acc->vtable, EINA_MAGIC_ACCESSOR); - acc->vtable.version = EINA_ACCESSOR_VERSION; - acc->vtable.get_at = FUNC_ACCESSOR_GET_AT(_efl_ui_list_view_seg_array_accessor_get_at); - acc->vtable.get_container = FUNC_ACCESSOR_GET_CONTAINER(_efl_ui_list_view_seg_array_accessor_get_container); - acc->vtable.free = FUNC_ACCESSOR_FREE(_efl_ui_list_view_seg_array_accessor_free); - acc->vtable.lock = FUNC_ACCESSOR_LOCK(_efl_ui_list_view_seg_array_accessor_lock); - acc->vtable.unlock = FUNC_ACCESSOR_LOCK(_efl_ui_list_view_seg_array_accessor_unlock); - acc->vtable.clone = FUNC_ACCESSOR_CLONE(_efl_ui_list_view_seg_array_accessor_clone); - acc->seg_array = seg_array; -} - -typedef struct _Efl_Ui_List_View_Segarray_Node_Accessor -{ - Eina_Accessor vtable; - Efl_Ui_List_View_Seg_Array* seg_array; - Eina_Iterator* pre_iterator; - Efl_Ui_List_View_Seg_Array_Node* current_node; - int current_index; -} Efl_Ui_List_View_Segarray_Node_Accessor; - -static Eina_Bool -_efl_ui_list_view_seg_array_node_accessor_get_at(Efl_Ui_List_View_Segarray_Node_Accessor* acc, - int idx, void** data) -{ - if(idx == acc->current_index && acc->current_node) - { - (*data) = acc->current_node; - } - else - { - if(acc->current_index >= idx || !acc->current_node) - { - eina_iterator_free(acc->pre_iterator); - acc->pre_iterator = NULL; - acc->current_node = NULL; - acc->current_index = -1; - } - - if(!acc->pre_iterator) - acc->pre_iterator = eina_rbtree_iterator_infix((void*)acc->seg_array->root); - - for(;acc->current_index != idx;++acc->current_index) - { - if(!eina_iterator_next(acc->pre_iterator, (void**)&acc->current_node)) - { - --acc->current_index; - return EINA_FALSE; - } - } - (*data) = acc->current_node; - return EINA_TRUE; - } - return EINA_FALSE; -} - -static void* -_efl_ui_list_view_seg_array_node_accessor_get_container(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - return NULL; -} - -static void -_efl_ui_list_view_seg_array_node_accessor_free(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - if (acc->pre_iterator) - eina_iterator_free(acc->pre_iterator); - free(acc); -} - -static Eina_Bool -_efl_ui_list_view_seg_array_node_accessor_lock(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Bool -_efl_ui_list_view_seg_array_node_accessor_unlock(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - return EINA_FALSE; -} - -static Eina_Accessor* -_efl_ui_list_view_seg_array_node_accessor_clone(Efl_Ui_List_View_Segarray_Node_Accessor* acc EINA_UNUSED) -{ - return &acc->vtable; -} - -static void -_efl_ui_list_view_seg_array_node_accessor_setup(Efl_Ui_List_View_Segarray_Node_Accessor* acc, Efl_Ui_List_View_Seg_Array* seg_array) -{ - EINA_MAGIC_SET(&acc->vtable, EINA_MAGIC_ACCESSOR); - acc->vtable.version = EINA_ACCESSOR_VERSION; - acc->vtable.get_at = FUNC_ACCESSOR_GET_AT(_efl_ui_list_view_seg_array_node_accessor_get_at); - acc->vtable.get_container = FUNC_ACCESSOR_GET_CONTAINER(_efl_ui_list_view_seg_array_node_accessor_get_container); - acc->vtable.free = FUNC_ACCESSOR_FREE(_efl_ui_list_view_seg_array_node_accessor_free); - acc->vtable.lock = FUNC_ACCESSOR_LOCK(_efl_ui_list_view_seg_array_node_accessor_lock); - acc->vtable.unlock = FUNC_ACCESSOR_LOCK(_efl_ui_list_view_seg_array_node_accessor_unlock); - acc->vtable.clone = FUNC_ACCESSOR_CLONE(_efl_ui_list_view_seg_array_node_accessor_clone); - acc->seg_array = seg_array; - acc->pre_iterator = NULL; - acc->current_index = -1; - acc->current_node = NULL; -} - -/* External Functions */ - -Efl_Ui_List_View_Seg_Array * -efl_ui_list_view_seg_array_setup(int size) -{ - Efl_Ui_List_View_Seg_Array *pd = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array)); - if (!pd) return NULL; - pd->step_size = size; - - return pd; -} - -void -efl_ui_list_view_seg_array_free(Efl_Ui_List_View_Seg_Array *pd) -{ - if (pd->root) - eina_rbtree_delete(EINA_RBTREE_GET(pd->root), EINA_RBTREE_FREE_CB(_free_node), NULL); - - pd->root = NULL; - free(pd); -} - -void -efl_ui_list_view_seg_array_flush(Efl_Ui_List_View_Seg_Array *pd) -{ - if (pd->root) - eina_rbtree_delete(EINA_RBTREE_GET(pd->root), EINA_RBTREE_FREE_CB(_free_node), NULL); - - pd->root = NULL; - pd->node_count = 0; - pd->count = 0; -} - -int -efl_ui_list_view_seg_array_count(Efl_Ui_List_View_Seg_Array* pd) -{ - return pd->count; -} - -void -efl_ui_list_view_seg_array_insert(Efl_Ui_List_View_Seg_Array* pd, int index, Efl_Model* model) -{ - Efl_Ui_List_View_Seg_Array_Node* node, *next; - Efl_Ui_List_View_Layout_Item* item; - - item = _create_item_partial(model); - - node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root), - &index, sizeof(index), &_insert_lookup_cb, NULL); - if(node) - { - next = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT]; - if(next && next->first <= index) - _efl_ui_list_view_seg_array_insert_at_node(pd, index, item, next); - else - _efl_ui_list_view_seg_array_insert_at_node(pd, index, item, node); - } - else - _efl_ui_list_view_seg_array_insert_at_node(pd, index, item, NULL); -} - -void -efl_ui_list_view_seg_array_insert_value(Efl_Ui_List_View_Seg_Array *pd, int first, Eina_Value v) -{ - Efl_Model *children; - unsigned int i, len; - - if (eina_value_type_get(&v) == EINA_VALUE_TYPE_OBJECT) - { - children = eina_value_object_get(&v); - _efl_ui_list_view_seg_array_insert_object(pd, first, children); - } - else if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ARRAY) - { - EINA_VALUE_ARRAY_FOREACH(&v, len, i, children) - { - unsigned int idx = first + i; - - _efl_ui_list_view_seg_array_insert_object(pd, idx, children); - } - } - else - { - printf("Unknow type !\n"); - } -} - - -Efl_Ui_List_View_Layout_Item* -efl_ui_list_view_seg_array_remove(Efl_Ui_List_View_Seg_Array *pd, int index) -{ - Efl_Ui_List_View_Seg_Array_Node *node; - Efl_Ui_List_View_Layout_Item *item, *rt; - Eina_Iterator* iterator; - int offset; - - node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root), - &index, sizeof(index), &_insert_lookup_cb, NULL); - if (!node) return NULL; - - offset = index - node->first; - if (offset >= node->length) return NULL; - - rt = node->pointers[offset]; - pd->count--; - node->length--; - - while (offset < node->length) - { - node->pointers[offset] = node->pointers[offset+1]; - item = node->pointers[offset]; - --item->index_offset; - ++offset; - } - - node = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT]; - iterator = eina_rbtree_iterator_infix((void*)node); - while(eina_iterator_next(iterator, (void**)&node)) - node->first--; - - return rt; -} - -Eina_Accessor* -efl_ui_list_view_seg_array_accessor_get(Efl_Ui_List_View_Seg_Array* pd) -{ - Efl_Ui_List_View_Segarray_Eina_Accessor* acc = calloc(1, sizeof(Efl_Ui_List_View_Segarray_Eina_Accessor)); - _efl_ui_list_view_seg_array_accessor_setup(acc, pd); - return &acc->vtable; -} - -Eina_Accessor* -efl_ui_list_view_seg_array_node_accessor_get(Efl_Ui_List_View_Seg_Array* pd) -{ - Efl_Ui_List_View_Segarray_Node_Accessor* acc = calloc(1, sizeof(Efl_Ui_List_View_Segarray_Node_Accessor)); - _efl_ui_list_view_seg_array_node_accessor_setup(acc, pd); - return &acc->vtable; -} - -int -efl_ui_list_view_item_index_get(Efl_Ui_List_View_Layout_Item* item) -{ - Efl_Ui_List_View_Seg_Array_Node* node = item->tree_node; - return item->index_offset + node->first; -} diff --git a/src/lib/elementary/efl_ui_list_view_seg_array.h b/src/lib/elementary/efl_ui_list_view_seg_array.h deleted file mode 100644 index adbfc28441..0000000000 --- a/src/lib/elementary/efl_ui_list_view_seg_array.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef EFL_UI_LIST_VIEW_SEG_ARRAY_H -#define EFL_UI_LIST_VIEW_SEG_ARRAY_H - -typedef struct _Efl_Ui_List_View_SegArray_Node -{ - EINA_RBTREE; - - int length; - int max; - int first; - - void* layout_data; - - Efl_Ui_List_View_Layout_Item* pointers[0]; -} Efl_Ui_List_View_Seg_Array_Node; - -typedef struct _Efl_Ui_List_View_Seg_Array -{ - Efl_Ui_List_View_Seg_Array_Node *root; - - int step_size; - int node_count; - int count; -} Efl_Ui_List_View_Seg_Array; - - -Efl_Ui_List_View_Seg_Array * efl_ui_list_view_seg_array_setup(int size); -void efl_ui_list_view_seg_array_free(Efl_Ui_List_View_Seg_Array *seg_array); -void efl_ui_list_view_seg_array_flush(Efl_Ui_List_View_Seg_Array *seg_array); -int efl_ui_list_view_seg_array_count(Efl_Ui_List_View_Seg_Array* seg_array); -int efl_ui_list_view_item_index_get(Efl_Ui_List_View_Layout_Item* item); - - -void efl_ui_list_view_seg_array_insert(Efl_Ui_List_View_Seg_Array* seg_array, int index, Efl_Model* model); -void efl_ui_list_view_seg_array_insert_value(Efl_Ui_List_View_Seg_Array *seg_array, int first, Eina_Value value); -Efl_Ui_List_View_Layout_Item* efl_ui_list_view_seg_array_remove(Efl_Ui_List_View_Seg_Array *seg_array, int index); - -Eina_Accessor* efl_ui_list_view_seg_array_accessor_get(Efl_Ui_List_View_Seg_Array* seg_array); -Eina_Accessor* efl_ui_list_view_seg_array_node_accessor_get(Efl_Ui_List_View_Seg_Array* seg_array); - - -#endif diff --git a/src/lib/elementary/efl_ui_list_view_types.eot b/src/lib/elementary/efl_ui_list_view_types.eot deleted file mode 100644 index 49aca5d33d..0000000000 --- a/src/lib/elementary/efl_ui_list_view_types.eot +++ /dev/null @@ -1,12 +0,0 @@ -struct @beta @free(free) Efl.Ui.List_View_Layout_Item { - layout: Efl.Ui.Layout; - layout_request: future; - children: Efl.Model; - index_offset: int; - tree_node: void_ptr; - min: Eina.Size2D; - size: Eina.Size2D; - pos: Eina.Position2D; -} - -struct @beta Efl_Ui_List_View_Seg_Array; [[TBD]] diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 2e48c5a39a..9580b3e229 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -111,8 +111,6 @@ pub_eo_files = [ 'efl_ui_layout_part_bg.eo', 'efl_ui_layout_part_legacy.eo', 'efl_ui_list_view.eo', - 'efl_ui_list_view_model.eo', - 'efl_ui_list_view_pan.eo', 'efl_ui_item.eo', 'efl_ui_default_item.eo', 'efl_ui_group_item.eo', @@ -208,7 +206,6 @@ endforeach pub_eo_types_files = [ 'elm_general.eot', 'efl_ui.eot', - 'efl_ui_list_view_types.eot', 'efl_ui_selection_types.eot', 'efl_ui_dnd_types.eot' ] @@ -236,8 +233,6 @@ priv_eo_files = [ 'efl_ui_state_model.eo', 'efl_ui_selection_manager.eo', 'efl_datetime_manager.eo', - 'efl_ui_list_view_precise_layouter.eo', - 'efl_ui_list_view_relayout.eo', 'efl_ui_size_model.eo', 'efl_ui_homogeneous_model.eo', 'efl_ui_exact_model.eo', @@ -357,8 +352,6 @@ elementary_headers_unstable = [ 'elm_widget_toolbar.h', 'efl_ui_video_private.h', 'efl_ui_item_private.h', - 'efl_ui_list_view_private.h', - 'efl_ui_list_view_seg_array.h', 'elm_widget_web.h', 'efl_ui_clock.h', 'elm_code.h', @@ -906,8 +899,6 @@ elementary_src = [ 'efl_ui_grid_default_item.c', 'efl_ui_grid.c', 'efl_ui_list_view.c', - 'efl_ui_list_view_precise_layouter.c', - 'efl_ui_list_view_seg_array.c', 'efl_ui_layout_factory.c', 'efl_ui_scroller.c', 'efl_ui_scroll_manager.c', From 5096cd32ad580cfc8fa58c130b378b111112855a Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Sun, 15 Sep 2019 23:18:50 -0700 Subject: [PATCH 025/115] elementary: add Efl.Ui.Grid_View by leveraging MVVM and Collection/Position_Manager infrastructure. Co-authored-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D9960 --- src/lib/elementary/Efl_Ui.h | 1 + src/lib/elementary/efl_ui_collection_view.eo | 2 +- src/lib/elementary/efl_ui_grid_view.c | 26 ++++++++++++++++++++ src/lib/elementary/efl_ui_grid_view.eo | 17 +++++++++++++ src/lib/elementary/meson.build | 2 ++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/lib/elementary/efl_ui_grid_view.c create mode 100644 src/lib/elementary/efl_ui_grid_view.eo diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 7f0c2ab4e9..5ee021cea0 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -335,6 +335,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include +# include # include # include diff --git a/src/lib/elementary/efl_ui_collection_view.eo b/src/lib/elementary/efl_ui_collection_view.eo index d0efbf347a..ffbbc0eefd 100644 --- a/src/lib/elementary/efl_ui_collection_view.eo +++ b/src/lib/elementary/efl_ui_collection_view.eo @@ -11,7 +11,7 @@ class @beta Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements object. By using different @.position_manager objects this widget can show unidimensional lists or two-dimensional grids of items, for example. - This class is intended to act as a base for widgets like List_View or Grid_View, + This class is intended to act as a base for widgets like List_View or @Efl.Ui.Grid_View, which hide this complexity from the user. Items are generated by the @Efl.Ui.Factory defined with .factory.set to match the content of the diff --git a/src/lib/elementary/efl_ui_grid_view.c b/src/lib/elementary/efl_ui_grid_view.c new file mode 100644 index 0000000000..4c5ac044b7 --- /dev/null +++ b/src/lib/elementary/efl_ui_grid_view.c @@ -0,0 +1,26 @@ +#ifdef HAVE_CONFIG_H +#include "elementary_config.h" +#endif + +#define ELM_LAYOUT_PROTECTED +#define EFL_UI_SCROLL_MANAGER_PROTECTED +#define EFL_UI_SCROLLBAR_PROTECTED + +#include + +#define MY_CLASS EFL_UI_GRID_VIEW_CLASS +#define MY_CLASS_PFX efl_ui_grid_view + +#define MY_CLASS_NAME "Efl.Ui.Grid_View" + +EOLIAN static Eo * +_efl_ui_grid_view_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) +{ + obj = efl_constructor(efl_super(obj, MY_CLASS)); + + efl_ui_collection_view_position_manager_set(obj, efl_new(EFL_UI_POSITION_MANAGER_GRID_CLASS)); + + return obj; +} + +#include "efl_ui_grid_view.eo.c" diff --git a/src/lib/elementary/efl_ui_grid_view.eo b/src/lib/elementary/efl_ui_grid_view.eo new file mode 100644 index 0000000000..18e513e8c9 --- /dev/null +++ b/src/lib/elementary/efl_ui_grid_view.eo @@ -0,0 +1,17 @@ +class @beta Efl.Ui.Grid_View extends Efl.Ui.Collection_View +{ + [[A scrollable grid of @Efl.Ui.Item objects, typically @Efl.Ui.Grid_Default_Item objects. + + Items are added asynchronously by an @Efl.Ui.Factory from the definition of an @Efl.Model. + + The orientation (vertical or horizontal) of the grid can be set with + @Efl.Ui.Layout_Orientable.orientation. + + Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable_Async.select_mode + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable_Async.selected_iterator_new. + ]] + data: null; + implements { + Efl.Object.constructor; + } +} diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 9580b3e229..8166aafd95 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -186,6 +186,7 @@ pub_eo_files = [ 'efl_ui_view_model.eo', 'efl_ui_collection_view.eo', 'efl_ui_collection_view_focus_manager.eo', + 'efl_ui_grid_view.eo', ] foreach eo_file : pub_eo_files @@ -899,6 +900,7 @@ elementary_src = [ 'efl_ui_grid_default_item.c', 'efl_ui_grid.c', 'efl_ui_list_view.c', + 'efl_ui_grid_view.c', 'efl_ui_layout_factory.c', 'efl_ui_scroller.c', 'efl_ui_scroll_manager.c', From d5a21c7998f9f4a4901a49b874ff1e2dec3c3c08 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Fri, 20 Sep 2019 15:01:49 -0700 Subject: [PATCH 026/115] elementary: add a basic test for MVVM infrastructure. Differential Revision: https://phab.enlightenment.org/D10063 --- src/bin/elementary/meson.build | 1 + src/bin/elementary/test.c | 4 +- src/bin/elementary/test_ui_collection_view.c | 144 +++++++++++++++++++ 3 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 src/bin/elementary/test_ui_collection_view.c diff --git a/src/bin/elementary/meson.build b/src/bin/elementary/meson.build index 388623d5c0..debce1ded8 100644 --- a/src/bin/elementary/meson.build +++ b/src/bin/elementary/meson.build @@ -157,6 +157,7 @@ elementary_test_src = [ 'test_ui_tab_pager.c', 'test_ui_relative_layout.c', 'test_ui_collection.c', + 'test_ui_collection_view.c', 'test_ui_items.c', 'test_ui_frame.c', 'test_efl_ui_animation_view.c', diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index bf90382bd4..8d5e997140 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -399,8 +399,9 @@ void test_ui_spotlight_scroll(void *data, Evas_Object *obj, void *event_info); void test_ui_relative_layout(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_radio(void *data, Evas_Object *obj, void *event_info); -void test_efl_ui_collection_list(void *data, Evas_Object *obj, void *event_info ); +void test_efl_ui_collection_list(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_collection_grid(void *data, Evas_Object *obj, void *event_info); +void test_efl_ui_collection_view(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_item(void *data, Evas_Object *obj, void *event_info); void test_ui_frame(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); @@ -909,6 +910,7 @@ add_tests: ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Relative_Layout", test_ui_relative_layout); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection List", test_efl_ui_collection_list); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection Grid", test_efl_ui_collection_grid); + ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection_View", test_efl_ui_collection_view); ADD_TEST_EO(NULL, "Containers", "Items", test_efl_ui_item); ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Frame", test_ui_frame); diff --git a/src/bin/elementary/test_ui_collection_view.c b/src/bin/elementary/test_ui_collection_view.c new file mode 100644 index 0000000000..4a3f2f7b7c --- /dev/null +++ b/src/bin/elementary/test_ui_collection_view.c @@ -0,0 +1,144 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include +#include + +#define NUM_ITEMS 50 + +static Efl_Model* +_make_model(Efl_Ui_Win *win) +{ + Eina_Value vi; + Efl_Generic_Model *model, *child; + unsigned int i; + + model = efl_add(EFL_GENERIC_MODEL_CLASS, win); + model = efl_add(EFL_UI_VIEW_MODEL_CLASS, model, + efl_ui_view_model_set(efl_added, model)); + eina_value_setup(&vi, EINA_VALUE_TYPE_INT); + + efl_ui_view_model_property_string_add(model, "relative", "Relative index ${child.index}", "WRONG", "WRONG"); + efl_ui_view_model_property_string_add(model, "title", "Initial index ${initial}", "WRONG", "WRONG"); + + + for (i = 0; i < (NUM_ITEMS); i++) + { + child = efl_model_child_add(model); + eina_value_set(&vi, i); + efl_model_property_set(child, "initial", &vi); + } + + eina_value_flush(&vi); + return model; +} + +static void +_item_constructing(void *data EINA_UNUSED, const Efl_Event *ev) +{ + Efl_Gfx_Entity *item = ev->info; + + if (!efl_ui_item_calc_locked_get(item)) + efl_gfx_hint_size_min_set(item, EINA_SIZE2D(100, 50)); +} + +static void +_item_select(void *data, const Efl_Event *ev) +{ + Efl_Ui_Widget *w = efl_ui_single_selectable_last_selected_get(ev->object); + Efl_Model *m = efl_ui_view_model_get(w); + + if (m) efl_ui_view_model_set(data, m); +} + +void test_efl_ui_collection_view(void *data EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + Efl_Ui_Win *win; + Efl_Model *model; + Efl_Ui_Frame *f; + Efl_Ui_Table *tbl; + Efl_Ui_List_View *lv; + Efl_Ui_Grid_View *gv; + Efl_Ui_Factory *fg, *fl; + Efl_Ui_Box *ib; + Efl_Ui_Widget *o; + Efl_Model_Provider *provider; + + win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), + efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC), + efl_text_set(efl_added, "Efl.Ui.Collection_View"), + efl_ui_win_autodel_set(efl_added, EINA_TRUE)); + tbl = efl_add(EFL_UI_TABLE_CLASS, win, + efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(500, 300))); + efl_content_set(win, tbl); + + model = _make_model(win); + fg = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win, + efl_ui_property_bind(efl_added, "text", "title"), + efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_GRID_DEFAULT_ITEM_CLASS)); + efl_event_callback_add(fg, EFL_UI_FACTORY_EVENT_ITEM_CONSTRUCTING, _item_constructing, NULL); + fl = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win, + efl_ui_property_bind(efl_added, "text", "title"), + efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_LIST_DEFAULT_ITEM_CLASS)); + provider = efl_add(EFL_MODEL_PROVIDER_CLASS, win); + + lv = efl_add(EFL_UI_LIST_VIEW_CLASS, tbl, + efl_ui_collection_view_factory_set(efl_added, fl), + efl_ui_view_model_set(efl_added, model)); + efl_pack_table(tbl, lv, 0, 1, 1, 1); + + gv = efl_add(EFL_UI_GRID_VIEW_CLASS, tbl, + efl_ui_collection_view_factory_set(efl_added, fg), + efl_ui_view_model_set(efl_added, model)); + efl_pack_table(tbl, gv, 2, 1, 1, 1); + + f = efl_add(EFL_UI_FRAME_CLASS, tbl, + efl_text_set(efl_added, "Selected item"), + efl_ui_frame_autocollapse_set(efl_added, EINA_FALSE)); + efl_provider_register(f, EFL_MODEL_PROVIDER_CLASS, provider); + efl_pack_table(tbl, f, 1, 1, 1, 1); + efl_event_callback_add(lv, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, _item_select, provider); + + ib = efl_add(EFL_UI_BOX_CLASS, f, + efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL), + efl_gfx_hint_weight_set(efl_added, 1, 1), + efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_TRUE), + efl_content_set(f, efl_added)); + + o = elm_label_add(ib); + elm_object_text_set(o, "title:"); + efl_gfx_hint_weight_set(o, 1, 0); + efl_gfx_hint_align_set(o, 0.5, 1.0); + efl_gfx_hint_aspect_set(o, EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 1)); + efl_pack(ib, o); + efl_gfx_entity_visible_set(o, 1); + + o = elm_label_add(ib); + elm_object_text_set(o, "NONE"); + efl_ui_property_bind(o, "elm.text", "title"); + efl_gfx_hint_weight_set(o, 1, 0); + efl_gfx_hint_align_set(o, 0.5, 1.0); + efl_gfx_hint_aspect_set(o, EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 1)); + efl_pack(ib, o); + efl_gfx_entity_visible_set(o, 1); + + o = elm_label_add(ib); + elm_object_text_set(o, "relative:"); + efl_gfx_hint_weight_set(o, 1, 0); + efl_gfx_hint_align_set(o, 0.5, 1.0); + efl_gfx_hint_aspect_set(o, EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 1)); + efl_pack(ib, o); + efl_gfx_entity_visible_set(o, 1); + + o = elm_label_add(ib); + elm_object_text_set(o, "NONE"); + efl_ui_property_bind(o, "elm.text", "relative"); + efl_gfx_hint_weight_set(o, 1, 0); + efl_gfx_hint_align_set(o, 0.5, 1.0); + efl_gfx_hint_aspect_set(o, EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 1)); + efl_pack(ib, o); + efl_gfx_entity_visible_set(o, 1); +} From b057ac1af64158b23fb07592610f200d95866eb6 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 16 Sep 2019 13:50:12 +0200 Subject: [PATCH 027/115] efl_ui_collection_view: support focus with this commit you can more or less use focus. The only uncaught case for now is that if the object is not available, no focus can be set. Navigating with focus on the screen however should be possible. Differential Revision: https://phab.enlightenment.org/D9969 --- src/lib/elementary/efl_ui_collection_view.c | 44 ++++++++++++++++++-- src/lib/elementary/efl_ui_collection_view.eo | 1 + 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index d597c46d0b..aa3b9c56d4 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -508,7 +508,6 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v) efl_ui_item_container_set(child, obj); efl_ui_widget_sub_object_add(obj, child); efl_canvas_group_member_add(pd->pan, child); - efl_ui_widget_focus_allow_set(child, EINA_FALSE); efl_gfx_entity_visible_set(child, EINA_FALSE); #ifdef VIEWPORT_ENABLE @@ -2180,6 +2179,12 @@ _efl_ui_collection_view_efl_ui_focus_manager_move(Eo *obj, Efl_Ui_Collection_Vie return new_obj; } +EOLIAN static Eina_Bool +_efl_ui_collection_view_efl_ui_widget_focus_state_apply(Eo *obj, Efl_Ui_Collection_View_Data *pd EINA_UNUSED, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect EINA_UNUSED) +{ + return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj); +} + #include "efl_ui_collection_view.eo.c" #define ITEM_IS_OUTSIDE_VISIBLE(id) id < cpd->start_id || id > cpd->end_id @@ -2240,12 +2245,26 @@ _efl_ui_collection_view_focus_manager_efl_ui_focus_manager_manager_focus_set(Eo efl_ui_focus_manager_focus_set(efl_super(obj, EFL_UI_COLLECTION_VIEW_FOCUS_MANAGER_CLASS), focus); } +static int +_id_from_item(Efl_Ui_Item *item, uint64_t *index) +{ + Eina_Value *vindex; + Efl_Model *model; + + model = efl_ui_view_model_get(item); + + vindex = efl_model_property_get(model, "child.index"); + EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_value_uint64_convert(vindex, index), EINA_FALSE); + eina_value_free(vindex); + return EINA_TRUE; +} + EOLIAN static Efl_Ui_Focus_Object * _efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, Efl_Ui_Collection_View_Focus_Manager_Data *pd, Efl_Ui_Focus_Direction direction, Efl_Ui_Focus_Object *child, Eina_Bool logical) { MY_DATA_GET(pd->collection, cpd); Efl_Ui_Item *new_item, *item; - unsigned int item_id; + uint64_t item_id; if (!child) child = efl_ui_focus_manager_focus_get(obj); @@ -2256,14 +2275,15 @@ _efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, if (!cpd->manager) return NULL; if (!item) return NULL; - item_id = efl_ui_item_index_get(item); + if (!_id_from_item(item, &item_id)) + return NULL; if (ITEM_IS_OUTSIDE_VISIBLE(item_id)) { int new_id; new_id = efl_ui_position_manager_entity_relative_item(cpd->manager, - efl_ui_item_index_get(item), + item_id, direction); if (new_id == -1) { @@ -2271,6 +2291,7 @@ _efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, } else { + Efl_Ui_Collection_Item_Lookup *lookup; #ifdef VIEWPORT_ENABLE unsigned int i; @@ -2287,6 +2308,21 @@ _efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, if (!new_item) break; // Just in case _assert_item_available(new_item, new_id, cpd); } +#else + uint64_t search_index = new_id; + lookup = (void*) eina_rbtree_inline_lookup(cpd->cache, &search_index, + sizeof (new_id), _cache_tree_lookup, + NULL); + if (lookup) + { + _assert_item_available(lookup->item.entity, new_id, cpd); + new_item = lookup->item.entity; + } + else + { + ERR("This item cannot get focus right now. It should be visible first."); + new_item = NULL; + } #endif } } diff --git a/src/lib/elementary/efl_ui_collection_view.eo b/src/lib/elementary/efl_ui_collection_view.eo index ffbbc0eefd..a0cbbc8545 100644 --- a/src/lib/elementary/efl_ui_collection_view.eo +++ b/src/lib/elementary/efl_ui_collection_view.eo @@ -53,6 +53,7 @@ class @beta Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements Efl.Ui.Scrollable.match_content { set; } Efl.Ui.Widget_Focus_Manager.focus_manager_create; Efl.Ui.Focus.Manager.move; + Efl.Ui.Widget.focus_state_apply; } events { item,realized : Efl.Ui.Item; [[Event triggered when an @Efl.Ui.Item has been provided by the @Efl.Ui.Factory and is about to be used.]] From 7025d9aee867b99f5d90a27c4dbb9863db69221d Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 16 Sep 2019 14:11:56 +0200 Subject: [PATCH 028/115] efl_ui_position_manager_list: emit events correctly it does not matter if pmin_size is > 0 or not. The important thing is that it is different to what is now, but thats it. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D9970 --- src/lib/elementary/efl_ui_position_manager_list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_position_manager_list.c b/src/lib/elementary/efl_ui_position_manager_list.c index 0adb498322..d22d42cb10 100644 --- a/src/lib/elementary/efl_ui_position_manager_list.c +++ b/src/lib/elementary/efl_ui_position_manager_list.c @@ -136,7 +136,7 @@ recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd) { min_size.h = pd->maximum_min_size; } - if ((pd->maximum_min_size > 0) && (pmin_size > 0) && (pd->maximum_min_size != pmin_size)) + if ((pd->maximum_min_size > 0) && (pd->maximum_min_size != pmin_size)) efl_event_callback_call(obj, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_MIN_SIZE_CHANGED, &min_size); } From b3adcff0dfb6aae6296cdf4ccabada293332e11a Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Tue, 24 Sep 2019 11:30:22 -0700 Subject: [PATCH 029/115] elementary: fix up left over header that got removed. --- src/lib/elementary/Efl_Ui.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 5ee021cea0..fdc77f2daa 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -329,7 +329,6 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include -# include "efl_ui_list_view_types.eot.h" # include # include # include From 5e9e33dd91ce623ddb88f2e853b4cbdfa9bfcc73 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 24 Sep 2019 14:22:11 -0400 Subject: [PATCH 030/115] efl_player: split off audio related properties Summary: this commit moves the audio related properties from Efl.Player to Efl.Player_Audio. Reviewers: zmike, Jaehyun_Cho Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7877 Differential Revision: https://phab.enlightenment.org/D10106 --- src/lib/efl/Efl.h | 1 + src/lib/efl/interfaces/efl_audio_control.eo | 33 ++++++++++++++++++++ src/lib/efl/interfaces/efl_interfaces_main.c | 1 + src/lib/efl/interfaces/efl_player.eo | 28 +---------------- src/lib/efl/interfaces/meson.build | 1 + src/lib/elementary/efl_ui_video.c | 8 ++--- src/lib/emotion/efl_canvas_video.eo | 8 ++--- src/lib/emotion/emotion_smart.c | 16 +++++----- 8 files changed, 53 insertions(+), 43 deletions(-) create mode 100644 src/lib/efl/interfaces/efl_audio_control.eo diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index 9f3b2ff518..b19e97c743 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -132,6 +132,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; #include "interfaces/efl_part.eo.h" #include "interfaces/efl_playable.eo.h" #include "interfaces/efl_player.eo.h" +#include "interfaces/efl_audio_control.eo.h" #include "interfaces/efl_text.eo.h" #include "interfaces/efl_text_types.eot.h" #include "interfaces/efl_ui_i18n.eo.h" diff --git a/src/lib/efl/interfaces/efl_audio_control.eo b/src/lib/efl/interfaces/efl_audio_control.eo new file mode 100644 index 0000000000..6b728fb43f --- /dev/null +++ b/src/lib/efl/interfaces/efl_audio_control.eo @@ -0,0 +1,33 @@ +interface @beta Efl.Audio_Control extends Efl.Player +{ + [[Player interface for audio related properties]] + methods { + @property volume { + [[Control the audio volume. + + Controls the audio volume of the stream being played. This has + nothing to do with the system volume. This volume will be + multiplied by the system volume. e.g.: if the current volume + level is 0.5, and the system volume is 50%, it will be + 0.5 * 0.5 = 0.25. + ]] + set { + } + get { + } + values { + volume: double; [[The volume level]] + } + } + @property mute { + [[This property controls the audio mute state.]] + set { + } + get { + } + values { + mute: bool; [[The mute state. $true or $false.]] + } + } + } +} diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 91b7ff1775..ead730689f 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -19,6 +19,7 @@ #include "interfaces/efl_part.eo.c" #include "interfaces/efl_playable.eo.c" #include "interfaces/efl_player.eo.c" +#include "interfaces/efl_audio_control.eo.c" #include "interfaces/efl_text.eo.c" #include "interfaces/efl_text_font.eo.c" #include "interfaces/efl_text_style.eo.c" diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 19c80f84ba..1aecb53015 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -1,6 +1,7 @@ interface @beta Efl.Player { [[Efl media player interface]] + c_prefix: efl_player; methods { start { [[Start a playing playable object.]] @@ -74,33 +75,6 @@ interface @beta Efl.Player speed: double; [[The play speed in the [0, infinity) range.]] } } - @property volume { - [[Control the audio volume. - - Controls the audio volume of the stream being played. This has - nothing to do with the system volume. This volume will be - multiplied by the system volume. e.g.: if the current volume - level is 0.5, and the system volume is 50%, it will be - 0.5 * 0.5 = 0.25. - ]] - set { - } - get { - } - values { - volume: double; [[The volume level]] - } - } - @property mute { - [[This property controls the audio mute state.]] - set { - } - get { - } - values { - mute: bool; [[The mute state. $true or $false.]] - } - } @property length { [[Get the length of play for the media file.]] get { diff --git a/src/lib/efl/interfaces/meson.build b/src/lib/efl/interfaces/meson.build index f59d5bbb78..237142f326 100644 --- a/src/lib/efl/interfaces/meson.build +++ b/src/lib/efl/interfaces/meson.build @@ -42,6 +42,7 @@ pub_eo_files = [ 'efl_gfx_image_load_controller.eo', 'efl_part.eo', 'efl_player.eo', + 'efl_audio_control.eo', 'efl_text.eo', 'efl_text_font.eo', 'efl_text_style.eo', diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c index dc3696a9af..b04ec11e35 100644 --- a/src/lib/elementary/efl_ui_video.c +++ b/src/lib/elementary/efl_ui_video.c @@ -474,25 +474,25 @@ elm_video_file_get(Eo *obj, const char **filename) EAPI void elm_video_audio_level_set(Evas_Object *obj, double volume) { - efl_player_volume_set(obj, volume); + efl_audio_control_volume_set(obj, volume); } EAPI double elm_video_audio_level_get(const Evas_Object *obj) { - return efl_player_volume_get(obj); + return efl_audio_control_volume_get(obj); } EAPI void elm_video_audio_mute_set(Evas_Object *obj, Eina_Bool mute) { - efl_player_mute_set(obj, mute); + efl_audio_control_mute_set(obj, mute); } EAPI Eina_Bool elm_video_audio_mute_get(const Evas_Object *obj) { - return efl_player_mute_get(obj); + return efl_audio_control_mute_get(obj); } EAPI double diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo index 8ee9607f0e..345b14d69c 100644 --- a/src/lib/emotion/efl_canvas_video.eo +++ b/src/lib/emotion/efl_canvas_video.eo @@ -1,5 +1,5 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group - implements Efl.File, Efl.Player, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller + implements Efl.File, Efl.Audio_Control, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller { [[Efl canvas video class]] methods { @@ -10,7 +10,7 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group emotion object. Please don't use this function, consider using - @Efl.Player.mute instead. + @Efl.Audio_Control.mute instead. ]] set { } @@ -59,8 +59,8 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group Efl.Player.play { get; set; } Efl.Player.pos { get; set; } Efl.Player.progress { get; } - Efl.Player.volume { get; set; } - Efl.Player.mute { get; set; } + Efl.Audio_Control.volume { get; set; } + Efl.Audio_Control.mute { get; set; } Efl.Player.length { get; } Efl.Player.seekable { get; } Efl.Gfx.Image_Load_Controller.load_size { get; } diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index a7a8fa8905..73c588bf81 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -830,11 +830,11 @@ emotion_object_event_simple_send(Evas_Object *obj, Emotion_Event ev) EAPI void emotion_object_audio_volume_set(Evas_Object *obj, double vol) { - efl_player_volume_set(obj, vol); + efl_audio_control_volume_set(obj, vol); } EOLIAN static void -_efl_canvas_video_efl_player_volume_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, double vol) +_efl_canvas_video_efl_audio_control_volume_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, double vol) { DBG("vol=%f", vol); if (!sd->engine_instance) return; @@ -844,11 +844,11 @@ _efl_canvas_video_efl_player_volume_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Da EAPI double emotion_object_audio_volume_get(const Evas_Object *obj) { - return efl_player_volume_get(obj); + return efl_audio_control_volume_get(obj); } EOLIAN static double -_efl_canvas_video_efl_player_volume_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_audio_control_volume_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return 0.0; return emotion_engine_instance_audio_channel_volume_get(sd->engine_instance); @@ -857,11 +857,11 @@ _efl_canvas_video_efl_player_volume_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vi EAPI void emotion_object_audio_mute_set(Evas_Object *obj, Eina_Bool mute) { - efl_player_mute_set(obj, mute); + efl_audio_control_mute_set(obj, mute); } EOLIAN static void -_efl_canvas_video_efl_player_mute_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Eina_Bool mute) +_efl_canvas_video_efl_audio_control_mute_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd, Eina_Bool mute) { DBG("mute=" FMT_UCHAR, mute); if (!sd->engine_instance) return; @@ -871,11 +871,11 @@ _efl_canvas_video_efl_player_mute_set(Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data EAPI Eina_Bool emotion_object_audio_mute_get(const Evas_Object *obj) { - return efl_player_mute_get(obj); + return efl_audio_control_mute_get(obj); } EOLIAN static Eina_Bool -_efl_canvas_video_efl_player_mute_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_audio_control_mute_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return EINA_FALSE; return emotion_engine_instance_audio_channel_mute_get(sd->engine_instance); From 653cf9b788ccd0fdb52339d94442d0df29a6ce4c Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Tue, 24 Sep 2019 11:54:20 -0700 Subject: [PATCH 031/115] elementary: another forgotten file that need removal. --- src/lib/elementary/Efl_Ui.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index fdc77f2daa..29ef99383e 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -330,7 +330,6 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include -# include # include # include # include From 036e01579c4d0cc7dbb64e330ba33892da221d10 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Tue, 24 Sep 2019 14:51:01 -0400 Subject: [PATCH 032/115] docs: Update Efl.Ui.Scrollbar docs Summary: Ref T7884 Reviewers: zmike, eagleeye Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7884 Differential Revision: https://phab.enlightenment.org/D10041 --- src/lib/efl/interfaces/efl_ui_scrollbar.eo | 51 +++++++++++++--------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/lib/efl/interfaces/efl_ui_scrollbar.eo b/src/lib/efl/interfaces/efl_ui_scrollbar.eo index 8008bc7ce0..aeba2d9c2a 100644 --- a/src/lib/efl/interfaces/efl_ui_scrollbar.eo +++ b/src/lib/efl/interfaces/efl_ui_scrollbar.eo @@ -11,42 +11,51 @@ enum Efl.Ui.Scrollbar_Mode interface Efl.Ui.Scrollbar { - [[Interface used by widgets which can display scrollbars, enabling them to contain more content - than actually fits inside them.]] + [[Interface used by widgets which can display scrollbars, enabling them to hold more content + than actually visible through the viewport. + A scrollbar contains a draggable part (thumb) which allows the user to move the viewport + around the content. The size of the thumb relates to the size of the viewport compared to + the whole content. + ]] methods { @property bar_mode { - [[Scrollbar visibility policy]] + [[Scrollbar visibility mode, for each of the scrollbars.]] set { } get { } values { - hbar: Efl.Ui.Scrollbar_Mode; [[Horizontal scrollbar.]] - vbar: Efl.Ui.Scrollbar_Mode; [[Vertical scrollbar.]] + hbar: Efl.Ui.Scrollbar_Mode(Efl.Ui.Scrollbar_Mode.auto); [[Horizontal scrollbar mode.]] + vbar: Efl.Ui.Scrollbar_Mode(Efl.Ui.Scrollbar_Mode.auto); [[Vertical scrollbar mode.]] } } @property bar_size { - [[Scrollbar size. - It is calculated based on viewport size-content sizes. - ]] // TODO: This needs more details. What does 1.0 mean? + [[This returns the relative size the thumb should have, given the current size of the viewport and + the content. + $[0.0] means the viewport is much smaller than the content: the thumb will have its minimum size. + $[1.0] means the viewport has the same size as the content (or bigger): the thumb will have the same + size as the scrollbar and cannot move. + ]] get { } values { - width: double; [[Value between 0.0 and 1.0.]] - height: double; [[Value between 0.0 and 1.0.]] + width: double; [[Value between $[0.0] and $[1.0].]] + height: double; [[Value between $[0.0] and $[1.0].]] } } @property bar_position { - [[Scrollbar position. - It is calculated based on current position-maximum positions. + [[Position of the thumb (the draggable zone) inside the scrollbar. + It is calculated based on current position of the viewport inside the total content. ]] set { } get { } values { - posx: double; [[Value between 0.0 and 1.0.]] - posy: double; [[Value between 0.0 and 1.0.]] + posx: double; [[Value between $[0.0] (the left side of the thumb is touching the left edge of the widget) + and $[1.0] (the right side of the thumb is touching the right edge of the widget).]] + posy: double; [[Value between $[0.0] (the top side of the thumb is touching the top edge of the widget) + and $[1.0] (the bottom side of the thumb is touching the bottom edge of the widget).]] } } bar_visibility_update @protected @beta{ @@ -58,12 +67,12 @@ interface Efl.Ui.Scrollbar } } events { - bar,pressed: Efl.Ui.Layout_Orientation; [[Called when bar is pressed.]] - bar,unpressed: Efl.Ui.Layout_Orientation; [[Called when bar is unpressed.]] - bar,dragged: Efl.Ui.Layout_Orientation; [[Called when bar is dragged.]] - bar,size,changed: void; [[Called when bar size is changed.]] - bar,pos,changed: void; [[Called when bar position is changed.]] - bar,show: Efl.Ui.Layout_Orientation; [[Callend when bar is shown.]] - bar,hide: Efl.Ui.Layout_Orientation; [[Called when bar is hidden.]] + bar,pressed: Efl.Ui.Layout_Orientation; [[Emitted when thumb is pressed.]] + bar,unpressed: Efl.Ui.Layout_Orientation; [[Emitted when thumb is unpressed.]] + bar,dragged: Efl.Ui.Layout_Orientation; [[Emitted when thumb is dragged.]] + bar,size,changed: void; [[Emitted when thumb size has changed.]] + bar,pos,changed: void; [[Emitted when thumb position has changed.]] + bar,show: Efl.Ui.Layout_Orientation; [[Emitted when scrollbar is shown.]] + bar,hide: Efl.Ui.Layout_Orientation; [[Emitted when scrollbar is hidden.]] } } From 9d18fdeeed70bc0a2f33bd4423884bb8d4c4381c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 14:51:04 -0400 Subject: [PATCH 033/115] efl/audio_control: remove player Summary: this does not require any other interfaces Reviewers: bu5hm4n Reviewed By: bu5hm4n Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10110 --- src/lib/efl/interfaces/efl_audio_control.eo | 2 +- src/lib/emotion/efl_canvas_video.eo | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/efl/interfaces/efl_audio_control.eo b/src/lib/efl/interfaces/efl_audio_control.eo index 6b728fb43f..5b82b937ef 100644 --- a/src/lib/efl/interfaces/efl_audio_control.eo +++ b/src/lib/efl/interfaces/efl_audio_control.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Audio_Control extends Efl.Player +interface @beta Efl.Audio_Control { [[Player interface for audio related properties]] methods { diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo index 345b14d69c..4cb7c2ea48 100644 --- a/src/lib/emotion/efl_canvas_video.eo +++ b/src/lib/emotion/efl_canvas_video.eo @@ -1,5 +1,6 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group - implements Efl.File, Efl.Audio_Control, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller + implements Efl.File, Efl.Audio_Control, Efl.Player, + Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller { [[Efl canvas video class]] methods { From 4234dcfc3e5fc39e7be57a8f9971a01fbc0c3390 Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Tue, 24 Sep 2019 20:06:29 +0000 Subject: [PATCH 034/115] csharp: Fix factory instantiation After 892c26f906d23595b709b834dde6b032bdd6d89d, widget factories require a widget to be their parents. This commit updates C# tests and adds a warning message to elementary if the user does not provide one. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10122 --- src/lib/elementary/efl_ui_widget_factory.c | 8 ++++++-- src/tests/efl_mono/Model.cs | 4 +++- src/tests/efl_mono/Parts.cs | 8 ++++++-- src/tests/efl_mono/meson.build | 1 + 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index b1c339d4bc..00ba103cda 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -49,7 +49,11 @@ static Efl_Object * _efl_ui_widget_factory_efl_object_finalize(Eo *obj, Efl_Ui_Widget_Factory_Data *pd) { pd->parenting_widget = efl_provider_find(obj, EFL_UI_WIDGET_CLASS); - if (!pd->parenting_widget) return NULL; + if (!pd->parenting_widget) + { + ERR("Widget_Factory requires a Widget as parent."); + return NULL; + } return efl_finalize(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS)); } @@ -397,7 +401,7 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE if (!pd->pd) { - EINA_LOG_ERR("Trying to bind part property without specifying which part"); + ERR("Trying to bind part property without specifying which part"); return ENOENT; } diff --git a/src/tests/efl_mono/Model.cs b/src/tests/efl_mono/Model.cs index 4ec6ef3f0b..13e0d1559f 100644 --- a/src/tests/efl_mono/Model.cs +++ b/src/tests/efl_mono/Model.cs @@ -65,7 +65,9 @@ public class TestModel { { string propertyBound = null; bool callbackCalled = false; - var factory = new Efl.Ui.ItemFactory(); + var parent = new Efl.Ui.Win(null); + parent.Visible = false; + var factory = new Efl.Ui.ItemFactory(parent); factory.PropertyBoundEvent += (object sender, Efl.Ui.PropertyBindPropertyBoundEventArgs args) => { propertyBound = args.arg; callbackCalled = true; diff --git a/src/tests/efl_mono/Parts.cs b/src/tests/efl_mono/Parts.cs index 14743ac634..bf47fed945 100644 --- a/src/tests/efl_mono/Parts.cs +++ b/src/tests/efl_mono/Parts.cs @@ -43,7 +43,9 @@ public static class TestMVVMParts { public static void mvvm_dynamic_parts() { - var factory = new Efl.Ui.ItemFactory(); + var parent = new Efl.Ui.Win(null); + parent.Visible = false; + var factory = new Efl.Ui.ItemFactory(parent); var bindablePart = factory.TextPart(); var error = bindablePart.Markup().Bind("name"); @@ -53,7 +55,9 @@ public static class TestMVVMParts public static void mvvm_factory_properties() { - var factory = new Efl.Ui.ItemFactory(); + var parent = new Efl.Ui.Win(null); + parent.Visible = false; + var factory = new Efl.Ui.ItemFactory(parent); var iconFactory = new Efl.Ui.ImageFactory(null); iconFactory.BindProperty("filename", "modelProperty"); var error = factory.IconPart().BindFactory(iconFactory); diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build index 8dedc3e543..202c09fbb0 100644 --- a/src/tests/efl_mono/meson.build +++ b/src/tests/efl_mono/meson.build @@ -92,6 +92,7 @@ efl_mono_suite = executable('efl-mono-suite', env_mono = environment() env_mono.set('MONO_PATH', efl_mono_test_suite_path ) +env_mono.set('EFL_RUN_IN_TREE', '1') if (cs_is_dotnet) copy_prog = find_program(['cp', 'copy']) From f13b3a882e1e58765bf2a0ff9e8594280ec925f3 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 16:11:33 -0400 Subject: [PATCH 035/115] evas: fix error return of evas_object_propagate_events_get() ref T8259 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10123 --- src/lib/evas/canvas/efl_canvas_object_eo.legacy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/evas/canvas/efl_canvas_object_eo.legacy.c b/src/lib/evas/canvas/efl_canvas_object_eo.legacy.c index 034d8c1ece..853f7da502 100644 --- a/src/lib/evas/canvas/efl_canvas_object_eo.legacy.c +++ b/src/lib/evas/canvas/efl_canvas_object_eo.legacy.c @@ -68,6 +68,7 @@ evas_object_propagate_events_set(Efl_Canvas_Object *obj, Eina_Bool propagate) EAPI Eina_Bool evas_object_propagate_events_get(const Efl_Canvas_Object *obj) { + if (!efl_isa(obj, EFL_CANVAS_OBJECT_CLASS)) return EINA_FALSE; return efl_canvas_object_propagate_events_get(obj); } From 105f016fc92324de903d501d9ffeac55855ea3da Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 23 Sep 2019 13:24:51 -0400 Subject: [PATCH 036/115] elm: rename layout part aliasing functions/macros these are internal apis for managing part aliasing on the C side, but they apply to efl_ui_layout and not elm_layout no functional changes Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D10090 --- src/lib/elementary/efl_ui_bg.c | 4 ++-- src/lib/elementary/efl_ui_button.c | 4 ++-- src/lib/elementary/efl_ui_check.c | 8 ++++---- src/lib/elementary/efl_ui_layout.c | 16 ++++++++-------- src/lib/elementary/efl_ui_panes.c | 4 ++-- src/lib/elementary/efl_ui_progressbar.c | 4 ++-- src/lib/elementary/efl_ui_radio.c | 4 ++-- src/lib/elementary/efl_ui_text.c | 2 +- src/lib/elementary/elm_actionslider.c | 4 ++-- src/lib/elementary/elm_bubble.c | 8 ++++---- src/lib/elementary/elm_conform.c | 4 ++-- src/lib/elementary/elm_entry.c | 8 ++++---- src/lib/elementary/elm_hover.c | 6 +++--- src/lib/elementary/elm_priv.h | 18 +++++++++--------- src/lib/elementary/elm_slider.c | 4 ++-- 15 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/lib/elementary/efl_ui_bg.c b/src/lib/elementary/efl_ui_bg.c index d5932d331f..614896dd2c 100644 --- a/src/lib/elementary/efl_ui_bg.c +++ b/src/lib/elementary/efl_ui_bg.c @@ -267,10 +267,10 @@ _efl_ui_bg_efl_object_finalize(Eo *obj, Efl_Ui_Bg_Data *sd) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_BG_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) #include "efl_ui_bg.eo.c" diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index f71fb3e0ad..4bcbc11380 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -374,10 +374,10 @@ elm_button_autorepeat_get(const Evas_Object *obj) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_BUTTON_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_ADD_OPS(efl_ui_button) #include "efl_ui_button.eo.c" diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c index df53247259..190242e3ef 100644 --- a/src/lib/elementary/efl_ui_check.c +++ b/src/lib/elementary/efl_ui_check.c @@ -413,15 +413,15 @@ _efl_ui_check_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data) ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data) ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data) -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_CHECK_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) #include "efl_ui_check.eo.c" diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index fd52af6f16..46aaebcc5d 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -660,9 +660,9 @@ _elm_layout_part_aliasing_eval(const Evas_Object *obj, } if (is_text) - aliases = elm_layout_text_aliases_get(obj); + aliases = efl_ui_layout_text_aliases_get(obj); else - aliases = elm_layout_content_aliases_get(obj); + aliases = efl_ui_layout_content_aliases_get(obj); while (aliases && aliases->alias && aliases->real_part) { @@ -2847,18 +2847,18 @@ _efl_ui_layout_base_theme_rotation_apply(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UN /* Internal EO APIs and hidden overrides */ -EFL_FUNC_BODY_CONST(elm_layout_text_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL) -EFL_FUNC_BODY_CONST(elm_layout_content_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL) +EFL_FUNC_BODY_CONST(efl_ui_layout_text_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL) +EFL_FUNC_BODY_CONST(efl_ui_layout_content_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL) -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_LAYOUT_BASE_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_layout_base), \ ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_layout_base), \ ELM_PART_TEXT_DEFAULT_OPS(efl_ui_layout_base), \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_layout_base_efl_object_dbg_info_get) diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c index 3b6db20f40..ea1c9fe06a 100644 --- a/src/lib/elementary/efl_ui_panes.c +++ b/src/lib/elementary/efl_ui_panes.c @@ -695,11 +695,11 @@ _efl_ui_panes_part_split_ratio_min_set(Eo *obj, void *_pd EINA_UNUSED, double ra /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_panes) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_panes) #define EFL_UI_PANES_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_OPS(efl_ui_panes), \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(efl_ui_panes) + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(efl_ui_panes) #include "efl_ui_panes.eo.c" #include "efl_ui_panes_eo.legacy.c" diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c index 4ea4b26482..61c6ece78b 100644 --- a/src/lib/elementary/efl_ui_progressbar.c +++ b/src/lib/elementary/efl_ui_progressbar.c @@ -780,10 +780,10 @@ ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_progressbar, Efl_Ui_Progressbar_Data) ELM_PART_MARKUP_DEFAULT_IMPLEMENT(efl_ui_progressbar, Efl_Ui_Progressbar_Data) ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_progressbar, Efl_Ui_Progressbar_Data) -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_progressbar) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_progressbar) #define EFL_UI_PROGRESSBAR_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(efl_ui_progressbar), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(efl_ui_progressbar), \ EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_progressbar) #include "efl_ui_progressbar.eo.c" diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c index a7106a3643..18f0c6b3c3 100644 --- a/src/lib/elementary/efl_ui_radio.c +++ b/src/lib/elementary/efl_ui_radio.c @@ -306,10 +306,10 @@ _efl_ui_radio_efl_access_object_state_set_get(const Eo *obj, Efl_Ui_Radio_Data * /* Internal EO APIs and hidden overrides */ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_radio, Efl_Ui_Radio_Data) -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_RADIO_EXTRA_OPS \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) #include "efl_ui_radio.eo.c" #include "efl_ui_radio_group.eo.c" diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 7b29f3e41e..a57ca7e4f9 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -4082,7 +4082,7 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_text, EFL_UI_TEXT, Efl_Ui_Text_Data) /* Internal EO APIs and hidden overrides */ -//ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +//EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #include "efl_ui_text.eo.c" diff --git a/src/lib/elementary/elm_actionslider.c b/src/lib/elementary/elm_actionslider.c index 05036fea8e..4537cd9255 100644 --- a/src/lib/elementary/elm_actionslider.c +++ b/src/lib/elementary/elm_actionslider.c @@ -636,10 +636,10 @@ ELM_PART_OVERRIDE_TEXT_GET(elm_actionslider, ELM_ACTIONSLIDER, Elm_Actionslider_ /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define ELM_ACTIONSLIDER_EXTRA_OPS \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_ADD_OPS(elm_actionslider) #include "elm_actionslider_eo.c" diff --git a/src/lib/elementary/elm_bubble.c b/src/lib/elementary/elm_bubble.c index df395831a4..06ebba6d43 100644 --- a/src/lib/elementary/elm_bubble.c +++ b/src/lib/elementary/elm_bubble.c @@ -223,12 +223,12 @@ ELM_PART_OVERRIDE_TEXT_SET(elm_bubble, ELM_BUBBLE, Elm_Bubble_Data) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define ELM_BUBBLE_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_ADD_OPS(elm_bubble) #include "elm_bubble_eo.c" diff --git a/src/lib/elementary/elm_conform.c b/src/lib/elementary/elm_conform.c index 55c6bc8488..38521427a3 100644 --- a/src/lib/elementary/elm_conform.c +++ b/src/lib/elementary/elm_conform.c @@ -1025,10 +1025,10 @@ _elm_conformant_class_constructor(Efl_Class *klass) /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define ELM_CONFORMANT_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_conformant) #include "elm_conformant_eo.c" diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index c186bdebc3..28fcd55542 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -6265,14 +6265,14 @@ ELM_PART_CONTENT_DEFAULT_GET(elm_entry, "icon") /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) -ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define ELM_ENTRY_EXTRA_OPS \ ELM_PART_CONTENT_DEFAULT_OPS(elm_entry), \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_entry), \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ - ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \ EFL_CANVAS_GROUP_CALC_OPS(elm_entry) #include "elm_entry_eo.c" diff --git a/src/lib/elementary/elm_hover.c b/src/lib/elementary/elm_hover.c index 17691a0fcf..0a46903d99 100644 --- a/src/lib/elementary/elm_hover.c +++ b/src/lib/elementary/elm_hover.c @@ -872,12 +872,12 @@ ELM_PART_OVERRIDE_CONTENT_UNSET(elm_hover, ELM_HOVER, Elm_Hover_Data) /* Internal EO APIs and hidden overrides */ -// ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) is overridden with an if() -// ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) somehow doesn't compile!? +// EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) is overridden with an if() +// EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) somehow doesn't compile!? #define ELM_HOVER_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_hover), \ EFL_CANVAS_GROUP_CALC_OPS(elm_hover), \ - _ELM_LAYOUT_ALIASES_OPS(elm_hover, content) + _EFL_UI_LAYOUT_ALIASES_OPS(elm_hover, content) #include "elm_hover_eo.c" diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index f7223ae6b4..3361fb23d0 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -935,29 +935,29 @@ void *_elm_entry_signal_callback_del_legacy(Eo *obj, const char *emission, const void efl_ui_win_inlined_parent_set(Eo *obj, Efl_Canvas_Object *parent); /* Internal EO APIs */ -const Elm_Layout_Part_Alias_Description *elm_layout_content_aliases_get(const Eo *obj); -const Elm_Layout_Part_Alias_Description *elm_layout_text_aliases_get(const Eo *obj); +const Elm_Layout_Part_Alias_Description *efl_ui_layout_content_aliases_get(const Eo *obj); +const Elm_Layout_Part_Alias_Description *efl_ui_layout_text_aliases_get(const Eo *obj); void efl_ui_slider_val_fetch(Evas_Object *obj, Eina_Bool user_event); void efl_ui_slider_val_set(Evas_Object *obj); void efl_ui_slider_down_knob(Evas_Object *obj, double button_x, double button_y); void efl_ui_slider_move_knob(Evas_Object *obj, double button_x, double button_y); //void elm_layout_sizing_eval_eoapi(Eo *obj); -# define _ELM_LAYOUT_ALIASES_IMPLEMENT(_pfx, _typ) \ +# define _EFL_UI_LAYOUT_ALIASES_IMPLEMENT(_pfx, _typ) \ static const Elm_Layout_Part_Alias_Description * \ _##_pfx##_##_typ##_aliases_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED) \ { \ return _##_typ##_aliases; \ } -# define _ELM_LAYOUT_ALIASES_OPS(_pfx, _typ) \ - EFL_OBJECT_OP_FUNC(elm_layout_##_typ##_aliases_get, _##_pfx##_##_typ##_aliases_get) +# define _EFL_UI_LAYOUT_ALIASES_OPS(_pfx, _typ) \ + EFL_OBJECT_OP_FUNC(efl_ui_layout_##_typ##_aliases_get, _##_pfx##_##_typ##_aliases_get) -# define ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(_pfx) _ELM_LAYOUT_ALIASES_IMPLEMENT(_pfx, content) -# define ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(_pfx) _ELM_LAYOUT_ALIASES_IMPLEMENT(_pfx, text) +# define EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(_pfx) _EFL_UI_LAYOUT_ALIASES_IMPLEMENT(_pfx, content) +# define EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(_pfx) _EFL_UI_LAYOUT_ALIASES_IMPLEMENT(_pfx, text) -# define ELM_LAYOUT_CONTENT_ALIASES_OPS(_pfx) _ELM_LAYOUT_ALIASES_OPS(_pfx, content) -# define ELM_LAYOUT_TEXT_ALIASES_OPS(_pfx) _ELM_LAYOUT_ALIASES_OPS(_pfx, text) +# define EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(_pfx) _EFL_UI_LAYOUT_ALIASES_OPS(_pfx, content) +# define EFL_UI_LAYOUT_TEXT_ALIASES_OPS(_pfx) _EFL_UI_LAYOUT_ALIASES_OPS(_pfx, text) # define EFL_CANVAS_GROUP_CALC_OPS(_pfx) \ EFL_OBJECT_OP_FUNC(efl_canvas_group_calculate, _##_pfx##_efl_canvas_group_group_calculate) diff --git a/src/lib/elementary/elm_slider.c b/src/lib/elementary/elm_slider.c index cc09ed14b7..85426386e2 100644 --- a/src/lib/elementary/elm_slider.c +++ b/src/lib/elementary/elm_slider.c @@ -1726,9 +1726,9 @@ void _elm_slider_efl_ui_format_apply_formatted_value(Eo *obj EINA_UNUSED, Elm_Sl /* Internal EO APIs and hidden overrides */ -ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(elm_slider) +EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(elm_slider) #define ELM_SLIDER_EXTRA_OPS \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(elm_slider) + EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(elm_slider) #include "elm_slider_eo.c" From 91f18dc4273080a2d6cfd1523bdd94104650d094 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 23 Sep 2019 15:20:07 -0400 Subject: [PATCH 037/115] efl_ui/layout: fix part aliasing for non-legacy widgets if a non-null value is passed here, this needs to actually evaluate all the part aliases Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10091 --- src/lib/elementary/efl_ui_layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 46aaebcc5d..1ebee5778e 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -655,8 +655,8 @@ _elm_layout_part_aliasing_eval(const Evas_Object *obj, *part = efl_ui_default_text; else *part = efl_ui_default_content; + return EINA_TRUE; } - return EINA_TRUE; } if (is_text) From 351072711cbdea756421f22abc2382bc98e95e57 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Tue, 24 Sep 2019 16:56:48 -0400 Subject: [PATCH 038/115] efl_ui_selection_manager: fix potential out of bounce access Summary: We have been casting the selection to unsigned char * for the address of sel and not for the value. Coverity pointed this out: Overrunning buffer pointed to by (unsigned char *)&sel of 8 bytes by passing it to a function which accesses it at byte offset 167 using argument 168 It seems this has been working by memory layout and luck if I understand it all correctly. Coverity ID: 1402666 Reviewers: thiepha, raster, zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10107 --- src/lib/elementary/efl_ui_selection_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_selection_manager.c b/src/lib/elementary/efl_ui_selection_manager.c index 38b1766b9c..3d8e311580 100644 --- a/src/lib/elementary/efl_ui_selection_manager.c +++ b/src/lib/elementary/efl_ui_selection_manager.c @@ -1483,7 +1483,7 @@ _x11_efl_sel_manager_drag_start(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Da /* TODO BUG: should increase dnd-awareness, in case it's drop target as well. See _x11_drag_mouse_up() */ ecore_x_dnd_aware_set(xwin, EINA_TRUE); ecore_x_dnd_callback_pos_update_set(_x11_drag_move, seat_sel); - ecore_x_dnd_self_begin(xwin, (unsigned char *)&sel, sizeof(Sel_Manager_Selection)); + ecore_x_dnd_self_begin(xwin, (unsigned char *)sel, sizeof(Sel_Manager_Selection)); actx = _x11_dnd_action_rev_map(seat_sel->drag_action); ecore_x_dnd_source_action_set(actx); ecore_x_pointer_grab(xwin); From 2e7b508312bf7dc6bd884475513f7d799d2f285d Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Tue, 24 Sep 2019 11:36:34 -0300 Subject: [PATCH 039/115] csharp: Fix wrapping of private classes Summary: Sometimes, valid Eo objects of private classes can be returned from methods. Currently we try to wrap in a minimal `Efl.Object` instance, but as it is an abstract class, we can't instantiate directly. This commits adds a dummy `Efl.ObjectRealized` to be instantiated when wrapping such classes alongside a test case. Fixes: T8258 Reviewers: felipealmeida, brunobelo, segfaultxavi, Jaehyun_Cho Reviewed By: brunobelo Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10101 --- src/bindings/mono/eo_mono/EoWrapper.cs | 11 +++++++++++ src/bindings/mono/eo_mono/iwrapper.cs | 2 +- src/tests/efl_mono/Eo.cs | 11 +++++++++++ src/tests/efl_mono/dummy_hidden_object.c | 8 ++++++++ src/tests/efl_mono/dummy_hidden_object.eo | 2 ++ src/tests/efl_mono/dummy_test_object.c | 8 ++++++++ src/tests/efl_mono/dummy_test_object.eo | 8 ++++++++ src/tests/efl_mono/libefl_mono_native_test.h | 1 + src/tests/efl_mono/meson.build | 7 ++++++- 9 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 src/tests/efl_mono/dummy_hidden_object.c create mode 100644 src/tests/efl_mono/dummy_hidden_object.eo diff --git a/src/bindings/mono/eo_mono/EoWrapper.cs b/src/bindings/mono/eo_mono/EoWrapper.cs index 1805071175..79d597c7b6 100644 --- a/src/bindings/mono/eo_mono/EoWrapper.cs +++ b/src/bindings/mono/eo_mono/EoWrapper.cs @@ -413,4 +413,15 @@ public abstract class EoWrapper : IWrapper, IDisposable } // namespace Eo +/// Concrete realization of Efl.Object. +/// +/// Some legacy classes (like Evas.Canvas) may be returned by some methods. As these classes are not bound, we +/// allow minimal interaction with them through . +/// +/// But as is abstract, whis realized class will allow us to create C# instances of it. +internal class ObjectRealized : Efl.Object +{ + protected ObjectRealized(Efl.Eo.Globals.WrappingHandle ch) : base(ch) { } +} + } // namespace Efl diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index a03e48a326..8fe4b0623f 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -843,7 +843,7 @@ public static class ClassRegister if (t == null) { - return typeof(Efl.Object); + return typeof(Efl.ObjectRealized); } } diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs index 4c7196ec5b..a2e178adbb 100644 --- a/src/tests/efl_mono/Eo.cs +++ b/src/tests/efl_mono/Eo.cs @@ -621,4 +621,15 @@ class TestStaticInterfaceMembers } } +class TestHiddenClasses +{ + public static void test_hidden_class() + { + var obj = new Dummy.TestObject(); + var hidden = obj.HiddenObject; + + Test.AssertEquals(hidden.Name, "hidden_object"); + } +} + } diff --git a/src/tests/efl_mono/dummy_hidden_object.c b/src/tests/efl_mono/dummy_hidden_object.c new file mode 100644 index 0000000000..cf9c9cde5b --- /dev/null +++ b/src/tests/efl_mono/dummy_hidden_object.c @@ -0,0 +1,8 @@ +#include "libefl_mono_native_test.h" + +typedef struct Dummy_Hidden_Object_Data +{ +} Dummy_Hidden_Object_Data; + + +#include "dummy_hidden_object.eo.c" diff --git a/src/tests/efl_mono/dummy_hidden_object.eo b/src/tests/efl_mono/dummy_hidden_object.eo new file mode 100644 index 0000000000..1b29472a1c --- /dev/null +++ b/src/tests/efl_mono/dummy_hidden_object.eo @@ -0,0 +1,2 @@ +class Dummy.Hidden_Object extends Efl.Object { +} diff --git a/src/tests/efl_mono/dummy_test_object.c b/src/tests/efl_mono/dummy_test_object.c index 0406dd3f53..7f158430a2 100644 --- a/src/tests/efl_mono/dummy_test_object.c +++ b/src/tests/efl_mono/dummy_test_object.c @@ -22,6 +22,7 @@ typedef struct Dummy_Test_Object_Data Eo *iface_provider; int prop1; int prop2; + Eo *hidden_object; // Containers passed to C# as iterator/accessors Eina_Array *out_array; @@ -75,6 +76,8 @@ _dummy_test_object_efl_object_constructor(Eo *obj, Dummy_Test_Object_Data *pd) { efl_constructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS)); pd->provider = efl_add(DUMMY_NUMBERWRAPPER_CLASS, obj); + pd->hidden_object = efl_add(DUMMY_HIDDEN_OBJECT_CLASS, obj); + efl_name_set(pd->hidden_object, "hidden_object"); if (efl_parent_get(obj) == NULL) { // Avoid recursion pd->iface_provider = efl_add(DUMMY_TEST_OBJECT_CLASS, obj); @@ -4738,6 +4741,11 @@ int _dummy_test_object_dummy_test_iface_call_method_protected(const Eo *obj, EIN return dummy_test_iface_method_protected(obj, x); } +Eo *_dummy_test_object_hidden_object_get(EINA_UNUSED const Eo *obj, Dummy_Test_Object_Data *pd) +{ + return pd->hidden_object; +} + // Inherit int _dummy_inherit_helper_receive_dummy_and_call_int_out(Dummy_Test_Object *x) { diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo index a63c822375..44a7c97464 100644 --- a/src/tests/efl_mono/dummy_test_object.eo +++ b/src/tests/efl_mono/dummy_test_object.eo @@ -1646,6 +1646,14 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface { } return: const(ptr(Eina.Value_Type)); } + + @property hidden_object { + get {} + + values { + obj: Efl.Object; + } + } } implements { Efl.Object.constructor; diff --git a/src/tests/efl_mono/libefl_mono_native_test.h b/src/tests/efl_mono/libefl_mono_native_test.h index b726bd05c1..87abefe5e2 100644 --- a/src/tests/efl_mono/libefl_mono_native_test.h +++ b/src/tests/efl_mono/libefl_mono_native_test.h @@ -56,6 +56,7 @@ #include "dummy_part_holder.eo.h" #include "dummy_event_manager.eo.h" #include "dummy_constructible_object.eo.h" +#include "dummy_hidden_object.eo.h" #include diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build index 202c09fbb0..d7cd6bbff7 100644 --- a/src/tests/efl_mono/meson.build +++ b/src/tests/efl_mono/meson.build @@ -10,9 +10,13 @@ eo_files = [ 'dummy_constructible_object.eo', ] +private_eo_files = [ + 'dummy_hidden_object.eo' +] + eo_file_targets = [] -foreach eo_file : eo_files +foreach eo_file : eo_files + private_eo_files eo_file_targets += custom_target('eolian_gen_' + eo_file, input : eo_file, output : [eo_file + '.h'], @@ -35,6 +39,7 @@ efl_mono_native_test = library('efl_mono_native_test', 'dummy_test_object.c', 'dummy_event_manager.c', 'dummy_constructible_object.c', + 'dummy_hidden_object.c', ], dependencies : [ecore, eo, efl], ) From 91ac3774b5bcb5649de4f0360b99c98244d05945 Mon Sep 17 00:00:00 2001 From: Bruno da Silva Belo Date: Tue, 24 Sep 2019 16:50:49 -0300 Subject: [PATCH 040/115] eolian: fixing switch case. Summary: Scope of the switch breaks compilation. Reviewers: felipealmeida, segfaultxavi, brunobelo Reviewed By: brunobelo Subscribers: segfaultxavi, cedric, brunobelo, felipealmeida, #reviewers, lauromoura, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10118 --- src/bin/eolian_mono/eolian/mono/documentation.hh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/documentation.hh b/src/bin/eolian_mono/eolian/mono/documentation.hh index a7821c5e5d..6ed8169632 100644 --- a/src/bin/eolian_mono/eolian/mono/documentation.hh +++ b/src/bin/eolian_mono/eolian/mono/documentation.hh @@ -188,11 +188,13 @@ struct documentation_generator is_beta = eolian_object_is_beta(data) || eolian_object_is_beta(data2); break; case ::EOLIAN_OBJECT_CONSTANT: - auto names = utils::split(name_helpers::managed_namespace(::eolian_object_name_get(data)), '.'); - names.pop_back(); // Remove var name - ref = name_helpers::join_namespaces(names, '.'); - ref += "Constants."; - ref += name_helpers::managed_name(::eolian_object_short_name_get(data)); + { + auto names = utils::split(name_helpers::managed_namespace(::eolian_object_name_get(data)), '.'); + names.pop_back(); // Remove var name + ref = name_helpers::join_namespaces(names, '.'); + ref += "Constants."; + ref += name_helpers::managed_name(::eolian_object_short_name_get(data)); + } break; case ::EOLIAN_OBJECT_UNKNOWN: // If the reference cannot be resolved, just return an empty string and From c85e6e147d21c2a411c6893b5b26c66afc9d4c99 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 16:59:33 -0400 Subject: [PATCH 041/115] theme: manually specify version info for all eo-based widget themes Summary: this needs to be provided to verify that the theme corresponds to the current version of the widget ref T8231 Depends on D10079 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl_widgets Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10080 --- data/elementary/themes/edc/efl/bg.edc | 2 +- data/elementary/themes/edc/efl/border.edc | 4 +- data/elementary/themes/edc/efl/button.edc | 4 +- data/elementary/themes/edc/efl/calendar.edc | 5 +- data/elementary/themes/edc/efl/check.edc | 4 +- data/elementary/themes/edc/efl/collection.edc | 1 + data/elementary/themes/edc/efl/cursor.edc | 6 +- data/elementary/themes/edc/efl/datepicker.edc | 4 +- data/elementary/themes/edc/efl/focus.edc | 4 +- data/elementary/themes/edc/efl/frame.edc | 2 +- data/elementary/themes/edc/efl/grid.edc | 4 +- data/elementary/themes/edc/efl/group_item.edc | 2 +- .../themes/edc/efl/image_zoomable.edc | 1 + data/elementary/themes/edc/efl/list.edc | 6 +- .../themes/edc/efl/navigation_bar.edc | 3 +- .../themes/edc/efl/navigation_layout.edc | 2 +- data/elementary/themes/edc/efl/pager.edc | 4 +- data/elementary/themes/edc/efl/panel.edc | 15 ++-- data/elementary/themes/edc/efl/panes.edc | 12 ++- data/elementary/themes/edc/efl/pointer.edc | 8 +- data/elementary/themes/edc/efl/popup.edc | 14 +-- data/elementary/themes/edc/efl/progress.edc | 5 ++ data/elementary/themes/edc/efl/radio.edc | 1 + data/elementary/themes/edc/efl/scroller.edc | 4 + data/elementary/themes/edc/efl/slider.edc | 4 + data/elementary/themes/edc/efl/spin.edc | 1 + .../elementary/themes/edc/efl/spin_button.edc | 8 ++ data/elementary/themes/edc/efl/tab_bar.edc | 2 + data/elementary/themes/edc/efl/tab_page.edc | 1 + data/elementary/themes/edc/efl/tab_pager.edc | 1 + data/elementary/themes/edc/efl/tags.edc | 4 + data/elementary/themes/edc/efl/text.edc | 89 ++++++++++--------- data/elementary/themes/edc/efl/textpath.edc | 1 + data/elementary/themes/edc/efl/timepicker.edc | 2 + data/elementary/themes/edc/efl/uiclock.edc | 4 + data/elementary/themes/edc/efl/video.edc | 1 + data/elementary/themes/edc/efl/win.edc | 2 +- 37 files changed, 156 insertions(+), 81 deletions(-) diff --git a/data/elementary/themes/edc/efl/bg.edc b/data/elementary/themes/edc/efl/bg.edc index f66ef6517e..8fe902e54f 100644 --- a/data/elementary/themes/edc/efl/bg.edc +++ b/data/elementary/themes/edc/efl/bg.edc @@ -7,7 +7,7 @@ */ group { "efl/bg"; - data.item: "version" "119"; + data.item: "version" "123"; images.image: "bevel_dark_out.png" COMP; parts { part { name: "clipper"; type: RECT; diff --git a/data/elementary/themes/edc/efl/border.edc b/data/elementary/themes/edc/efl/border.edc index 1bd5a738ac..67bee1658d 100644 --- a/data/elementary/themes/edc/efl/border.edc +++ b/data/elementary/themes/edc/efl/border.edc @@ -7,7 +7,7 @@ * - virtual keyboard */ -group { "efl/border"; +group { "efl/border"; data.item: "version" "123"; images.image: "vgrad_med_lighter.png" COMP; images.image: "vgrad_med_dark.png" COMP; images.image: "bevel_out.png" COMP; @@ -1124,6 +1124,7 @@ group { "efl/border"; group { "efl/border/dialog"; inherit: "efl/border"; + data.item: "version" "123"; parts { text { "efl.text.title"; clip: "top_clip"; @@ -1191,6 +1192,7 @@ group { "efl/border/dialog"; group { "efl/border/naviframe"; inherit: "efl/border"; + data.item: "version" "123"; images.image: "sym_left_dark_normal.png" COMP; images.image: "sym_left_glow_normal.png" COMP; images.image: "sym_left_light_normal.png" COMP; diff --git a/data/elementary/themes/edc/efl/button.edc b/data/elementary/themes/edc/efl/button.edc index 203e467cc7..0f24ebbf7e 100644 --- a/data/elementary/themes/edc/efl/button.edc +++ b/data/elementary/themes/edc/efl/button.edc @@ -1,4 +1,4 @@ -group { name: "efl/button"; +group { name: "efl/button"; data.item: "version" "123"; images.image: "button_normal.png" COMP; images.image: "button_clicked.png" COMP; @@ -403,7 +403,7 @@ group { name: "efl/button"; #undef BACKGROUND } -group { name: "efl/button:anchor"; +group { name: "efl/button:anchor"; data.item: "version" "123"; images.image: "horizontal_separated_bar_small_glow.png" COMP; #define ICON 1 #define LABEL 2 diff --git a/data/elementary/themes/edc/efl/calendar.edc b/data/elementary/themes/edc/efl/calendar.edc index 5408d44951..459dbdbf00 100644 --- a/data/elementary/themes/edc/efl/calendar.edc +++ b/data/elementary/themes/edc/efl/calendar.edc @@ -420,7 +420,7 @@ } \ } -group { "efl/calendar"; +group { "efl/calendar"; data.item: "version" "123"; images.image: "sym_left_light_normal.png" COMP; images.image: "sym_right_light_normal.png" COMP; images.image: "sym_left_glow_normal.png" COMP; @@ -541,7 +541,7 @@ group { "efl/calendar"; #undef CIT #undef CH - group { name: "efl/calendar/inc_button"; + group { name: "efl/calendar/inc_button"; data.item: "version" "123"; images.image: "sym_right_light_normal.png" COMP; images.image: "sym_right_glow_normal.png" COMP; images.image: "sym_right_dark_normal.png" COMP; @@ -693,6 +693,7 @@ group { "efl/calendar"; group { name: "efl/calendar/dec_button"; inherit: "efl/calendar/inc_button"; + data.item: "version" "123"; images.image: "sym_left_light_normal.png" COMP; images.image: "sym_left_glow_normal.png" COMP; images.image: "sym_left_dark_normal.png" COMP; diff --git a/data/elementary/themes/edc/efl/check.edc b/data/elementary/themes/edc/efl/check.edc index aed5ac6762..cccd10b824 100644 --- a/data/elementary/themes/edc/efl/check.edc +++ b/data/elementary/themes/edc/efl/check.edc @@ -1,4 +1,4 @@ -group { "efl/check"; +group { "efl/check"; data.item: "version" "123"; images.image: "inset_shadow_tiny.png" COMP; images.image: "bevel_in.png" COMP; images.image: "sym_check_alum.png" COMP; @@ -322,7 +322,7 @@ group { "efl/check"; #undef DISABLE } -group { "efl/check:toggle"; +group { "efl/check:toggle"; data.item: "version" "123"; images.image: "inset_shadow_tiny.png" COMP; images.image: "bevel_in.png" COMP; images.image: "bevel_out.png" COMP; diff --git a/data/elementary/themes/edc/efl/collection.edc b/data/elementary/themes/edc/efl/collection.edc index d74981dbb2..47183573f4 100644 --- a/data/elementary/themes/edc/efl/collection.edc +++ b/data/elementary/themes/edc/efl/collection.edc @@ -1,3 +1,4 @@ group { "efl/collection"; inherit: "efl/scroller"; + data.item: "version" "123"; } diff --git a/data/elementary/themes/edc/efl/cursor.edc b/data/elementary/themes/edc/efl/cursor.edc index a62817708b..9376befe75 100644 --- a/data/elementary/themes/edc/efl/cursor.edc +++ b/data/elementary/themes/edc/efl/cursor.edc @@ -78,7 +78,7 @@ // "watch" // "xterm" -group { name: "efl/cursor/hand1"; +group { name: "efl/cursor/hand1"; data.item: "version" "123"; images.image: "pointer_hand1.png" COMP; parts { part { name: "base"; mouse_events: 0; scale: 1; @@ -103,7 +103,7 @@ group { name: "efl/cursor/hand1"; } } -group { name: "efl/cursor/blank"; +group { name: "efl/cursor/blank"; data.item: "version" "123"; parts { part { name: "efl.hotspot"; type: SWALLOW; description { state: "default" 0.0; @@ -116,7 +116,7 @@ group { name: "efl/cursor/blank"; } } -group { name: "efl/cursor/xterm"; +group { name: "efl/cursor/xterm"; data.item: "version" "123"; images.image: "pointer_entry_bar.png" COMP; images.image: "led_dot_white.png" COMP; parts { diff --git a/data/elementary/themes/edc/efl/datepicker.edc b/data/elementary/themes/edc/efl/datepicker.edc index cdc76e38e6..a0c23597c2 100644 --- a/data/elementary/themes/edc/efl/datepicker.edc +++ b/data/elementary/themes/edc/efl/datepicker.edc @@ -1,4 +1,4 @@ -group { "efl/datepicker"; +group { "efl/datepicker"; data.item: "version" "123"; parts { spacer { "base"; scale; @@ -182,7 +182,7 @@ group { "efl/datepicker"; } } -group { "efl/datepicker/spin_button"; +group { "efl/datepicker/spin_button"; data.item: "version" "123"; parts { rect { "clip"; desc { "default"; diff --git a/data/elementary/themes/edc/efl/focus.edc b/data/elementary/themes/edc/efl/focus.edc index a5edbe49b3..59ce554679 100644 --- a/data/elementary/themes/edc/efl/focus.edc +++ b/data/elementary/themes/edc/efl/focus.edc @@ -1,4 +1,4 @@ -group { name: "efl/focus_highlight/top"; +group { name: "efl/focus_highlight/top"; data.item: "version" "123"; images.image: "box_glow.png" COMP; images.image: "box_outline.png" COMP; data.item: "animate" "on"; @@ -171,7 +171,7 @@ group { name: "efl/focus_highlight/top"; } } -group { name: "efl/focus_highlight/top:blank"; +group { name: "efl/focus_highlight/top:blank"; data.item: "version" "123"; parts { } } diff --git a/data/elementary/themes/edc/efl/frame.edc b/data/elementary/themes/edc/efl/frame.edc index d964e47502..1844d25f22 100644 --- a/data/elementary/themes/edc/efl/frame.edc +++ b/data/elementary/themes/edc/efl/frame.edc @@ -1,4 +1,4 @@ -group { name: "efl/frame"; +group { name: "efl/frame"; data.item: "version" "123"; images.image: "shadow_square_tiny.png" COMP; images.image: "vgrad_med_curved.png" COMP; images.image: "bevel_out.png" COMP; diff --git a/data/elementary/themes/edc/efl/grid.edc b/data/elementary/themes/edc/efl/grid.edc index fec2e8e110..4018bc0de4 100644 --- a/data/elementary/themes/edc/efl/grid.edc +++ b/data/elementary/themes/edc/efl/grid.edc @@ -1,12 +1,14 @@ group { "efl/grid"; inherit: "efl/scroller"; + data.item: "version" "123"; } group { "efl/view_grid"; inherit: "efl/grid"; + data.item: "version" "123"; } -group { "efl/grid_item"; +group { "efl/grid_item"; data.item: "version" "123"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; images.image: "bevel_dark_out.png" COMP; diff --git a/data/elementary/themes/edc/efl/group_item.edc b/data/elementary/themes/edc/efl/group_item.edc index 44a19d820b..c052f6dd55 100644 --- a/data/elementary/themes/edc/efl/group_item.edc +++ b/data/elementary/themes/edc/efl/group_item.edc @@ -1,6 +1,6 @@ -group { "efl/group_item"; nomouse; program_source: "efl"; +group { "efl/group_item"; data.item: "version" "123"; nomouse; program_source: "efl"; images.image: "shadow_square_tiny.png" COMP; images.image: "bevel_out.png" COMP; images.image: "horizontal_separated_bar_small_glow.png" COMP; diff --git a/data/elementary/themes/edc/efl/image_zoomable.edc b/data/elementary/themes/edc/efl/image_zoomable.edc index 8f4492c33f..a1852a2b4a 100644 --- a/data/elementary/themes/edc/efl/image_zoomable.edc +++ b/data/elementary/themes/edc/efl/image_zoomable.edc @@ -1,5 +1,6 @@ group { name: "efl/image_zoomable"; inherit: "efl/scroller"; + data.item: "version" "123"; images.image: "knob_round_busy.png" COMP; images.image: "glow_round_corners.png" COMP; parts { diff --git a/data/elementary/themes/edc/efl/list.edc b/data/elementary/themes/edc/efl/list.edc index b0a08c1e50..23a99f6760 100644 --- a/data/elementary/themes/edc/efl/list.edc +++ b/data/elementary/themes/edc/efl/list.edc @@ -1,12 +1,14 @@ group { "efl/list"; inherit: "efl/scroller"; + data.item: "version" "123"; } group { "efl/list_view"; inherit: "efl/list"; + data.item: "version" "123"; } -group { "efl/list_item"; +group { "efl/list_item"; data.item: "version" "123"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; images.image: "bevel_curved_horiz_out.png" COMP; @@ -293,7 +295,7 @@ group { "efl/list_item"; } } -group { "efl/list_item:placeholder"; +group { "efl/list_item:placeholder"; data.item: "version" "123"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; images.image: "bevel_curved_horiz_out.png" COMP; diff --git a/data/elementary/themes/edc/efl/navigation_bar.edc b/data/elementary/themes/edc/efl/navigation_bar.edc index c2b4cee795..ab51d4aea6 100644 --- a/data/elementary/themes/edc/efl/navigation_bar.edc +++ b/data/elementary/themes/edc/efl/navigation_bar.edc @@ -1,5 +1,5 @@ //Efl.Ui.Navigation_Bar Themes -group { "efl/navigation_bar"; +group { "efl/navigation_bar"; data.item: "version" "123"; styles { style { name: "navigation_bar_text"; base: "font="FNBD" font_size=10 text_class=label align=center color=#fff color_class=navigation_bar_text style=shadow,bottom shadow_color=#00000080 ellipsis=1.0 wrap=mixed"; @@ -101,6 +101,7 @@ group { "efl/navigation_bar"; group { name: "efl/navigation_bar/back_button"; inherit: "efl/button"; + data.item: "version" "123"; images.image: "icon_arrow_left.png" COMP; parts { image { name: "icon_arrow_left"; diff --git a/data/elementary/themes/edc/efl/navigation_layout.edc b/data/elementary/themes/edc/efl/navigation_layout.edc index 9947d6d313..a75157da28 100644 --- a/data/elementary/themes/edc/efl/navigation_layout.edc +++ b/data/elementary/themes/edc/efl/navigation_layout.edc @@ -1,5 +1,5 @@ //Efl.Ui.Navigation_Layout Themes -group { "efl/navigation_layout"; +group { "efl/navigation_layout"; data.item: "version" "123"; parts { spacer { "base"; desc { "default"; diff --git a/data/elementary/themes/edc/efl/pager.edc b/data/elementary/themes/edc/efl/pager.edc index b6b286e999..6f45c3680c 100644 --- a/data/elementary/themes/edc/efl/pager.edc +++ b/data/elementary/themes/edc/efl/pager.edc @@ -1,4 +1,4 @@ -group { "efl/pager"; +group { "efl/pager"; data.item: "version" "123"; parts { spacer { "base"; scale; @@ -32,7 +32,7 @@ group { "efl/pager"; } } -group { "efl/pager/indicator"; +group { "efl/pager/indicator"; data.item: "version" "123"; images { image: "ring_white_middle.png" COMP; } diff --git a/data/elementary/themes/edc/efl/panel.edc b/data/elementary/themes/edc/efl/panel.edc index aee2e31f6f..6ad3afc727 100644 --- a/data/elementary/themes/edc/efl/panel.edc +++ b/data/elementary/themes/edc/efl/panel.edc @@ -1,4 +1,4 @@ -group { name: "efl/panel"; +group { name: "efl/panel"; data.item: "version" "123"; data { item: "handler_size" "30"; } @@ -10,7 +10,7 @@ group { name: "efl/panel"; } } } -group { name: "efl/panel/scrollable/left"; +group { name: "efl/panel/scrollable/left"; data.item: "version" "123"; parts { part { name: "efl.panel_area"; type: SWALLOW; @@ -102,7 +102,7 @@ group { name: "efl/panel/scrollable/left"; } } -group { name: "efl/panel/scrollable/right"; +group { name: "efl/panel/scrollable/right"; data.item: "version" "123"; parts { part { name: "efl.event_area"; type: SWALLOW; @@ -194,7 +194,7 @@ group { name: "efl/panel/scrollable/right"; } } -group { name: "efl/panel/scrollable/top"; +group { name: "efl/panel/scrollable/top"; data.item: "version" "123"; parts { part { name: "efl.panel_area"; type: SWALLOW; @@ -286,7 +286,7 @@ group { name: "efl/panel/scrollable/top"; } } -group { name: "efl/panel/scrollable/bottom"; +group { name: "efl/panel/scrollable/bottom"; data.item: "version" "123"; parts { part { name: "efl.event_area"; type: SWALLOW; @@ -378,7 +378,7 @@ group { name: "efl/panel/scrollable/bottom"; } } -group { name: "efl/panel/left"; +group { name: "efl/panel/left"; data.item: "version" "123"; images.image: "bevel_out.png" COMP; images.image: "shine.png" COMP; images.image: "shadow_square_tiny.png" COMP; @@ -627,6 +627,7 @@ group { name: "efl/panel/left"; group { name: "efl/panel/right"; inherit: "efl/panel/left"; + data.item: "version" "123"; parts { part { name: "base"; description { state: "default" 0.0; @@ -681,6 +682,7 @@ group { name: "efl/panel/right"; group { name: "efl/panel/top"; inherit: "efl/panel/left"; + data.item: "version" "123"; parts { part { name: "base"; description { state: "default" 0.0; @@ -775,6 +777,7 @@ group { name: "efl/panel/top"; group { name: "efl/panel/bottom"; inherit: "efl/panel/top"; + data.item: "version" "123"; parts { part { name: "base"; description { state: "default" 0.0; diff --git a/data/elementary/themes/edc/efl/panes.edc b/data/elementary/themes/edc/efl/panes.edc index 5bd90aed7d..7b8993401a 100644 --- a/data/elementary/themes/edc/efl/panes.edc +++ b/data/elementary/themes/edc/efl/panes.edc @@ -13,7 +13,7 @@ #define PANEMIN2 16 #define PANEWID 32 -group { name: "efl/panes/vertical"; +group { name: "efl/panes/vertical"; data.item: "version" "123"; images.image: "holes_vert.png" COMP; parts { //TODO: remove left/right @@ -143,7 +143,7 @@ group { name: "efl/panes/vertical"; } } -group { name: "efl/panes/horizontal"; +group { name: "efl/panes/horizontal"; data.item: "version" "123"; images.image: "holes_horiz.png" COMP; parts { //TODO: remove left/right @@ -273,7 +273,7 @@ group { name: "efl/panes/horizontal"; } } -group { name: "efl/panes/vertical:flush"; +group { name: "efl/panes/vertical:flush"; data.item: "version" "123"; images.image: "downlight_glow_left.png" COMP; images.image: "downlight_glow_right.png" COMP; parts { @@ -490,7 +490,7 @@ group { name: "efl/panes/vertical:flush"; } } -group { name: "efl/panes/horizontal:flush"; +group { name: "efl/panes/horizontal:flush"; data.item: "version" "123"; images.image: "downlight_glow.png" COMP; images.image: "downlight_glow_up.png" COMP; parts { @@ -709,6 +709,7 @@ group { name: "efl/panes/horizontal:flush"; group { name: "efl/panes/vertical:left-fold"; inherit: "efl/panes/vertical"; + data.item: "version" "123"; images.image: "icon_arrow_left.png" COMP; images.image: "icon_arrow_right.png" COMP; script { @@ -772,6 +773,7 @@ group { name: "efl/panes/vertical:left-fold"; group { name: "efl/panes/vertical:right-fold"; inherit: "efl/panes/vertical"; + data.item: "version" "123"; images.image: "icon_arrow_left.png" COMP; images.image: "icon_arrow_right.png" COMP; script { @@ -835,6 +837,7 @@ group { name: "efl/panes/vertical:right-fold"; group { name: "efl/panes/horizontal:up-fold"; inherit: "efl/panes/horizontal"; + data.item: "version" "123"; images.image: "icon_arrow_up.png" COMP; images.image: "icon_arrow_down.png" COMP; script { @@ -898,6 +901,7 @@ group { name: "efl/panes/horizontal:up-fold"; group { name: "efl/panes/horizontal:down-fold"; inherit: "efl/panes/horizontal"; + data.item: "version" "123"; images.image: "icon_arrow_up.png" COMP; images.image: "icon_arrow_down.png" COMP; script { diff --git a/data/elementary/themes/edc/efl/pointer.edc b/data/elementary/themes/edc/efl/pointer.edc index 0794400b23..d720005b90 100644 --- a/data/elementary/themes/edc/efl/pointer.edc +++ b/data/elementary/themes/edc/efl/pointer.edc @@ -1,4 +1,4 @@ -group { name: "efl/pointer"; +group { name: "efl/pointer"; data.item: "version" "123"; images { image: "pointer.png" COMP; image: "pointer_glow.png" COMP; @@ -105,6 +105,7 @@ group { name: "efl/pointer"; group { name: "efl/pointer:bottom_right_corner"; inherit: "efl/pointer"; + data.item: "version" "123"; images.image: "mini_box_glow.png" COMP; parts { part { name: "box"; @@ -141,6 +142,7 @@ group { name: "efl/pointer:bottom_right_corner"; group { name: "efl/pointer:bottom_left_corner"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; @@ -158,6 +160,7 @@ group { name: "efl/pointer:bottom_left_corner"; group { name: "efl/pointer:bottom_side"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; @@ -174,6 +177,7 @@ group { name: "efl/pointer:bottom_side"; group { name: "efl/pointer:top_right_corner"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; @@ -190,6 +194,7 @@ group { name: "efl/pointer:top_right_corner"; group { name: "efl/pointer:top_left_corner"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; @@ -206,6 +211,7 @@ group { name: "efl/pointer:top_left_corner"; group { name: "efl/pointer:top_side"; inherit: "efl/pointer:bottom_right_corner"; + data.item: "version" "123"; parts { part { name: "box"; description { state: "default" 0.0; diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc index ed75534791..176e7b8b20 100644 --- a/data/elementary/themes/edc/efl/popup.edc +++ b/data/elementary/themes/edc/efl/popup.edc @@ -1,5 +1,6 @@ //Efl.Ui.Popup Themes group { "efl/popup"; + data.item: "version" "123"; images.image: "rounded_square.png" COMP; parts { spacer { "base"; @@ -28,7 +29,7 @@ group { "efl/popup"; } } -group { "efl/alert_popup"; +group { "efl/alert_popup"; data.item: "version" "123"; images.image: "rounded_square.png" COMP; parts { alias: "title" "efl.text.title"; @@ -119,7 +120,7 @@ group { "efl/alert_popup"; } } -group { "efl/popup/backwall"; +group { "efl/popup/backwall"; data.item: "version" "123"; alias: "efl/alert_popup/backwall"; parts { rect { "base"; @@ -169,14 +170,14 @@ group { "efl/popup/backwall"; } } -group { "efl/alert_popup/button_layout1"; +group { "efl/alert_popup/button_layout1"; data.item: "version" "123"; parts { swallow { "efl.button1"; required; } } } -group { "efl/alert_popup/button_layout2"; +group { "efl/alert_popup/button_layout2"; data.item: "version" "123"; parts { spacer { "div1"; desc { "default"; @@ -200,7 +201,7 @@ group { "efl/alert_popup/button_layout2"; } } -group { "efl/alert_popup/button_layout3"; +group { "efl/alert_popup/button_layout3"; data.item: "version" "123"; parts { spacer { "div1"; desc { "default"; @@ -241,12 +242,15 @@ group { "efl/alert_popup/button_layout3"; group { "efl/alert_popup/left_button"; inherit: "efl/button"; + data.item: "version" "123"; } group { "efl/alert_popup/right_button"; inherit: "efl/button"; + data.item: "version" "123"; } group { "efl/alert_popup/button"; inherit: "efl/button"; + data.item: "version" "123"; } diff --git a/data/elementary/themes/edc/efl/progress.edc b/data/elementary/themes/edc/efl/progress.edc index 1d48b20545..23f3e07432 100644 --- a/data/elementary/themes/edc/efl/progress.edc +++ b/data/elementary/themes/edc/efl/progress.edc @@ -1,4 +1,5 @@ group { "efl/progressbar/horizontal"; + data.item: "version" "123"; images.image: "inset_bar_horiz_base.png" COMP; images.image: "inset_bar_horiz_light.png" COMP; images.image: "inset_bar_horiz_inside_base.png" COMP; @@ -559,6 +560,7 @@ group { "efl/progressbar/horizontal"; } group { "efl/progressbar/vertical"; + data.item: "version" "123"; images.image: "inset_bar_vert_base.png" COMP; images.image: "inset_bar_vert_light.png" COMP; images.image: "inset_bar_vert_inside_base.png" COMP; @@ -1132,6 +1134,7 @@ group { "efl/progressbar/vertical"; } group { "efl/progressbar/horizontal:wheel"; + data.item: "version" "123"; alias: "efl/progressbar/vertical:wheel"; images.image: "knob_round_busy.png" COMP; images.image: "glow_round_corners.png" COMP; @@ -1226,6 +1229,7 @@ group { "efl/progressbar/horizontal:wheel"; group { "efl/progressbar/horizontal:double"; inherit: "efl/progressbar/horizontal"; + data.item: "version" "123"; images { image: "inset_bar_horiz_glow_base_double.png" COMP; image: "inset_bar_horiz_glow_inv_base_double.png" COMP; @@ -1315,6 +1319,7 @@ group { "efl/progressbar/horizontal:double"; group { "efl/progressbar/vertical:double"; inherit: "efl/progressbar/vertical"; + data.item: "version" "123"; images { image: "inset_bar_vert_glow_base_double.png" COMP; image: "inset_bar_vert_glow_inv_base_double.png" COMP; diff --git a/data/elementary/themes/edc/efl/radio.edc b/data/elementary/themes/edc/efl/radio.edc index 35744936f7..4efbd8eff8 100644 --- a/data/elementary/themes/edc/efl/radio.edc +++ b/data/elementary/themes/edc/efl/radio.edc @@ -1,4 +1,5 @@ group { "efl/radio"; + data.item: "version" "123"; images.image: "inset_shadow_circle_tiny.png" COMP; images.image: "inset_circle_tiny.png" COMP; images.image: "sym_radio_alum.png" COMP; diff --git a/data/elementary/themes/edc/efl/scroller.edc b/data/elementary/themes/edc/efl/scroller.edc index d53f6d5663..256c9e5784 100644 --- a/data/elementary/themes/edc/efl/scroller.edc +++ b/data/elementary/themes/edc/efl/scroller.edc @@ -1,4 +1,5 @@ group { name: "efl/scroller"; + data.item: "version" "123"; images.image: "inset_shadow.png" COMP; images.image: "bevel_in.png" COMP; images.image: "bevel_out.png" COMP; @@ -1235,6 +1236,7 @@ group { name: "efl/scroller"; group { name: "efl/scroller:noclip"; inherit: "efl/scroller"; + data.item: "version" "123"; parts { part { name: "clipper"; description { state: "default" 0.0; @@ -1269,6 +1271,7 @@ group { name: "efl/scroller:noclip"; group { name: "efl/scroller:popup/no_inset_shadow"; inherit: "efl/scroller"; + data.item: "version" "123"; parts { part { name: "inset"; description { state: "default" 0.0; @@ -1284,6 +1287,7 @@ group { name: "efl/scroller:popup/no_inset_shadow"; } group { name: "efl/scroller/contents"; + data.item: "version" "123"; parts { part { name: "efl.content"; required; type: SWALLOW; diff --git a/data/elementary/themes/edc/efl/slider.edc b/data/elementary/themes/edc/efl/slider.edc index 095e3aca33..d29fd6359b 100644 --- a/data/elementary/themes/edc/efl/slider.edc +++ b/data/elementary/themes/edc/efl/slider.edc @@ -1,4 +1,5 @@ group { "efl/slider/horizontal"; + data.item: "version" "123"; alias: "efl/slider/horizontal:disabled"; images.image: "slider_run_base_horiz.png" COMP; images.image: "slider_run_bevel_horiz.png" COMP; @@ -235,6 +236,7 @@ group { "efl/slider/horizontal"; } group { "efl/slider/vertical"; + data.item: "version" "123"; alias: "efl/slider/vertical:disabled"; images.image: "slider_run_base_vert.png" COMP; images.image: "slider_run_bevel_vert.png" COMP; @@ -473,6 +475,7 @@ group { "efl/slider/vertical"; //Range group { "efl/slider_interval/horizontal"; + data.item: "version" "123"; alias: "efl/slider/horizontal:disabled"; images.image: "slider_run_base_horiz.png" COMP; images.image: "slider_run_bevel_horiz.png" COMP; @@ -755,6 +758,7 @@ group { "efl/slider_interval/horizontal"; } group { "efl/slider_interval/vertical"; + data.item: "version" "123"; alias: "efl/slider/vertical:disabled"; images.image: "slider_run_base_vert.png" COMP; images.image: "slider_run_bevel_vert.png" COMP; diff --git a/data/elementary/themes/edc/efl/spin.edc b/data/elementary/themes/edc/efl/spin.edc index d16d15e8ce..131548fb01 100644 --- a/data/elementary/themes/edc/efl/spin.edc +++ b/data/elementary/themes/edc/efl/spin.edc @@ -1,4 +1,5 @@ group { "efl/spin"; + data.item: "version" "123"; parts { rect { "bg"; scale; diff --git a/data/elementary/themes/edc/efl/spin_button.edc b/data/elementary/themes/edc/efl/spin_button.edc index 070144de28..d0b4d52c8f 100644 --- a/data/elementary/themes/edc/efl/spin_button.edc +++ b/data/elementary/themes/edc/efl/spin_button.edc @@ -1,4 +1,5 @@ group { "efl/spin_button/horizontal"; + data.item: "version" "123"; images.image: "vert_bar_inset.png" COMP; parts { rect { "clip"; @@ -152,6 +153,7 @@ group { "efl/spin_button/horizontal"; group { "efl/spin_button/vertical"; inherit: "efl/spin_button/horizontal"; + data.item: "version" "123"; parts { image { "inset"; nomouse; desc { "default"; @@ -203,6 +205,7 @@ group { "efl/spin_button/vertical"; } group { "efl/spin_button/horizontal/inc_button"; + data.item: "version" "123"; images.image: "sym_right_light_normal.png" COMP; images.image: "sym_right_glow_normal.png" COMP; images.image: "sym_right_dark_normal.png" COMP; @@ -355,10 +358,12 @@ group { "efl/spin_button/horizontal/inc_button"; group { "efl/spin_button/horizontal/entry"; alias: "efl/spin_button/vertical/entry"; inherit: "efl/text"; + data.item: "version" "123"; } group { "efl/spin_button/horizontal/dec_button"; inherit: "efl/spin_button/horizontal/inc_button"; + data.item: "version" "123"; images.image: "sym_left_light_normal.png" COMP; images.image: "sym_left_glow_normal.png" COMP; images.image: "sym_left_dark_normal.png" COMP; @@ -384,6 +389,7 @@ group { "efl/spin_button/horizontal/dec_button"; group { "efl/spin_button/horizontal/text_button"; alias: "efl/spin_button/vertical/text_button"; + data.item: "version" "123"; parts { part { name: "bg"; type: SPACER; @@ -461,6 +467,7 @@ group { "efl/spin_button/horizontal/text_button"; group { "efl/spin_button/vertical/inc_button"; inherit: "efl/spin_button/horizontal/inc_button"; + data.item: "version" "123"; images.image: "sym_up_light_normal.png" COMP; images.image: "sym_up_glow_normal.png" COMP; images.image: "sym_up_dark_normal.png" COMP; @@ -486,6 +493,7 @@ group { "efl/spin_button/vertical/inc_button"; group { "efl/spin_button/vertical/dec_button"; inherit: "efl/spin_button/horizontal/dec_button"; + data.item: "version" "123"; images.image: "sym_down_light_normal.png" COMP; images.image: "sym_down_glow_normal.png" COMP; images.image: "sym_down_dark_normal.png" COMP; diff --git a/data/elementary/themes/edc/efl/tab_bar.edc b/data/elementary/themes/edc/efl/tab_bar.edc index d48ed8589f..4fc3c8d75e 100644 --- a/data/elementary/themes/edc/efl/tab_bar.edc +++ b/data/elementary/themes/edc/efl/tab_bar.edc @@ -1,4 +1,5 @@ group { "efl/tab_bar"; + data.item: "version" "123"; images.image: "vgrad_med_lighter.png" COMP; images.image: "bevel_out.png" COMP; images.image: "shine.png" COMP; @@ -60,6 +61,7 @@ group { "efl/tab_bar"; } group { "efl/tab_bar/tab"; + data.item: "version" "123"; images.image: "shadow_inset_bevels.png" COMP; images.image: "shadow_angled_in_sides.png" COMP; images.image: "horizontal_separated_bar_small_glow.png" COMP; diff --git a/data/elementary/themes/edc/efl/tab_page.edc b/data/elementary/themes/edc/efl/tab_page.edc index 68bbd6b55c..84a84d7b79 100644 --- a/data/elementary/themes/edc/efl/tab_page.edc +++ b/data/elementary/themes/edc/efl/tab_page.edc @@ -1,4 +1,5 @@ group { "efl/tab_page"; + data.item: "version" "123"; parts { spacer { "base"; scale; diff --git a/data/elementary/themes/edc/efl/tab_pager.edc b/data/elementary/themes/edc/efl/tab_pager.edc index 11ea591441..19ff8becf0 100644 --- a/data/elementary/themes/edc/efl/tab_pager.edc +++ b/data/elementary/themes/edc/efl/tab_pager.edc @@ -1,4 +1,5 @@ group { "efl/tab_pager"; + data.item: "version" "123"; parts { spacer { "base"; scale; diff --git a/data/elementary/themes/edc/efl/tags.edc b/data/elementary/themes/edc/efl/tags.edc index 9c9b7352d8..415bc7ab3b 100644 --- a/data/elementary/themes/edc/efl/tags.edc +++ b/data/elementary/themes/edc/efl/tags.edc @@ -1,4 +1,5 @@ group { "efl/tags"; + data.item: "version" "123"; data.item: "horizontal_pad" 0; data.item: "vertical_pad" 0; data.item: "closed_height" 0; @@ -24,6 +25,7 @@ group { "efl/tags"; } group { "efl/tags/label"; + data.item: "version" "123"; parts { text { "efl.text"; nomouse; @@ -46,6 +48,7 @@ group { "efl/tags/label"; } group { "efl/tags/btn"; + data.item: "version" "123"; images.image: "button_normal.png" COMP; images.image: "button_clicked.png" COMP; images.image: "sym_close_dark_normal.png" COMP; @@ -289,6 +292,7 @@ group { "efl/tags/btn"; } group { "efl/tags/number"; + data.item: "version" "123"; parts { text { "efl.text"; nomouse; diff --git a/data/elementary/themes/edc/efl/text.edc b/data/elementary/themes/edc/efl/text.edc index 7f905a0a77..3bbba5645e 100644 --- a/data/elementary/themes/edc/efl/text.edc +++ b/data/elementary/themes/edc/efl/text.edc @@ -1,6 +1,7 @@ group { "efl/text/scroller"; inherit: "efl/scroller"; + data.item: "version" "123"; image: "bg_glow_in.png" COMP; parts { part { name: "efl.background"; type: SWALLOW; @@ -157,6 +158,7 @@ group { "efl/text/scroller"; } group { "efl/text/single/scroller"; + data.item: "version" "123"; images.image: "bevel_in.png" COMP; images.image: "inset_shadow.png" COMP; image: "bg_glow_in.png" COMP; @@ -389,6 +391,7 @@ group { "efl/text/single/scroller"; } group { "efl/text/cursor"; + data.item: "version" "123"; min: 1 0; images.image: "white_bar_vert_glow.png" COMP; parts { @@ -491,6 +494,7 @@ group { "efl/text/cursor"; } group { "efl/text/selection"; + data.item: "version" "123"; parts { part { name: "base"; type: RECT; description { state: "default" 0.0; @@ -501,6 +505,7 @@ group { "efl/text/selection"; } group { "efl/text/anchor"; + data.item: "version" "123"; images.image: "horizontal_separated_bar_small_glow.png" COMP; parts { part { name: "bar"; @@ -518,6 +523,7 @@ group { "efl/text/anchor"; } group { "efl/text"; + data.item: "version" "123"; data { item: "font.name" "Sans"; item: "font.size" "10"; @@ -637,6 +643,7 @@ group { "efl/text"; } group { "efl/text/magnifier"; + data.item: "version" "123"; images.image: "frame_rounded.png" COMP; parts { part { name: "bg"; type: RECT; mouse_events: 0; @@ -699,6 +706,7 @@ group { "efl/text/magnifier"; } group { "efl/text/handler/start"; + data.item: "version" "123"; images.image: "handle_pick_up_left.png" COMP; parts { part { name: "base"; mouse_events: 0; @@ -747,6 +755,7 @@ group { "efl/text/handler/start"; } group { "efl/text/handler/end"; + data.item: "version" "123"; images.image: "handle_pick_up_right.png" COMP; parts { part { name: "base"; mouse_events: 0; @@ -800,124 +809,124 @@ group { "efl/text/handler/end"; // Tanya - Latvia // http://lazycrazy.deviantart.com/ // http://lazycrazy.deviantart.com/art/Very-Emotional-Emoticons-144461621 -group { "efl/text/emoticon/angry"; images.image: +group { "efl/text/emoticon/angry"; data.item: "version" "123"; images.image: "emo-angry.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-angry.png"; } } } } -group { "efl/text/emoticon/angry-shout"; images.image: +group { "efl/text/emoticon/angry-shout"; data.item: "version" "123"; images.image: "emo-angry-shout.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-angry-shout.png"; } } } } -group { "efl/text/emoticon/crazy-laugh"; images.image: +group { "efl/text/emoticon/crazy-laugh"; data.item: "version" "123"; images.image: "emo-crazy-laugh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-crazy-laugh.png"; } } } } -group { "efl/text/emoticon/evil-laugh"; images.image: +group { "efl/text/emoticon/evil-laugh"; data.item: "version" "123"; images.image: "emo-evil-laugh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-evil-laugh.png"; } } } } -group { "efl/text/emoticon/evil"; images.image: +group { "efl/text/emoticon/evil"; data.item: "version" "123"; images.image: "emo-evil.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-evil.png"; } } } } -group { "efl/text/emoticon/goggle-smile"; images.image: +group { "efl/text/emoticon/goggle-smile"; data.item: "version" "123"; images.image: "emo-goggle-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-goggle-smile.png"; } } } } -group { "efl/text/emoticon/grumpy"; images.image: +group { "efl/text/emoticon/grumpy"; data.item: "version" "123"; images.image: "emo-grumpy.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-grumpy.png"; } } } } -group { "efl/text/emoticon/grumpy-smile"; images.image: +group { "efl/text/emoticon/grumpy-smile"; data.item: "version" "123"; images.image: "emo-grumpy-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-grumpy-smile.png"; } } } } -group { "efl/text/emoticon/guilty"; images.image: +group { "efl/text/emoticon/guilty"; data.item: "version" "123"; images.image: "emo-guilty.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-guilty.png"; } } } } -group { "efl/text/emoticon/guilty-smile"; images.image: +group { "efl/text/emoticon/guilty-smile"; data.item: "version" "123"; images.image: "emo-guilty-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-guilty-smile.png"; } } } } -group { "efl/text/emoticon/haha"; images.image: +group { "efl/text/emoticon/haha"; data.item: "version" "123"; images.image: "emo-haha.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-haha.png"; } } } } -group { "efl/text/emoticon/half-smile"; images.image: +group { "efl/text/emoticon/half-smile"; data.item: "version" "123"; images.image: "emo-half-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-half-smile.png"; } } } } -group { "efl/text/emoticon/happy-panting"; images.image: +group { "efl/text/emoticon/happy-panting"; data.item: "version" "123"; images.image: "emo-happy-panting.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-happy-panting.png"; } } } } -group { "efl/text/emoticon/happy"; images.image: +group { "efl/text/emoticon/happy"; data.item: "version" "123"; images.image: "emo-happy.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-happy.png"; } } } } -group { "efl/text/emoticon/indifferent"; images.image: +group { "efl/text/emoticon/indifferent"; data.item: "version" "123"; images.image: "emo-indifferent.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-indifferent.png"; } } } } -group { "efl/text/emoticon/kiss"; images.image: +group { "efl/text/emoticon/kiss"; data.item: "version" "123"; images.image: "emo-kiss.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-kiss.png"; } } } } -group { "efl/text/emoticon/knowing-grin"; images.image: +group { "efl/text/emoticon/knowing-grin"; data.item: "version" "123"; images.image: "emo-knowing-grin.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-knowing-grin.png"; } } } } -group { "efl/text/emoticon/laugh"; images.image: +group { "efl/text/emoticon/laugh"; data.item: "version" "123"; images.image: "emo-laugh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-laugh.png"; } } } } -group { "efl/text/emoticon/little-bit-sorry"; images.image: +group { "efl/text/emoticon/little-bit-sorry"; data.item: "version" "123"; images.image: "emo-little-bit-sorry.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-little-bit-sorry.png"; } } } } -group { "efl/text/emoticon/love-lots"; images.image: +group { "efl/text/emoticon/love-lots"; data.item: "version" "123"; images.image: "emo-love-lots.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-love-lots.png"; } } } } -group { "efl/text/emoticon/love"; images.image: +group { "efl/text/emoticon/love"; data.item: "version" "123"; images.image: "emo-love.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-love.png"; } } } } -group { "efl/text/emoticon/minimal-smile"; images.image: +group { "efl/text/emoticon/minimal-smile"; data.item: "version" "123"; images.image: "emo-minimal-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-minimal-smile.png"; } } } } -group { "efl/text/emoticon/not-happy"; images.image: +group { "efl/text/emoticon/not-happy"; data.item: "version" "123"; images.image: "emo-not-happy.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-not-happy.png"; } } } } -group { "efl/text/emoticon/not-impressed"; images.image: +group { "efl/text/emoticon/not-impressed"; data.item: "version" "123"; images.image: "emo-not-impressed.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-not-impressed.png"; } } } } -group { "efl/text/emoticon/omg"; images.image: +group { "efl/text/emoticon/omg"; data.item: "version" "123"; images.image: "emo-omg.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-omg.png"; } } } } -group { "efl/text/emoticon/opensmile"; images.image: +group { "efl/text/emoticon/opensmile"; data.item: "version" "123"; images.image: "emo-opensmile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-opensmile.png"; } } } } -group { "efl/text/emoticon/smile"; images.image: +group { "efl/text/emoticon/smile"; data.item: "version" "123"; images.image: "emo-smile.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-smile.png"; } } } } -group { "efl/text/emoticon/sorry"; images.image: +group { "efl/text/emoticon/sorry"; data.item: "version" "123"; images.image: "emo-sorry.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-sorry.png"; } } } } -group { "efl/text/emoticon/squint-laugh"; images.image: +group { "efl/text/emoticon/squint-laugh"; data.item: "version" "123"; images.image: "emo-squint-laugh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-squint-laugh.png"; } } } } -group { "efl/text/emoticon/surprised"; images.image: +group { "efl/text/emoticon/surprised"; data.item: "version" "123"; images.image: "emo-surprised.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-surprised.png"; } } } } -group { "efl/text/emoticon/suspicious"; images.image: +group { "efl/text/emoticon/suspicious"; data.item: "version" "123"; images.image: "emo-suspicious.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-suspicious.png"; } } } } -group { "efl/text/emoticon/tongue-dangling"; images.image: +group { "efl/text/emoticon/tongue-dangling"; data.item: "version" "123"; images.image: "emo-tongue-dangling.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-tongue-dangling.png"; } } } } -group { "efl/text/emoticon/tongue-poke"; images.image: +group { "efl/text/emoticon/tongue-poke"; data.item: "version" "123"; images.image: "emo-tongue-poke.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-tongue-poke.png"; } } } } -group { "efl/text/emoticon/uh"; images.image: +group { "efl/text/emoticon/uh"; data.item: "version" "123"; images.image: "emo-uh.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-uh.png"; } } } } -group { "efl/text/emoticon/unhappy"; images.image: +group { "efl/text/emoticon/unhappy"; data.item: "version" "123"; images.image: "emo-unhappy.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-unhappy.png"; } } } } -group { "efl/text/emoticon/very-sorry"; images.image: +group { "efl/text/emoticon/very-sorry"; data.item: "version" "123"; images.image: "emo-very-sorry.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-very-sorry.png"; } } } } -group { "efl/text/emoticon/what"; images.image: +group { "efl/text/emoticon/what"; data.item: "version" "123"; images.image: "emo-what.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-what.png"; } } } } -group { "efl/text/emoticon/wink"; images.image: +group { "efl/text/emoticon/wink"; data.item: "version" "123"; images.image: "emo-wink.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-wink.png"; } } } } -group { "efl/text/emoticon/worried"; images.image: +group { "efl/text/emoticon/worried"; data.item: "version" "123"; images.image: "emo-worried.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-worried.png"; } } } } -group { "efl/text/emoticon/wtf"; images.image: +group { "efl/text/emoticon/wtf"; data.item: "version" "123"; images.image: "emo-wtf.png" COMP; parts { part { "icon"; nomouse; desc { "default"; max: 64 64; image.normal: "emo-wtf.png"; } } } } //------------------------------------------------------------ diff --git a/data/elementary/themes/edc/efl/textpath.edc b/data/elementary/themes/edc/efl/textpath.edc index 3f880c11a5..76b06c9fca 100644 --- a/data/elementary/themes/edc/efl/textpath.edc +++ b/data/elementary/themes/edc/efl/textpath.edc @@ -1,4 +1,5 @@ group { name: "efl/textpath"; + data.item: "version" "123"; styles { style { name: "textpath_style2"; base: "font="FN" font_size=16 text_class=tb_plain wrap=none align=left color=#ffffffff style=shadow,bottom shadow_color=#00000080"; diff --git a/data/elementary/themes/edc/efl/timepicker.edc b/data/elementary/themes/edc/efl/timepicker.edc index 050a470068..79f9d044e3 100644 --- a/data/elementary/themes/edc/efl/timepicker.edc +++ b/data/elementary/themes/edc/efl/timepicker.edc @@ -1,4 +1,5 @@ group { "efl/timepicker"; + data.item: "version" "123"; nomouse; parts { spacer { "base"; @@ -379,6 +380,7 @@ group { "efl/timepicker"; group { "efl/timepicker/button"; inherit: "efl/button"; + data.item: "version" "123"; parts { image { "base"; desc { "default"; diff --git a/data/elementary/themes/edc/efl/uiclock.edc b/data/elementary/themes/edc/efl/uiclock.edc index ce448b37ea..21fad3b2bf 100644 --- a/data/elementary/themes/edc/efl/uiclock.edc +++ b/data/elementary/themes/edc/efl/uiclock.edc @@ -103,6 +103,7 @@ } group { "efl/uiclock"; + data.item: "version" "123"; parts { rect { "bg"; desc { "default"; @@ -213,15 +214,18 @@ group { "efl/uiclock"; // AM_PM_BUTTON group { "efl/uiclock/ampm" + data.item: "version" "123"; inherit: "efl/button"; } //ENTRY group { "efl/uiclock/text" + data.item: "version" "123"; inherit: "efl/text"; alias: "efl/uiclock/text/single"; alias: "efl/uiclock/text/single-noedit"; } group { "efl/uiclock/text/selection" + data.item: "version" "123"; inherit: "efl/text/selection"; } diff --git a/data/elementary/themes/edc/efl/video.edc b/data/elementary/themes/edc/efl/video.edc index e6de3dd88e..54b228c194 100644 --- a/data/elementary/themes/edc/efl/video.edc +++ b/data/elementary/themes/edc/efl/video.edc @@ -1,4 +1,5 @@ group { name: "efl/video"; + data.item: "version" "123"; parts { part { name: "clipper"; type: RECT; description { state: "default" 0.0; diff --git a/data/elementary/themes/edc/efl/win.edc b/data/elementary/themes/edc/efl/win.edc index b0223d4ebc..081efae5d1 100644 --- a/data/elementary/themes/edc/efl/win.edc +++ b/data/elementary/themes/edc/efl/win.edc @@ -1,5 +1,5 @@ group { "efl/win"; - data.item: "version" "119"; + data.item: "version" "123"; parts { rect { "client_clip"; nomouse; } swallow { "efl.menu"; From 1511430c29b7d2099f9dd4c7237a0dd912e4479e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 16:59:39 -0400 Subject: [PATCH 042/115] efl_ui/layout: validate theme api version in theme_apply Summary: this throws error and warning messages if the theme api version does not match the current efl version, and it will cause unit tests to fail when the theme version is not updated ref T8231 Depends on D10093 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl_widgets Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10081 --- src/lib/elementary/efl_ui_layout.c | 40 ++++++++++++++++++++++++-- src/lib/elementary/elm_widget_layout.h | 1 + 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 1ebee5778e..8935e017d0 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -492,12 +492,13 @@ _efl_ui_layout_base_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Layout_Data *_pd } static Eina_Error -_efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd) +_efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd, Elm_Widget_Smart_Data **widget_data) { Eina_Error ret = EFL_UI_THEME_APPLY_ERROR_GENERIC; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_ERROR_GENERIC); + *widget_data = wd; /* function already prints error messages, if any */ if (!sd->file_set) { @@ -521,11 +522,14 @@ EOLIAN static Eina_Error _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) { Eina_Error theme_apply_ret, theme_apply_internal_ret; + Elm_Widget_Smart_Data *wd; + char buf[64]; + static unsigned int version = 0; theme_apply_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); if (theme_apply_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return EFL_UI_THEME_APPLY_ERROR_GENERIC; - theme_apply_internal_ret = _efl_ui_layout_theme_internal(obj, sd); + theme_apply_internal_ret = _efl_ui_layout_theme_internal(obj, sd, &wd); if (theme_apply_internal_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return EFL_UI_THEME_APPLY_ERROR_GENERIC; @@ -537,6 +541,38 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(0, 0)); if (elm_widget_is_legacy(obj)) efl_gfx_hint_size_min_set(obj, EINA_SIZE2D(0, 0)); + else + { + const char *version = edje_object_data_get(wd->resize_obj, "version"); + if (!version) + ERR("Widget(%p) with type '%s' is not providing a version in its theme!", obj, + efl_class_name_get(efl_class_get(obj))); + errno = 0; + sd->version = strtoul(version, NULL, 10); + if (errno) + { + ERR("Widget(%p) with type '%s' is not providing a valid version in its theme!", obj, + efl_class_name_get(efl_class_get(obj))); + sd->version = 0; + } + } + if (!version) + { + snprintf(buf, sizeof(buf), "%d%d", EFL_VERSION_MAJOR, EFL_VERSION_MINOR); + errno = 0; + version = strtoul(buf, NULL, 10); + if (errno) + { + ERR("something broke in theme parsing, this system is probably busted"); + version = 0; + } + } + if (version && (!_running_in_tree)) + { + if (sd->version < version) + WRN("Widget(%p) with type '%s' is providing a potentially old version in its theme: found %u, should be %u", obj, + efl_class_name_get(efl_class_get(obj)), sd->version, version); + } return EFL_UI_THEME_APPLY_ERROR_NONE; } diff --git a/src/lib/elementary/elm_widget_layout.h b/src/lib/elementary/elm_widget_layout.h index 0997ccbb0d..5e411eb4c5 100644 --- a/src/lib/elementary/elm_widget_layout.h +++ b/src/lib/elementary/elm_widget_layout.h @@ -63,6 +63,7 @@ typedef struct _Efl_Ui_Layout_Data } connect; unsigned int finger_size_multiplier_x, finger_size_multiplier_y; /**< multipliers for finger_size during group_calc */ + unsigned int version; /**< version number specified in the widget's theme */ Eina_Bool frozen; /**< Layout freeze state */ Eina_Bool can_access : 1; /**< This is true when all text(including textblock) parts can be accessible by accessibility. */ From d13bd5fa8e7e6ee844a931424c4db42fa2c9d2c6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 16:59:44 -0400 Subject: [PATCH 043/115] efl_ui/alert_popup: use normal C-based part aliasing and remove theme alias Summary: part aliasing should be done at the layout level, not using bespoke string comparisons. also this removes the "title" part of the alert_popup theme which was previously considered api Depends on D10091 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10092 --- data/elementary/themes/edc/efl/popup.edc | 1 - src/lib/elementary/efl_ui_alert_popup.c | 27 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc index 176e7b8b20..22f1a94507 100644 --- a/data/elementary/themes/edc/efl/popup.edc +++ b/data/elementary/themes/edc/efl/popup.edc @@ -32,7 +32,6 @@ group { "efl/popup"; group { "efl/alert_popup"; data.item: "version" "123"; images.image: "rounded_square.png" COMP; parts { - alias: "title" "efl.text.title"; image { "bg"; desc { "default"; min: 100 100; diff --git a/src/lib/elementary/efl_ui_alert_popup.c b/src/lib/elementary/efl_ui_alert_popup.c index 0edfff363d..9acc174c3a 100644 --- a/src/lib/elementary/efl_ui_alert_popup.c +++ b/src/lib/elementary/efl_ui_alert_popup.c @@ -25,15 +25,24 @@ static const char BUTTON_SWALLOW_NAME[EFL_UI_ALERT_POPUP_BUTTON_COUNT][20] = "efl.button2", "efl.button3"}; +static const Elm_Layout_Part_Alias_Description _text_aliases[] = +{ + {"title", "efl.text.title"}, + {NULL, NULL} +}; + static Eina_Bool _efl_ui_alert_popup_text_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, const char *part, const char *label) { - if (eina_streq(part, "title") || eina_streq(part, "efl.text.title")) + if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) + return EINA_FALSE; + efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); + if (eina_streq(part, "efl.text.title")) { Eina_Bool changed = eina_stringshare_replace(&pd->title_text, label); if (changed) { - efl_text_set(efl_part(efl_super(obj, MY_CLASS), "title"), label); + efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); if (label) elm_layout_signal_emit(obj, "efl,title,show", "efl"); else @@ -44,8 +53,6 @@ _efl_ui_alert_popup_text_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, const char *p efl_canvas_group_change(obj); } } - else - efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); return EINA_TRUE; } @@ -53,7 +60,9 @@ _efl_ui_alert_popup_text_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, const char *p const char * _efl_ui_alert_popup_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Alert_Popup_Data *pd, const char *part) { - if (eina_streq(part, "title") || eina_streq(part, "efl.text.title")) + if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) + return EINA_FALSE; + if (eina_streq(part, "efl.text.title")) { if (pd->title_text) return pd->title_text; @@ -248,9 +257,10 @@ _efl_ui_alert_popup_efl_object_destructor(Eo *obj, Efl_Ui_Alert_Popup_Data *pd) } static Eina_Bool -_part_is_efl_ui_alert_popup_part(const Eo *obj EINA_UNUSED, const char *part) +_part_is_efl_ui_alert_popup_part(const Eo *obj, const char *part) { - return (eina_streq(part, "title") || eina_streq(part, "efl.text.title")); + if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) return EINA_FALSE; + return eina_streq(part, "efl.text.title"); } /* Efl.Part begin */ @@ -261,5 +271,8 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_alert_popup, EFL_UI_ALERT_POPUP, Efl_Ui_Alert_ #include "efl_ui_alert_popup_part.eo.c" /* Efl.Part end */ +EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(efl_ui_alert_popup) +#define EFL_UI_ALERT_POPUP_EXTRA_OPS \ + EFL_UI_LAYOUT_TEXT_ALIASES_OPS(efl_ui_alert_popup) #include "efl_ui_alert_popup.eo.c" From e94686b27655bd12496160c2d82c0308bc74c4b2 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 16:59:49 -0400 Subject: [PATCH 044/115] elm: rename _use_build_config variable -> _running_in_tree Summary: this makes the meaning of the variable more clear no functional changes Depends on D10092 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10093 --- src/lib/elementary/elm_config.c | 20 ++++++++++---------- src/lib/elementary/elm_main.c | 6 +++--- src/lib/elementary/elm_priv.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c index bbc6b9f668..fc9b0d54b9 100644 --- a/src/lib/elementary/elm_config.c +++ b/src/lib/elementary/elm_config.c @@ -994,7 +994,7 @@ _elm_config_profile_dir_get(const char *prof, if (!is_user) goto not_user; - if ((!_use_build_config) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) + if ((!_running_in_tree) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof); // See elm_config_profile_dir_free: always use strdup+free @@ -1004,7 +1004,7 @@ _elm_config_profile_dir_get(const char *prof, return NULL; not_user: - if ((!_use_build_config) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) + if ((!_running_in_tree) || (!bs_data_path_get(buf, sizeof(buf), "elementary/config", prof))) snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof); // See elm_config_profile_dir_free: always use strdup+free @@ -1389,7 +1389,7 @@ _elm_config_profiles_list(Eina_Bool hide_profiles) const char *dir; size_t len = 0; - if (_use_build_config) + if (_running_in_tree) { len = bs_data_path_get(buf, sizeof(buf), "elementary", "config"); if (len) len = strlen(buf); @@ -1477,7 +1477,7 @@ _profile_fetch_from_conf(void) Eet_File *ef = NULL; int len = 0, i; - if (_use_build_config) goto end; + if (_running_in_tree) goto end; // if env var - use profile without question s = _getenv_once("ELM_PROFILE"); if (s) @@ -1769,7 +1769,7 @@ _config_load(void) efl_provider_register(efl_main_loop_get(), EFL_CONFIG_INTERFACE, _efl_config_obj); efl_provider_register(efl_main_loop_get(), EFL_CONFIG_GLOBAL_CLASS, _efl_config_obj); efl_del_intercept_set(_efl_config_obj, _efl_config_obj_del); - if (!_use_build_config) + if (!_running_in_tree) { _elm_config = _config_user_load(); if (_elm_config) @@ -2127,7 +2127,7 @@ _elm_config_profile_save(const char *profile) Eet_File *ef; size_t len; - if (_use_build_config || ((s = _getenv_once("ELM_PROFILE_NOSAVE")) && atoi(s))) + if (_running_in_tree || ((s = _getenv_once("ELM_PROFILE_NOSAVE")) && atoi(s))) return EINA_TRUE; len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/profile.cfg"); @@ -3083,7 +3083,7 @@ elm_config_profile_exists(const char *profile) if (!profile) return EINA_FALSE; - if (_use_build_config) + if (_running_in_tree) { if (!bs_data_path_get(buf, sizeof(buf), "elementary/config", profile)) return EINA_FALSE; return ecore_file_exists(buf); @@ -4193,7 +4193,7 @@ elm_config_all_flush(void) int ok = 0; size_t len; - if (_use_build_config) return; + if (_running_in_tree) return; len = _elm_config_user_dir_snprintf(buf, sizeof(buf), "themes/"); if (len + 1 >= sizeof(buf)) return; @@ -4300,7 +4300,7 @@ _elm_config_sub_shutdown(void) ELM_SAFE_FREE(_monitor_file_created_handler, ecore_event_handler_del); ELM_SAFE_FREE(_monitor_file_modified_handler, ecore_event_handler_del); ELM_SAFE_FREE(_monitor_directory_created_handler, ecore_event_handler_del); - _use_build_config = EINA_FALSE; + _running_in_tree = EINA_FALSE; } static Eina_Bool @@ -4392,7 +4392,7 @@ _elm_config_sub_init(void) char buf[PATH_MAX]; int ok = 0; - if (_use_build_config) + if (_running_in_tree) ok = bs_data_path_get(buf, sizeof(buf), "elementary", "config"); else { diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 95a81df58f..cd9803a518 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -41,7 +41,7 @@ # define LIBEXT ".so" #endif -Eina_Bool _use_build_config; +Eina_Bool _running_in_tree; static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV }; EAPI Elm_Version *elm_version = &_version; @@ -786,7 +786,7 @@ elm_quicklaunch_init(int argc EINA_UNUSED, { _elm_ql_init_count++; if (_elm_ql_init_count > 1) return _elm_ql_init_count; - _use_build_config = !!getenv("EFL_RUN_IN_TREE"); + _running_in_tree = !!getenv("EFL_RUN_IN_TREE"); EINA_SAFETY_ON_FALSE_GOTO(eina_init(), fail_eina); _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE); EINA_SAFETY_ON_TRUE_GOTO(_elm_log_dom < 0, fail_eina_log); @@ -829,7 +829,7 @@ elm_quicklaunch_init(int argc EINA_UNUSED, LOCALE_DIR); if (pfx) { - if (_use_build_config) + if (_running_in_tree) _elm_data_dir = eina_stringshare_add(PACKAGE_BUILD_DIR "/data/elementary"); else _elm_data_dir = eina_stringshare_add(eina_prefix_data_get(pfx)); diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 3361fb23d0..8cb7ee5c64 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -919,7 +919,7 @@ _elm_dgettext(const char *string) # endif -extern Eina_Bool _use_build_config; +extern Eina_Bool _running_in_tree; /* Used by the paste handler */ void _elm_entry_entry_paste(Evas_Object *obj, const char *entry); From 63358e42862ba6bfa168ce442fde87ec794becf4 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Tue, 24 Sep 2019 16:59:50 -0400 Subject: [PATCH 045/115] theme: add 'required' to efl/border parts Summary: ref T8231 Reviewers: zmike, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10094 --- data/elementary/themes/edc/efl/border.edc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/elementary/themes/edc/efl/border.edc b/data/elementary/themes/edc/efl/border.edc index 67bee1658d..12f52b73c2 100644 --- a/data/elementary/themes/edc/efl/border.edc +++ b/data/elementary/themes/edc/efl/border.edc @@ -130,7 +130,7 @@ group { "efl/border"; data.item: "version" "123"; rel.to: "efl.menu"; } } - swallow { "efl.menu"; + swallow { "efl.menu"; required; required: 1; // since 1.19 desc { "default"; rel.to: "indicator_spacer"; @@ -162,7 +162,7 @@ group { "efl/border"; data.item: "version" "123"; } /* application contents */ - swallow { "efl.client"; + swallow { "efl.client"; required; clip: "client_clip"; desc { "default"; rel.to: "client_spacer"; @@ -308,7 +308,7 @@ group { "efl/border"; data.item: "version" "123"; rel2.relative: 1.2 1.2; } } - swallow { "efl.icon"; nomouse; + swallow { "efl.icon"; nomouse; required; clip_to: "top_clip"; desc { "default"; rel1.to: "icon"; @@ -694,7 +694,7 @@ group { "efl/border"; data.item: "version" "123"; color: 0 0 0 0; } } - swallow { "efl.indicator"; + swallow { "efl.indicator"; required; clip: "bg_clip"; desc { "default"; rel.to: "top_clip"; From 3d9b2f66665783d653b2124aee749a9af767579c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 16:59:56 -0400 Subject: [PATCH 046/115] efl_ui/alert_popup: rename show/hide signals to visible,on/off Summary: this is consistent with the efl api ref T8231 Depends on D10081 Reviewers: segfaultxavi, cedric Reviewed By: cedric Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10095 --- data/elementary/themes/edc/efl/popup.edc | 10 ++++++++-- src/lib/elementary/efl_ui_alert_popup.c | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc index 22f1a94507..462fe29365 100644 --- a/data/elementary/themes/edc/efl/popup.edc +++ b/data/elementary/themes/edc/efl/popup.edc @@ -106,13 +106,19 @@ group { "efl/alert_popup"; data.item: "version" "123"; } programs { program { - signal: "efl,title,show"; source: "efl"; + signal: "efl,title,visible,on"; source: "efl"; action: STATE_SET "title_visible" 0.0; target: "title_bg"; target: "efl.text.title"; } program { - signal: "efl,buttons,show"; source: "efl"; + signal: "efl,title,visible,off"; source: "efl"; + action: STATE_SET "default" 0.0; + target: "title_bg"; + target: "efl.text.title"; + } + program { + signal: "efl,buttons,visible,on"; source: "efl"; action: STATE_SET "button_visible" 0.0; target: "efl.buttons"; } diff --git a/src/lib/elementary/efl_ui_alert_popup.c b/src/lib/elementary/efl_ui_alert_popup.c index 9acc174c3a..0c5fc1bbd9 100644 --- a/src/lib/elementary/efl_ui_alert_popup.c +++ b/src/lib/elementary/efl_ui_alert_popup.c @@ -44,9 +44,9 @@ _efl_ui_alert_popup_text_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, const char *p { efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label); if (label) - elm_layout_signal_emit(obj, "efl,title,show", "efl"); + elm_layout_signal_emit(obj, "efl,title,visible,on", "efl"); else - elm_layout_signal_emit(obj, "efl,title,hide", "efl"); + elm_layout_signal_emit(obj, "efl,title,visible,off", "efl"); ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); edje_object_message_signal_process(wd->resize_obj); @@ -225,7 +225,7 @@ _efl_ui_alert_popup_button_set(Eo *obj, Efl_Ui_Alert_Popup_Data *pd, Efl_Ui_Aler pd->button[EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE]); } - elm_layout_signal_emit(obj, "efl,buttons,show", "efl"); + elm_layout_signal_emit(obj, "efl,buttons,visible,on", "efl"); edje_object_message_signal_process(wd->resize_obj); } From 84f7998caec0ffdaed4aa34da81bd3115b5fcc02 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 17:02:34 -0400 Subject: [PATCH 047/115] efl_ui/scroller: rename bar visibility signals Summary: this is consistent with efl api 'visible' property ref T8231 Depends on D10095 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10096 --- data/elementary/themes/edc/efl/scroller.edc | 8 ++++---- src/lib/elementary/efl_ui_image_zoomable.c | 8 ++++---- src/lib/elementary/efl_ui_scroll_util.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data/elementary/themes/edc/efl/scroller.edc b/data/elementary/themes/edc/efl/scroller.edc index 256c9e5784..3517197d77 100644 --- a/data/elementary/themes/edc/efl/scroller.edc +++ b/data/elementary/themes/edc/efl/scroller.edc @@ -301,7 +301,7 @@ group { name: "efl/scroller"; } } program { - signal: "efl,action,show,vbar"; source: "efl"; + signal: "efl,vbar,visible,on"; source: "efl"; action: STATE_SET "default" 0.0; target: "sb_vbar"; target: "sb_vbar_show"; @@ -316,7 +316,7 @@ group { name: "efl/scroller"; target: "arrow2_vbar_indent"; } program { - signal: "efl,action,hide,vbar"; source: "efl"; + signal: "efl,vbar,visible,off"; source: "efl"; action: STATE_SET "hidden" 0.0; target: "sb_vbar"; target: "sb_vbar_show"; @@ -582,7 +582,7 @@ group { name: "efl/scroller"; } } program { - signal: "efl,action,show,hbar"; source: "efl"; + signal: "efl,hbar,visible,on"; source: "efl"; action: STATE_SET "default" 0.0; target: "sb_hbar"; target: "sb_hbar_show"; @@ -597,7 +597,7 @@ group { name: "efl/scroller"; target: "arrow2_hbar_indent"; } program { - signal: "efl,action,hide,hbar"; source: "efl"; + signal: "efl,hbar,visible,off"; source: "efl"; action: STATE_SET "hidden" 0.0; target: "sb_hbar"; target: "sb_hbar_show"; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 44836ab05b..49d3e0400a 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -1550,9 +1550,9 @@ _efl_ui_image_zoomable_bar_show_cb(void *data, const Efl_Event *event) else { if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,show,hbar", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,hbar,visible,on", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,show,vbar", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,vbar,visible,on", "efl"); } } @@ -1573,9 +1573,9 @@ _efl_ui_image_zoomable_bar_hide_cb(void *data, const Efl_Event *event) else { if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,hide,hbar", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,hbar,visible,off", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,action,hide,vbar", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,vbar,visible,off", "efl"); } } diff --git a/src/lib/elementary/efl_ui_scroll_util.c b/src/lib/elementary/efl_ui_scroll_util.c index cf23773536..019b68dbfb 100644 --- a/src/lib/elementary/efl_ui_scroll_util.c +++ b/src/lib/elementary/efl_ui_scroll_util.c @@ -227,9 +227,9 @@ _scroll_connector_bar_show_cb(void *data, const Efl_Event *event) Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - efl_layout_signal_emit(wd->resize_obj, "efl,action,show,hbar", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,hbar,visible,on", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - efl_layout_signal_emit(wd->resize_obj, "efl,action,show,vbar", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,vbar,visible,on", "efl"); } static void @@ -240,9 +240,9 @@ _scroll_connector_bar_hide_cb(void *data, const Efl_Event *event) Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,hbar", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,hbar,visible,off", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,vbar", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,vbar,visible,off", "efl"); } void From 9f7417dddea5263063cf0151694e0e2dbdd1017d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 17:02:40 -0400 Subject: [PATCH 048/115] efl_ui/focus: rename focus visibility signals Summary: this is consistent with efl api 'visible' property ref T8231 Depends on D10096 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10097 --- data/elementary/themes/edc/efl/focus.edc | 8 ++++---- src/lib/elementary/efl_ui_win.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/elementary/themes/edc/efl/focus.edc b/data/elementary/themes/edc/efl/focus.edc index 59ce554679..c56428f8db 100644 --- a/data/elementary/themes/edc/efl/focus.edc +++ b/data/elementary/themes/edc/efl/focus.edc @@ -118,7 +118,7 @@ group { name: "efl/focus_highlight/top"; data.item: "version" "123"; } programs { program { - signal: "efl,action,focus,show"; source: "efl"; + signal: "efl,focus,visible,on"; source: "efl"; action: ACTION_STOP; target: "pulse"; target: "pulse2"; @@ -132,17 +132,17 @@ group { name: "efl/focus_highlight/top"; data.item: "version" "123"; after: "go3"; } program { name: "go3"; - action: SIGNAL_EMIT "efl,action,focus,show,end" "efl"; + action: SIGNAL_EMIT "efl,focus,visible,on,done" "efl"; } program { - signal: "efl,action,focus,hide"; source: "efl"; + signal: "efl,focus,visible,off"; source: "efl"; action: STATE_SET "default" 0.0; transition: DECELERATE 0.4; target: "clip"; after: "stop2"; } program { name: "stop2"; - action: SIGNAL_EMIT "efl,action,focus,hide,end" "efl"; + action: SIGNAL_EMIT "efl,focus,visible,off,done" "efl"; after: "stop3"; } program { name: "stop3"; diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 679e4aca16..1dec90aa38 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -1160,14 +1160,14 @@ _elm_win_focus_highlight_visible_set(Efl_Ui_Win_Data *sd, if (elm_widget_is_legacy(sd->obj)) edje_object_signal_emit(fobj, "elm,action,focus,show", "elm"); else - edje_object_signal_emit(fobj, "efl,action,focus,show", "efl"); + edje_object_signal_emit(fobj, "efl,focus,visible,on", "efl"); } else { if (elm_widget_is_legacy(sd->obj)) edje_object_signal_emit(fobj, "elm,action,focus,hide", "elm"); else - edje_object_signal_emit(fobj, "efl,action,focus,hide", "efl"); + edje_object_signal_emit(fobj, "efl,focus,visible,off", "efl"); } } @@ -4074,7 +4074,7 @@ _elm_win_focus_highlight_init(Efl_Ui_Win_Data *sd) else { edje_object_signal_callback_add(sd->focus_highlight.fobj, - "efl,action,focus,hide,end", "*", + "efl,focus,visible,off,done", "*", _elm_win_focus_highlight_hide, NULL); edje_object_signal_callback_add(sd->focus_highlight.fobj, "efl,action,focus,anim,end", "*", From 25fddaa748c265b5b177966f0553b7f4a0d537bf Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 17:02:46 -0400 Subject: [PATCH 049/115] efl_ui/scroller: remove unused "looping" signals Summary: this feature is not implemented revert this patch to restore signal handling when the corresponding features are implemented by widgets ref T8231 Depends on D10097 Reviewers: cedric Reviewed By: cedric Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10098 --- data/elementary/themes/edc/efl/scroller.edc | 92 --------------------- 1 file changed, 92 deletions(-) diff --git a/data/elementary/themes/edc/efl/scroller.edc b/data/elementary/themes/edc/efl/scroller.edc index 3517197d77..8ab02628d8 100644 --- a/data/elementary/themes/edc/efl/scroller.edc +++ b/data/elementary/themes/edc/efl/scroller.edc @@ -378,20 +378,6 @@ group { name: "efl/scroller"; action_on_pos_vbar(10); } } - program { name: "loop_set_vbar"; - signal: "efl,loop_y,set"; source: "efl"; - script { - set_int(loop_y, 1); - action_on_pos_vbar(10); - } - } - program { name: "loop_unset_vbar"; - signal: "efl,loop_y,unset"; source: "efl"; - script { - set_int(loop_y, 0); - action_on_pos_vbar(10); - } - } // horiz bar ///////////////////////////////////////////////////////////// part { name: "sb_hbar_show"; type: RECT; @@ -659,20 +645,6 @@ group { name: "efl/scroller"; action_on_pos_hbar(10); } } - program { name: "loop_set_hbar"; - signal: "efl,loop_x,set"; source: "efl"; - script { - set_int(loop_x, 1); - action_on_pos_hbar(10); - } - } - program { name: "loop_unset_hbar"; - signal: "efl,loop_x,unset"; source: "efl"; - script { - set_int(loop_x, 0); - action_on_pos_hbar(10); - } - } part { name: "bg"; type: RECT; description { state: "default" 0.0; rel1.to: "efl.background"; @@ -1167,70 +1139,6 @@ group { name: "efl/scroller"; signal: "mouse,up,*"; source: "efl.dragable.hbar"; action: SIGNAL_EMIT "efl,hbar,unpress" "efl"; } - program { - signal: "efl,action,looping,left"; source: "efl"; - action: STATE_SET "effect" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - after: "looping,left,done"; - } - program { name: "looping,left,done"; - action: SIGNAL_EMIT "efl,looping,left,done" "efl"; - } - program { - signal: "efl,action,looping,left,end"; source: "efl"; - action: STATE_SET "default" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - } - program { - signal: "efl,action,looping,right"; source: "efl"; - action: STATE_SET "effect" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - after: "looping,right,done"; - } - program { name: "looping,right,done"; - action: SIGNAL_EMIT "efl,looping,right,done" "efl"; - } - program { - signal: "efl,action,looping,right,end"; source: "efl"; - action: STATE_SET "default" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - } - program { - signal: "efl,action,looping,up"; source: "efl"; - action: STATE_SET "effect" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - after: "looping,up,done"; - } - program { name: "looping,up,done"; - action: SIGNAL_EMIT "efl,looping,up,done" "efl"; - } - program { - signal: "efl,action,looping,up,end"; source: "efl"; - action: STATE_SET "default" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - } - program { - signal: "efl,action,looping,down"; source: "efl"; - action: STATE_SET "effect" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - after: "looping,down,done"; - } - program { name: "looping,down,done"; - action: SIGNAL_EMIT "efl,looping,down,done" "efl"; - } - program { - signal: "efl,action,looping,down,end"; source: "efl"; - action: STATE_SET "default" 0.0; - transition: LINEAR 0.3; - target: "dim_effect"; - } } } From cc88a1f875bd69bd9a976af3d15b798f84f5fcfb Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 17:02:52 -0400 Subject: [PATCH 050/115] efl_ui/timepicker: rename and namespace visibility signals Summary: this is consistent with efl api 'visible' property ref T8231 Depends on D10098 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10099 --- data/elementary/themes/edc/efl/timepicker.edc | 12 ++++++------ src/lib/elementary/efl_ui_timepicker.c | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/data/elementary/themes/edc/efl/timepicker.edc b/data/elementary/themes/edc/efl/timepicker.edc index 79f9d044e3..9560fd5264 100644 --- a/data/elementary/themes/edc/efl/timepicker.edc +++ b/data/elementary/themes/edc/efl/timepicker.edc @@ -322,7 +322,7 @@ group { "efl/timepicker"; } programs { program { "visible_ampm"; - signal: "efl,state,ampm,visible"; + signal: "efl,ampm,visible,on"; source: "efl"; script { set_state(PART:"base", "default", 0.0); @@ -331,7 +331,7 @@ group { "efl/timepicker"; } } program { "invisible_ampm"; - signal: "efl,state,ampm,invisible"; + signal: "efl,ampm,visible,off"; source: "efl"; script { set_state(PART:"base", "24layout", 0.0); @@ -340,7 +340,7 @@ group { "efl/timepicker"; } } program { "visible_colon_field0"; - signal: "efl,state,colon,visible,field0"; + signal: "efl,colon_field0,visible,on"; source: "efl"; action: STATE_SET "default"; target: "padding_center1"; @@ -349,7 +349,7 @@ group { "efl/timepicker"; target: "padding_center2"; } program { "invisible_colon_field0"; - signal: "efl,state,colon,invisible,field0"; + signal: "efl,colon_field0,visible,off"; source: "efl"; action: STATE_SET "invisible"; target: "padding_center1"; @@ -358,7 +358,7 @@ group { "efl/timepicker"; target: "padding_center2"; } program { "visible_colon_field1"; - signal: "efl,state,colon,visible,field1"; + signal: "efl,colon_field1,visible,on"; source: "efl"; action: STATE_SET "default"; target: "padding_center3"; @@ -367,7 +367,7 @@ group { "efl/timepicker"; target: "padding_center4"; } program { "invisible_colon_field1"; - signal: "efl,state,colon,invisible,field1"; + signal: "efl,colon_field1,visible,off"; source: "efl"; action: STATE_SET "invisible"; target: "padding_center3"; diff --git a/src/lib/elementary/efl_ui_timepicker.c b/src/lib/elementary/efl_ui_timepicker.c index 2fc578dd61..335e26230e 100644 --- a/src/lib/elementary/efl_ui_timepicker.c +++ b/src/lib/elementary/efl_ui_timepicker.c @@ -173,16 +173,16 @@ _fields_init(Eo *obj) //TODO: monitoring locale change and update field location. if (field == 0) { - elm_object_signal_emit(obj, "efl,state,colon,visible,field1", "efl"); - elm_object_signal_emit(obj, "efl,state,colon,invisible,field0", "efl"); + elm_object_signal_emit(obj, "efl,colon_field1,visible,on", "efl"); + elm_object_signal_emit(obj, "efl,colon_field0,visible,off", "efl"); } else { - elm_object_signal_emit(obj, "efl,state,colon,visible,field0", "efl"); - elm_object_signal_emit(obj, "efl,state,colon,invisible,field1", "efl"); + elm_object_signal_emit(obj, "efl,colon_field0,visible,on", "efl"); + elm_object_signal_emit(obj, "efl,colon_field1,visible,off", "efl"); } - elm_layout_signal_emit(obj, "efl,state,ampm,visible", "efl"); + elm_layout_signal_emit(obj, "efl,ampm,visible,on", "efl"); edje_object_message_signal_process(elm_layout_edje_get(obj)); efl_content_set(efl_part(obj, buf), pd->ampm); } @@ -251,9 +251,9 @@ _efl_ui_timepicker_is_24hour_set(Eo *obj, Efl_Ui_Timepicker_Data *pd, Eina_Bool pd->is_24hour = is_24hour; if (pd->is_24hour == EINA_TRUE) - elm_layout_signal_emit(obj, "efl,state,ampm,invisible", "efl"); + elm_layout_signal_emit(obj, "efl,ampm,visible,off", "efl"); else - elm_layout_signal_emit(obj, "efl,state,ampm,visible", "efl"); + elm_layout_signal_emit(obj, "efl,ampm,visible,on", "efl"); _field_value_update(obj); } From c99f7d06cb60a5fe2e3f14f541119ff5f1e3dc19 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 17:02:58 -0400 Subject: [PATCH 051/115] efl_ui/spin_button: fix signal namespacing Summary: efl,anim,activate is the signal used by buttons, which is what this is ref T8231 Depends on D10099 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10100 --- data/elementary/themes/edc/efl/spin_button.edc | 2 +- src/lib/elementary/efl_ui_spin_button.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/elementary/themes/edc/efl/spin_button.edc b/data/elementary/themes/edc/efl/spin_button.edc index d0b4d52c8f..91dff76c20 100644 --- a/data/elementary/themes/edc/efl/spin_button.edc +++ b/data/elementary/themes/edc/efl/spin_button.edc @@ -311,7 +311,7 @@ group { "efl/spin_button/horizontal/inc_button"; action: SIGNAL_EMIT "efl,action,click" ""; } program { name: "access_pressed"; - signal: "efl,action,anim,activate"; + signal: "efl,anim,activate"; source: "efl"; action: STATE_SET "pressed" 0.0; target: "arrow.image"; diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c index 627c6fdefa..a4c9122822 100644 --- a/src/lib/elementary/efl_ui_spin_button.c +++ b/src/lib/elementary/efl_ui_spin_button.c @@ -542,13 +542,13 @@ _access_increment_decrement_info_say(Evas_Object *obj, if (is_incremented) { elm_object_signal_emit - (sd->inc_button, "efl,action,anim,activate", "efl"); + (sd->inc_button, "efl,anim,activate", "efl"); eina_strbuf_append(buf, E_("incremented")); } else { elm_object_signal_emit - (sd->dec_button, "efl,action,anim,activate", "efl"); + (sd->dec_button, "efl,anim,activate", "efl"); eina_strbuf_append(buf, E_("decremented")); } From 5c2ea620a18cea0d02fe5ae3315913448828e77e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 09:39:21 -0400 Subject: [PATCH 052/115] efl/player: prune properties duplicated in efl.playable efl.playable implements a number of properties which are also present in efl.player. playable was intended to be separate, so enforce this split in all classes which use player ref T7877 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10109 --- src/bin/elementary/test_evas_snapshot.c | 2 +- src/bin/elementary/test_gfx_filters.c | 2 +- src/bin/elementary/test_photocam.c | 4 ++-- src/lib/edje/edje_smart.c | 2 +- src/lib/edje/efl_canvas_layout.eo | 4 ++-- src/lib/efl/interfaces/efl_player.eo | 24 ------------------- src/lib/elementary/efl_ui_image.c | 4 ++-- src/lib/elementary/efl_ui_image.eo | 4 ++-- src/lib/elementary/efl_ui_image_zoomable.c | 2 +- src/lib/elementary/efl_ui_image_zoomable.eo | 2 +- src/lib/elementary/efl_ui_video.c | 4 ++-- src/lib/emotion/efl_canvas_video.eo | 6 ++--- src/lib/emotion/emotion_smart.c | 8 +++---- .../evas/canvas/efl_canvas_animation_player.c | 12 +++++----- .../canvas/efl_canvas_animation_player.eo | 8 +++---- 15 files changed, 32 insertions(+), 56 deletions(-) diff --git a/src/bin/elementary/test_evas_snapshot.c b/src/bin/elementary/test_evas_snapshot.c index ea79aa85fe..ecfee1910a 100644 --- a/src/bin/elementary/test_evas_snapshot.c +++ b/src/bin/elementary/test_evas_snapshot.c @@ -46,7 +46,7 @@ _anim_toggle(void *data, const Efl_Event *ev EINA_UNUSED) it = efl_content_iterate(table); EINA_ITERATOR_FOREACH(it, o) { - if (efl_isa(o, EFL_PLAYER_INTERFACE) && efl_player_playable_get(o)) + if (efl_isa(o, EFL_PLAYER_INTERFACE) && efl_playable_get(o)) efl_player_play_set(o, !efl_player_play_get(o)); } eina_iterator_free(it); diff --git a/src/bin/elementary/test_gfx_filters.c b/src/bin/elementary/test_gfx_filters.c index 4fdee9dccb..e7410c861d 100644 --- a/src/bin/elementary/test_gfx_filters.c +++ b/src/bin/elementary/test_gfx_filters.c @@ -407,7 +407,7 @@ test_gfx_filters(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve efl_file_set(efl_added, buf), efl_name_set(efl_added, images[k].src_name), elm_object_tooltip_text_set(efl_added, images[k].src_name)); - if (efl_player_playable_get(o)) + if (efl_playable_get(o)) efl_player_play_set(o, 1); efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _img_click, win); efl_pack(box2, o); diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c index 6f50740386..70d6da2bcc 100644 --- a/src/bin/elementary/test_photocam.c +++ b/src/bin/elementary/test_photocam.c @@ -152,7 +152,7 @@ my_bt_open(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) } if (file && eina_str_has_extension(file, ".gif") - && efl_player_playable_get(ph)) + && efl_playable_get(ph)) efl_player_play_set(ph, EINA_TRUE); } @@ -829,7 +829,7 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _zoomable_clicked_cb, NULL) ); - if (efl_player_playable_get(zoomable)) + if (efl_playable_get(zoomable)) { printf("animation is available for this image.\n"); efl_player_play_set(zoomable, EINA_TRUE); diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 4801432ebc..7acf644145 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -538,7 +538,7 @@ _efl_canvas_layout_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object } EOLIAN Eina_Bool -_efl_canvas_layout_efl_player_playable_get(const Eo *obj EINA_UNUSED, Edje *pd EINA_UNUSED) +_efl_canvas_layout_efl_playable_playable_get(const Eo *obj EINA_UNUSED, Edje *pd EINA_UNUSED) { return EINA_TRUE; } diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo index 63fbc4c562..0f7a185d27 100644 --- a/src/lib/edje/efl_canvas_layout.eo +++ b/src/lib/edje/efl_canvas_layout.eo @@ -3,7 +3,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl.Container, Efl.Part, Efl.Observer, Efl.Ui.I18n, Efl.Layout.Calc, Efl.Layout.Signal, Efl.Layout.Group, - Efl.Player, Efl.Gfx.Color_Class, Efl.Gfx.Text_Class, + Efl.Player, Efl.Playable, Efl.Gfx.Color_Class, Efl.Gfx.Text_Class, Efl.Gfx.Size_Class { [[Edje object class]] @@ -126,7 +126,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl. Efl.Container.content_count; Efl.Part.part_get; [[Returns @Efl.Canvas.Layout_Part]] Efl.Observer.update; - Efl.Player.playable { get; } + Efl.Playable.playable { get; } Efl.Player.play { get; set; } Efl.Player.play_speed { get; set; } } diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 1aecb53015..3ff0649732 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -9,14 +9,6 @@ interface @beta Efl.Player stop { [[Stop playable object.]] } - @property playable { - [[Whether or not the playable can be played.]] - get { - } - values { - play: bool; [[$true if the object have playable data, $false otherwise]] - } - } @property play { [[Playback state of the media file. @@ -75,21 +67,5 @@ interface @beta Efl.Player speed: double; [[The play speed in the [0, infinity) range.]] } } - @property length { - [[Get the length of play for the media file.]] - get { - } - values { - length: double; [[The length of the stream in seconds.]] - } - } - @property seekable { - [[Get whether the media file is seekable.]] - get { - } - values { - seekable: bool; [[$true if seekable.]] - } - } } } diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 9cde2f803b..bbeffb2228 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -1716,11 +1716,11 @@ _efl_ui_image_efl_ui_draggable_drag_target_get(const Eo *obj EINA_UNUSED, Efl_Ui EAPI Eina_Bool elm_image_animated_available_get(const Evas_Object *obj) { - return efl_player_playable_get(obj); + return efl_playable_get(obj); } EOLIAN static Eina_Bool -_efl_ui_image_efl_player_playable_get(const Eo *obj, Efl_Ui_Image_Data *sd) +_efl_ui_image_efl_playable_playable_get(const Eo *obj, Efl_Ui_Image_Data *sd) { if (sd->edje) return EINA_TRUE; diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 080c0ce94d..21035452a7 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -17,7 +17,7 @@ struct @beta Efl.Ui.Image_Error } class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui.Draggable, - Efl.File, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller, Efl.Player, Efl.Gfx.View, + Efl.File, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller, Efl.Player, Efl.Playable, Efl.Gfx.View, Efl.Access.Component, Efl.Access.Widget.Action, Efl.Gfx.Color, Efl.Gfx.Image_Orientable, Efl.Layout.Calc, Efl.Layout.Group, Efl.Layout.Signal, @@ -97,7 +97,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. Efl.Gfx.Image.scale_hint { get; set; } Efl.Gfx.Image.content_hint { get; set; } Efl.Gfx.Image.image_load_error { get; } - Efl.Player.playable { get; } + Efl.Playable.playable { get; } Efl.Player.play { get; set; } Efl.Layout.Signal.signal_emit; Efl.Layout.Signal.message_send; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 49d3e0400a..0549a67190 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -3003,7 +3003,7 @@ _efl_ui_image_zoomable_gesture_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Ima } EOLIAN static Eina_Bool -_efl_ui_image_zoomable_efl_player_playable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +_efl_ui_image_zoomable_efl_playable_playable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) { if (sd->edje) return EINA_TRUE; return evas_object_image_animated_get(sd->img); diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 4b48388dd1..1157cbd698 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -43,7 +43,7 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Gfx.View.view_size { get; } Efl.Gfx.Image.image_size { get; } Efl.Ui.Image.icon { set; get; } - Efl.Player.playable { get; } + Efl.Playable.playable { get; } Efl.Player.play { get; set; } Efl.Ui.Zoom.zoom_animation { set; get; } Efl.Ui.Zoom.zoom_level { set; get; } diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c index b04ec11e35..e29ce9a60d 100644 --- a/src/lib/elementary/efl_ui_video.c +++ b/src/lib/elementary/efl_ui_video.c @@ -498,13 +498,13 @@ elm_video_audio_mute_get(const Evas_Object *obj) EAPI double elm_video_play_length_get(const Evas_Object *obj) { - return efl_player_length_get(obj); + return efl_playable_length_get(obj); } EAPI Eina_Bool elm_video_is_seekable_get(const Evas_Object *obj) { - return efl_player_seekable_get(obj); + return efl_playable_seekable_get(obj); } EAPI void diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo index 4cb7c2ea48..3e149205b8 100644 --- a/src/lib/emotion/efl_canvas_video.eo +++ b/src/lib/emotion/efl_canvas_video.eo @@ -1,5 +1,5 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group - implements Efl.File, Efl.Audio_Control, Efl.Player, + implements Efl.File, Efl.Audio_Control, Efl.Player, Efl.Playable, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller { [[Efl canvas video class]] @@ -62,8 +62,8 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group Efl.Player.progress { get; } Efl.Audio_Control.volume { get; set; } Efl.Audio_Control.mute { get; set; } - Efl.Player.length { get; } - Efl.Player.seekable { get; } + Efl.Playable.length { get; } + Efl.Playable.seekable { get; } Efl.Gfx.Image_Load_Controller.load_size { get; } Efl.Gfx.Image.ratio { get; } Efl.Gfx.Image.smooth_scale { get; set; } diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index 73c588bf81..9a30bede6d 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -731,7 +731,7 @@ emotion_object_buffer_size_get(const Evas_Object *obj) EAPI Eina_Bool emotion_object_seekable_get(const Evas_Object *obj) { - return efl_player_seekable_get(obj); + return efl_playable_seekable_get(obj); } EAPI Eina_Bool @@ -757,7 +757,7 @@ emotion_object_audio_handled_get(const Evas_Object *obj) EAPI double emotion_object_play_length_get(const Evas_Object *obj) { - return efl_player_length_get(obj); + return efl_playable_length_get(obj); } EAPI void @@ -1171,7 +1171,7 @@ _efl_canvas_video_efl_player_progress_get(const Eo *obj EINA_UNUSED, Efl_Canvas_ } EOLIAN static double -_efl_canvas_video_efl_player_length_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_playable_length_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return 0.0; sd->len = emotion_engine_instance_len_get(sd->engine_instance); @@ -1179,7 +1179,7 @@ _efl_canvas_video_efl_player_length_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vi } EOLIAN static Eina_Bool -_efl_canvas_video_efl_player_seekable_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_playable_seekable_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return EINA_FALSE; return emotion_engine_instance_seekable(sd->engine_instance); diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c index aa89c367ff..2dc7d55d43 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.c +++ b/src/lib/evas/canvas/efl_canvas_animation_player.c @@ -83,7 +83,7 @@ _animator_cb(void *data) EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); double duration, elapsed_time, vector; - if (efl_player_seekable_get(eo_obj)) + if (efl_playable_seekable_get(eo_obj)) { pd->time.current = ecore_loop_time_get(); @@ -195,7 +195,7 @@ _efl_canvas_animation_player_efl_player_start(Eo *eo_obj, double start_delay; EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); - if (!efl_player_playable_get(eo_obj)) return; + if (!efl_playable_get(eo_obj)) return; pd->is_play = EINA_TRUE; //TODO: check this case is correct if (pd->start_delay_timer) return; @@ -317,7 +317,7 @@ _efl_canvas_animation_player_efl_player_play_get(const Eo *eo_obj EINA_UNUSED, } EOLIAN static Eina_Bool -_efl_canvas_animation_player_efl_player_playable_get(const Eo *eo_obj, +_efl_canvas_animation_player_efl_playable_playable_get(const Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED) { Efl_Canvas_Animation *anim = efl_animation_player_animation_get(eo_obj); @@ -342,7 +342,7 @@ _efl_canvas_animation_player_efl_player_pos_set(Eo *eo_obj, double sec) { //TODO: this is not correct - if (!efl_player_seekable_get(eo_obj)) + if (!efl_playable_seekable_get(eo_obj)) return; EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); @@ -382,7 +382,7 @@ _efl_canvas_animation_player_efl_player_play_speed_get(const Eo *eo_obj EINA_UNU } EOLIAN static double -_efl_canvas_animation_player_efl_player_length_get(const Eo *eo_obj, +_efl_canvas_animation_player_efl_playable_length_get(const Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED) { EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); @@ -390,7 +390,7 @@ _efl_canvas_animation_player_efl_player_length_get(const Eo *eo_obj, } EOLIAN static Eina_Bool -_efl_canvas_animation_player_efl_player_seekable_get(const Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_playable_seekable_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED) { EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.eo b/src/lib/evas/canvas/efl_canvas_animation_player.eo index 8d33cc783d..ffec283f44 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.eo +++ b/src/lib/evas/canvas/efl_canvas_animation_player.eo @@ -1,4 +1,4 @@ -class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player +class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player, Efl.Playable { [[Efl animation object class]] c_prefix: efl_animation_player; @@ -38,14 +38,14 @@ class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player Efl.Player.start; Efl.Player.stop; Efl.Player.play { get; set; } - Efl.Player.playable { get; } + Efl.Playable.playable { get; } Efl.Player.pos { get; set; } Efl.Player.progress { get;} Efl.Player.play_speed { get; set; } //Efl.Player.volume { get; set; } //Efl.Player.mute { get; set; } - Efl.Player.length { get; } - Efl.Player.seekable { get; } + Efl.Playable.length { get; } + Efl.Playable.seekable { get; } } events { /* FIXME: This event is similar to Efl.Canvas.Object.anim_started but with different type, might be confusing. */ From 9b0197e2afbfca7ffa94f09ff5cac8fa9c7fe413 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 10:02:54 -0400 Subject: [PATCH 053/115] efl/player: pos -> playback_position ref T7877 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10112 --- src/bin/eolian_mono/eolian/mono/blacklist.hh | 2 +- src/lib/efl/interfaces/efl_player.eo | 2 +- src/lib/elementary/efl_ui_spotlight_manager_stack.c | 2 +- src/lib/elementary/efl_ui_video.c | 6 +++--- src/lib/emotion/efl_canvas_video.eo | 2 +- src/lib/emotion/emotion_smart.c | 8 ++++---- src/lib/evas/canvas/efl_canvas_animation_player.c | 4 ++-- src/lib/evas/canvas/efl_canvas_animation_player.eo | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/blacklist.hh b/src/bin/eolian_mono/eolian/mono/blacklist.hh index c46f2f4de7..95a5000225 100644 --- a/src/bin/eolian_mono/eolian/mono/blacklist.hh +++ b/src/bin/eolian_mono/eolian/mono/blacklist.hh @@ -17,7 +17,7 @@ inline bool is_function_blacklisted(std::string const& c_name) return c_name == "efl_event_callback_array_priority_add" || c_name == "efl_constructor" - || c_name == "efl_player_position_get" + || c_name == "efl_player_playback_position_get" || c_name == "efl_ui_widget_focus_set" || c_name == "efl_ui_widget_focus_get" || c_name == "efl_ui_text_password_get" diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 3ff0649732..2581bb5494 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -24,7 +24,7 @@ interface @beta Efl.Player play: bool; [[$true if playing, $false otherwise.]] } } - @property pos { + @property playback_position { [[Position in the media file. This property sets the current position of the media file diff --git a/src/lib/elementary/efl_ui_spotlight_manager_stack.c b/src/lib/elementary/efl_ui_spotlight_manager_stack.c index 18756c0d5f..501df211b3 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_stack.c +++ b/src/lib/elementary/efl_ui_spotlight_manager_stack.c @@ -66,7 +66,7 @@ _running_cb(void *data, const Efl_Event *ev EINA_UNUSED) EINA_SAFETY_ON_NULL_RETURN(pd); //calculate absolut position, multiply pos with 2.0 because duration is only 0.5) - absolut_position = pd->from + (pd->to - pd->from)*(efl_player_pos_get(pd->show)*2.0); + absolut_position = pd->from + (pd->to - pd->from)*(efl_player_playback_position_get(pd->show)*2.0); efl_event_callback_call(data, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position); } diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c index e29ce9a60d..1e26bba4ce 100644 --- a/src/lib/elementary/efl_ui_video.c +++ b/src/lib/elementary/efl_ui_video.c @@ -330,7 +330,7 @@ _efl_ui_video_emotion_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) EOLIAN static void _efl_ui_video_efl_player_start(Eo *obj, Efl_Ui_Video_Data *sd EINA_UNUSED) { - efl_player_pos_set(obj, 0.0); + efl_player_playback_position_set(obj, 0.0); efl_player_play_set(obj, EINA_TRUE); } @@ -510,13 +510,13 @@ elm_video_is_seekable_get(const Evas_Object *obj) EAPI void elm_video_play_position_set(Evas_Object *obj, double position) { - efl_player_pos_set(obj, position); + efl_player_playback_position_set(obj, position); } EAPI double elm_video_play_position_get(const Evas_Object *obj) { - return efl_player_pos_get(obj); + return efl_player_playback_position_get(obj); } EAPI Eina_Bool diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo index 3e149205b8..d8bb286fd3 100644 --- a/src/lib/emotion/efl_canvas_video.eo +++ b/src/lib/emotion/efl_canvas_video.eo @@ -58,7 +58,7 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group Efl.File.file { set; } Efl.File.loaded { get; } Efl.Player.play { get; set; } - Efl.Player.pos { get; set; } + Efl.Player.playback_position { get; set; } Efl.Player.progress { get; } Efl.Audio_Control.volume { get; set; } Efl.Audio_Control.mute { get; set; } diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index 9a30bede6d..e5183ea1ea 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -682,11 +682,11 @@ _efl_canvas_video_efl_player_play_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Vide EAPI void emotion_object_position_set(Evas_Object *obj, double sec) { - efl_player_pos_set(obj, sec); + efl_player_playback_position_set(obj, sec); } EOLIAN static void -_efl_canvas_video_efl_player_pos_set(Eo *obj, Efl_Canvas_Video_Data *sd, double sec) +_efl_canvas_video_efl_player_playback_position_set(Eo *obj, Efl_Canvas_Video_Data *sd, double sec) { DBG("sec=%f", sec); if (!sd->engine_instance) return; @@ -707,11 +707,11 @@ _efl_canvas_video_efl_player_pos_set(Eo *obj, Efl_Canvas_Video_Data *sd, double EAPI double emotion_object_position_get(const Evas_Object *obj) { - return efl_player_pos_get(obj); + return efl_player_playback_position_get(obj); } EOLIAN static double -_efl_canvas_video_efl_player_pos_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return 0.0; sd->pos = emotion_engine_instance_pos_get(sd->engine_instance); diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c index 2dc7d55d43..ea4929789c 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.c +++ b/src/lib/evas/canvas/efl_canvas_animation_player.c @@ -326,7 +326,7 @@ _efl_canvas_animation_player_efl_playable_playable_get(const Eo *eo_obj, } EOLIAN static double -_efl_canvas_animation_player_efl_player_pos_get(const Eo *eo_obj, +_efl_canvas_animation_player_efl_player_playback_position_get(const Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED) { //TODO: this is not correct @@ -337,7 +337,7 @@ _efl_canvas_animation_player_efl_player_pos_get(const Eo *eo_obj, } EOLIAN static void -_efl_canvas_animation_player_efl_player_pos_set(Eo *eo_obj, +_efl_canvas_animation_player_efl_player_playback_position_set(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED, double sec) { diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.eo b/src/lib/evas/canvas/efl_canvas_animation_player.eo index ffec283f44..6e739b5c58 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.eo +++ b/src/lib/evas/canvas/efl_canvas_animation_player.eo @@ -39,7 +39,7 @@ class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player Efl.Player.stop; Efl.Player.play { get; set; } Efl.Playable.playable { get; } - Efl.Player.pos { get; set; } + Efl.Player.playback_position { get; set; } Efl.Player.progress { get;} Efl.Player.play_speed { get; set; } //Efl.Player.volume { get; set; } From 89bee7a11a61d08cc758b061fd2f5e705d1f9029 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 10:11:26 -0400 Subject: [PATCH 054/115] efl/player: merge start+stop methods into 'playing' property this has some overlap with the existing 'play' property which will soon be renamed. the intent here is that there is a property for controlling the 'playing' state and then another property for managing 'pausing' the play state ref T7877 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10113 --- src/bin/elementary/test_efl_anim_alpha.c | 2 +- .../elementary/test_efl_anim_group_parallel.c | 2 +- .../test_efl_anim_group_sequential.c | 2 +- .../elementary/test_efl_anim_interpolator.c | 4 +- src/bin/elementary/test_efl_anim_pause.c | 2 +- src/bin/elementary/test_efl_anim_repeat.c | 2 +- src/bin/elementary/test_efl_anim_rotate.c | 2 +- src/bin/elementary/test_efl_anim_scale.c | 2 +- .../elementary/test_efl_anim_start_delay.c | 2 +- src/bin/elementary/test_efl_anim_translate.c | 2 +- src/examples/evas/evas-vg-json.c | 2 +- src/lib/efl/interfaces/efl_player.eo | 24 ++++-- .../efl_ui_spotlight_manager_stack.c | 6 +- src/lib/elementary/efl_ui_video.c | 37 ++++++---- src/lib/elementary/efl_ui_video.eo | 3 +- .../evas/canvas/efl_canvas_animation_player.c | 73 +++++++++++-------- .../canvas/efl_canvas_animation_player.eo | 3 +- src/lib/evas/canvas/evas_object_main.c | 4 +- 18 files changed, 103 insertions(+), 71 deletions(-) diff --git a/src/bin/elementary/test_efl_anim_alpha.c b/src/bin/elementary/test_efl_anim_alpha.c index 0a42b920eb..d75733f8c8 100644 --- a/src/bin/elementary/test_efl_anim_alpha.c +++ b/src/bin/elementary/test_efl_anim_alpha.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_group_parallel.c b/src/bin/elementary/test_efl_anim_group_parallel.c index b7128883d0..6283e2262f 100644 --- a/src/bin/elementary/test_efl_anim_group_parallel.c +++ b/src/bin/elementary/test_efl_anim_group_parallel.c @@ -54,7 +54,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_group_sequential.c b/src/bin/elementary/test_efl_anim_group_sequential.c index 655c37c571..3488149af0 100644 --- a/src/bin/elementary/test_efl_anim_group_sequential.c +++ b/src/bin/elementary/test_efl_anim_group_sequential.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_interpolator.c b/src/bin/elementary/test_efl_anim_interpolator.c index ca2e2446f9..be177d7ed4 100644 --- a/src/bin/elementary/test_efl_anim_interpolator.c +++ b/src/bin/elementary/test_efl_anim_interpolator.c @@ -113,7 +113,7 @@ _anim_start(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) int index = (uintptr_t)evas_object_data_get(obj, "index"); //Let Animation Object start animation - efl_player_start(ad->anim_obj[index]); + efl_player_playing_set(ad->anim_obj[index], EINA_TRUE); elm_object_disabled_set(obj, EINA_TRUE); elm_object_disabled_set(ad->start_all_btn, EINA_TRUE); @@ -128,7 +128,7 @@ _anim_start_all(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) for (i = 0; i < INTERP_NUM; i++) { //Let Animation Object start animation - efl_player_start(ad->anim_obj[i]); + efl_player_playing_set(ad->anim_obj[i], EINA_TRUE); elm_object_disabled_set(ad->btn[i], EINA_TRUE); } diff --git a/src/bin/elementary/test_efl_anim_pause.c b/src/bin/elementary/test_efl_anim_pause.c index c73b7bcf6c..748599bbfa 100644 --- a/src/bin/elementary/test_efl_anim_pause.c +++ b/src/bin/elementary/test_efl_anim_pause.c @@ -69,7 +69,7 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0"); } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_repeat.c b/src/bin/elementary/test_efl_anim_repeat.c index 50df2035c8..d853f9c32b 100644 --- a/src/bin/elementary/test_efl_anim_repeat.c +++ b/src/bin/elementary/test_efl_anim_repeat.c @@ -106,7 +106,7 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_rotate.c b/src/bin/elementary/test_efl_anim_rotate.c index 454ca0f262..10df8caf89 100644 --- a/src/bin/elementary/test_efl_anim_rotate.c +++ b/src/bin/elementary/test_efl_anim_rotate.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_scale.c b/src/bin/elementary/test_efl_anim_scale.c index bd380bd145..5e5f9abc58 100644 --- a/src/bin/elementary/test_efl_anim_scale.c +++ b/src/bin/elementary/test_efl_anim_scale.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_start_delay.c b/src/bin/elementary/test_efl_anim_start_delay.c index c94b515b62..e3c7b255b5 100644 --- a/src/bin/elementary/test_efl_anim_start_delay.c +++ b/src/bin/elementary/test_efl_anim_start_delay.c @@ -68,7 +68,7 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/bin/elementary/test_efl_anim_translate.c b/src/bin/elementary/test_efl_anim_translate.c index a562d17d65..9f30cc3b63 100644 --- a/src/bin/elementary/test_efl_anim_translate.c +++ b/src/bin/elementary/test_efl_anim_translate.c @@ -53,7 +53,7 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) } //Let Animation Object start animation - efl_player_start(ad->anim_obj); + efl_player_playing_set(ad->anim_obj, EINA_TRUE); } static void diff --git a/src/examples/evas/evas-vg-json.c b/src/examples/evas/evas-vg-json.c index 7447373711..248dcb1054 100644 --- a/src/examples/evas/evas-vg-json.c +++ b/src/examples/evas/evas-vg-json.c @@ -124,7 +124,7 @@ main(void) Eo *player = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, evas); efl_animation_player_animation_set(player, anim); efl_event_callback_add(player, EFL_ANIMATION_PLAYER_EVENT_RUNNING, running_cb, NULL); - efl_player_start(player); + efl_player_playing_set(player, EINA_TRUE); ecore_main_loop_begin(); ecore_evas_shutdown(); diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 2581bb5494..619fcd5ea8 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -3,11 +3,25 @@ interface @beta Efl.Player [[Efl media player interface]] c_prefix: efl_player; methods { - start { - [[Start a playing playable object.]] - } - stop { - [[Stop playable object.]] + @property playing { + [[Playback state of the media file. + + This property sets the playback state of the object. Re-setting the current + playback state has no effect. + + If set to $false, the object's @.progress property is reset to $0.0. Applying + the $false playing state also has the same effect as the player object reaching + the end of its playback, which may invoke additional behavior based on a class's + implementation. + ]] + set { + return: bool(false); [[If $true, the property change has succeeded.]] + } + get { + } + values { + playing: bool; [[$true if playing, $false otherwise.]] + } } @property play { [[Playback state of the media file. diff --git a/src/lib/elementary/efl_ui_spotlight_manager_stack.c b/src/lib/elementary/efl_ui_spotlight_manager_stack.c index 501df211b3..9d920346f9 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_stack.c +++ b/src/lib/elementary/efl_ui_spotlight_manager_stack.c @@ -176,9 +176,9 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_content_del(Eo *obj EIN static void _setup_anim(Efl_Animation_Player *player, Efl_Gfx_Entity *entity) { - efl_player_stop(player); + efl_player_playing_set(player, EINA_FALSE); efl_animation_player_target_set(player, entity); - efl_player_start(player); + efl_player_playing_set(player, EINA_TRUE); } static Eina_Bool @@ -256,7 +256,7 @@ _reset_player(Efl_Animation_Player *player, Eina_Bool vis) Efl_Gfx_Entity *obj; obj = efl_animation_player_target_get(player); - efl_player_stop(player); + efl_player_playing_set(player, EINA_FALSE); efl_animation_player_target_set(player, NULL); efl_gfx_entity_visible_set(obj, vis); } diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c index 1e26bba4ce..e5bf59b4f0 100644 --- a/src/lib/elementary/efl_ui_video.c +++ b/src/lib/elementary/efl_ui_video.c @@ -327,13 +327,6 @@ _efl_ui_video_emotion_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) return sd->emotion; } -EOLIAN static void -_efl_ui_video_efl_player_start(Eo *obj, Efl_Ui_Video_Data *sd EINA_UNUSED) -{ - efl_player_playback_position_set(obj, 0.0); - efl_player_play_set(obj, EINA_TRUE); -} - EOLIAN static void _efl_ui_video_efl_player_play_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool play) { @@ -367,14 +360,25 @@ _efl_ui_video_efl_player_play_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool play /* FIXME: stop should go into hibernate state directly. */ -EOLIAN static void -_efl_ui_video_efl_player_stop(Eo *obj, Efl_Ui_Video_Data *sd) +EOLIAN static Eina_Bool +_efl_ui_video_efl_player_playing_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool playing) { - if (!emotion_object_play_get(sd->emotion) && sd->stop) return; - + playing = !!playing; + if (playing && emotion_object_play_get(sd->emotion)) return EINA_TRUE; + if ((!playing) && sd->stop) return EINA_TRUE; ELM_SAFE_FREE(sd->timer, ecore_timer_del); + sd->stop = !playing; + if (playing) + { + emotion_object_play_set(sd->emotion, EINA_TRUE); - sd->stop = EINA_TRUE; + if(elm_widget_is_legacy(obj)) + elm_layout_signal_emit(obj, "elm,video,play", "elm"); + else + elm_layout_signal_emit(obj, "efl,video,play", "efl"); + return EINA_TRUE; + } + efl_player_playback_position_set(obj, 0.0); emotion_object_play_set(sd->emotion, EINA_FALSE); if(elm_widget_is_legacy(obj)) @@ -383,6 +387,13 @@ _efl_ui_video_efl_player_stop(Eo *obj, Efl_Ui_Video_Data *sd) elm_layout_signal_emit(obj, "efl,video,stop", "efl"); emotion_object_suspend_set(sd->emotion, EMOTION_HIBERNATE); + return EINA_TRUE; +} + +EOLIAN static Eina_Bool +_efl_ui_video_efl_player_playing_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) +{ + return emotion_object_play_get(sd->emotion); } EOLIAN static Eina_Bool @@ -534,7 +545,7 @@ elm_video_play(Evas_Object *obj) EAPI void elm_video_stop(Evas_Object *obj) { - efl_player_stop(obj); + efl_player_playing_set(obj, EINA_FALSE); } EAPI void diff --git a/src/lib/elementary/efl_ui_video.eo b/src/lib/elementary/efl_ui_video.eo index 5fc841a3b3..77a550c68f 100644 --- a/src/lib/elementary/efl_ui_video.eo +++ b/src/lib/elementary/efl_ui_video.eo @@ -43,8 +43,7 @@ class @beta Efl.Ui.Video extends Efl.Ui.Layout_Base Efl.Canvas.Group.group_calculate; Efl.Ui.Widget.widget_input_event_handler; Efl.Access.Widget.Action.elm_actions { get; } - Efl.Player.start; - Efl.Player.stop; + Efl.Player.playing { get; set; } Efl.Player.play { get; set; } } } diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c index ea4929789c..981ece8b80 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.c +++ b/src/lib/evas/canvas/efl_canvas_animation_player.c @@ -61,7 +61,7 @@ _efl_canvas_animation_player_animation_set(Eo *eo_obj, if (pd->animation) { - efl_player_stop(eo_obj); + efl_player_playing_set(eo_obj, EINA_FALSE); efl_unref(pd->animation); } pd->animation = anim; @@ -147,7 +147,7 @@ _animator_cb(void *data) return ECORE_CALLBACK_RENEW; } - efl_player_stop(eo_obj); + efl_player_playing_set(eo_obj, EINA_FALSE); return ECORE_CALLBACK_CANCEL; } @@ -188,30 +188,6 @@ _start_delay_timer_cb(void *data) return ECORE_CALLBACK_CANCEL; } -EOLIAN static void -_efl_canvas_animation_player_efl_player_start(Eo *eo_obj, - Efl_Canvas_Animation_Player_Data *pd) -{ - double start_delay; - EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); - - if (!efl_playable_get(eo_obj)) return; - pd->is_play = EINA_TRUE; - //TODO: check this case is correct - if (pd->start_delay_timer) return; - - pd->progress = 0.0; - start_delay = efl_animation_start_delay_get(anim); - if (start_delay > 0.0) - { - pd->start_delay_timer = ecore_timer_add(start_delay, - _start_delay_timer_cb, eo_obj); - return; - } - - _start(eo_obj, pd); -} - static Eina_Bool _is_final_state(Efl_Canvas_Animation *anim, double progress) { @@ -240,12 +216,9 @@ _is_final_state(Efl_Canvas_Animation *anim, double progress) return EINA_FALSE; } -EOLIAN static void -_efl_canvas_animation_player_efl_player_stop(Eo *eo_obj, - Efl_Canvas_Animation_Player_Data *pd) +static void +_player_stop(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Efl_Canvas_Animation *anim) { - EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); - //Reset the state of the target to the initial state efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj)); @@ -281,6 +254,42 @@ _efl_canvas_animation_player_efl_player_stop(Eo *eo_obj, if (pd->auto_del) efl_del(eo_obj); } +EOLIAN static Eina_Bool +_efl_canvas_animation_player_efl_player_playing_set(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Eina_Bool playing) +{ + double start_delay; + EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim); + + if (!efl_playable_get(eo_obj)) return EINA_FALSE; + if ((!playing) && (!pd->is_play)) return EINA_TRUE; + if ((playing) && (pd->is_play)) return EINA_TRUE; + pd->is_play = !!playing; + if (!playing) + { + _player_stop(eo_obj, pd, anim); + return EINA_TRUE; + } + //TODO: check this case is correct + if (pd->start_delay_timer) return EINA_TRUE; + + pd->progress = 0.0; + start_delay = efl_animation_start_delay_get(anim); + if (start_delay > 0.0) + { + pd->start_delay_timer = ecore_timer_add(start_delay, + _start_delay_timer_cb, eo_obj); + } + else + _start(eo_obj, pd); + return EINA_TRUE; +} + +EOLIAN static Eina_Bool +_efl_canvas_animation_player_efl_player_playing_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd) +{ + return pd->is_play; +} + EOLIAN static void _efl_canvas_animation_player_efl_player_play_set(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, @@ -425,7 +434,7 @@ _efl_canvas_animation_player_efl_object_destructor(Eo *eo_obj, pd->animator = NULL; //Reset the state of the target to the initial state - efl_player_stop(eo_obj); + efl_player_playing_set(eo_obj, EINA_FALSE); efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL); } diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.eo b/src/lib/evas/canvas/efl_canvas_animation_player.eo index 6e739b5c58..57e13f1035 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.eo +++ b/src/lib/evas/canvas/efl_canvas_animation_player.eo @@ -35,8 +35,7 @@ class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player implements { Efl.Object.constructor; Efl.Object.destructor; - Efl.Player.start; - Efl.Player.stop; + Efl.Player.playing { get; set; } Efl.Player.play { get; set; } Efl.Playable.playable { get; } Efl.Player.playback_position { get; set; } diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 95ee8a21d5..abd8a2d5e2 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1870,7 +1870,7 @@ static void _show(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) { if (obj->anim_player) - efl_player_stop(obj->anim_player); + efl_player_playing_set(obj->anim_player, EINA_FALSE); if (obj->is_smart && obj->smart.smart && obj->smart.smart->smart_class->show) { obj->smart.smart->smart_class->show(eo_obj); @@ -2583,7 +2583,7 @@ _efl_canvas_object_event_animation_cancel(Eo *eo_obj) Evas_Object_Protected_Data *obj = EVAS_OBJECT_DATA_SAFE_GET(eo_obj); if (obj) - efl_player_stop(obj->anim_player); + efl_player_playing_set(obj->anim_player, EINA_FALSE); } /* legacy */ From 3d3cdc5955560726f0b9a8cef492274a1f7254a4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 11:18:57 -0400 Subject: [PATCH 055/115] efl/player: rename 'play' property to 'pause' this is a bit of an overhaul wherein the existing 'play' mechanics are all inverted. 'pause' is a state which stops playback but does not affect the playback_position property. this patch also includes implementations of Efl.Player::playing for a couple classes which (now) only implement pause, as this is a requirement for the objects to actually activate their animations test cases: * unit tests * all elm_test animation cases * elm_test video * rage Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10114 --- src/bin/elementary/test_efl_anim_pause.c | 4 +- src/bin/elementary/test_efl_anim_repeat.c | 3 +- src/bin/elementary/test_evas_snapshot.c | 6 +- src/bin/elementary/test_gfx_filters.c | 2 +- src/bin/elementary/test_photocam.c | 12 +- src/lib/edje/edje_legacy.c | 4 +- src/lib/edje/edje_smart.c | 25 ++-- src/lib/edje/efl_canvas_layout.eo | 2 +- src/lib/efl/interfaces/efl_player.eo | 15 +- src/lib/elementary/efl_ui_image.c | 87 +++++++----- src/lib/elementary/efl_ui_image.eo | 3 +- src/lib/elementary/efl_ui_image_zoomable.c | 130 ++++++++++-------- src/lib/elementary/efl_ui_image_zoomable.eo | 3 +- .../efl_ui_image_zoomable_private.h | 1 - .../efl_ui_spotlight_manager_stack.c | 6 +- src/lib/elementary/efl_ui_video.c | 29 ++-- src/lib/elementary/efl_ui_video.eo | 2 +- src/lib/elementary/efl_ui_widget_image.h | 2 +- src/lib/emotion/efl_canvas_video.eo | 3 +- src/lib/emotion/emotion_smart.c | 73 ++++++++-- .../evas/canvas/efl_canvas_animation_player.c | 50 +++---- .../canvas/efl_canvas_animation_player.eo | 2 +- .../efl_canvas_animation_player_private.h | 1 + src/lib/evas/canvas/evas_object_intercept.c | 2 +- 24 files changed, 279 insertions(+), 188 deletions(-) diff --git a/src/bin/elementary/test_efl_anim_pause.c b/src/bin/elementary/test_efl_anim_pause.c index 748599bbfa..3730db33cf 100644 --- a/src/bin/elementary/test_efl_anim_pause.c +++ b/src/bin/elementary/test_efl_anim_pause.c @@ -82,13 +82,13 @@ _pause_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED if (ad->is_anim_paused) { //Pause animation - efl_player_play_set(ad->anim_obj, EINA_FALSE); + efl_player_paused_set(ad->anim_obj, EINA_TRUE); elm_object_text_set(obj, "Resume Animation"); } else { //Resume animation - efl_player_play_set(ad->anim_obj, EINA_TRUE); + efl_player_paused_set(ad->anim_obj, EINA_FALSE); elm_object_text_set(obj, "Pause Animation"); } } diff --git a/src/bin/elementary/test_efl_anim_repeat.c b/src/bin/elementary/test_efl_anim_repeat.c index d853f9c32b..55bf98c748 100644 --- a/src/bin/elementary/test_efl_anim_repeat.c +++ b/src/bin/elementary/test_efl_anim_repeat.c @@ -122,8 +122,7 @@ test_efl_anim_repeat(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void App_Data *ad = calloc(1, sizeof(App_Data)); if (!ad) return; - Evas_Object *win = elm_win_add(NULL, "Efl Animation Repeat", ELM_WIN_BASIC); - elm_win_title_set(win, "Efl Animation Repeat"); + Evas_Object *win = elm_win_util_standard_add(NULL, "Efl Animation Repeat"); elm_win_autodel_set(win, EINA_TRUE); evas_object_smart_callback_add(win, "delete,request", _win_del_cb, ad); diff --git a/src/bin/elementary/test_evas_snapshot.c b/src/bin/elementary/test_evas_snapshot.c index ecfee1910a..f1395f2750 100644 --- a/src/bin/elementary/test_evas_snapshot.c +++ b/src/bin/elementary/test_evas_snapshot.c @@ -47,7 +47,11 @@ _anim_toggle(void *data, const Efl_Event *ev EINA_UNUSED) EINA_ITERATOR_FOREACH(it, o) { if (efl_isa(o, EFL_PLAYER_INTERFACE) && efl_playable_get(o)) - efl_player_play_set(o, !efl_player_play_get(o)); + { + if (!efl_player_playing_get(o)) + efl_player_playing_set(o, EINA_TRUE); + efl_player_paused_set(o, !efl_player_paused_get(o)); + } } eina_iterator_free(it); } diff --git a/src/bin/elementary/test_gfx_filters.c b/src/bin/elementary/test_gfx_filters.c index e7410c861d..11ee74cae3 100644 --- a/src/bin/elementary/test_gfx_filters.c +++ b/src/bin/elementary/test_gfx_filters.c @@ -408,7 +408,7 @@ test_gfx_filters(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve efl_name_set(efl_added, images[k].src_name), elm_object_tooltip_text_set(efl_added, images[k].src_name)); if (efl_playable_get(o)) - efl_player_play_set(o, 1); + efl_player_playing_set(o, 1); efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _img_click, win); efl_pack(box2, o); } diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c index 70d6da2bcc..c26be3a334 100644 --- a/src/bin/elementary/test_photocam.c +++ b/src/bin/elementary/test_photocam.c @@ -153,7 +153,7 @@ my_bt_open(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) if (file && eina_str_has_extension(file, ".gif") && efl_playable_get(ph)) - efl_player_play_set(ph, EINA_TRUE); + efl_player_playing_set(ph, EINA_TRUE); } static void @@ -754,11 +754,11 @@ test_photocam_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e static void _zoomable_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev) { - Eina_Bool play; + Eina_Bool paused; - play = !efl_player_play_get(ev->object); - printf("image clicked! play = %d\n", play); - efl_player_play_set(ev->object, play); + paused = efl_player_paused_get(ev->object); + printf("image clicked! paused = %d\n", paused); + efl_player_paused_set(ev->object, !paused); } static void @@ -832,7 +832,7 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE if (efl_playable_get(zoomable)) { printf("animation is available for this image.\n"); - efl_player_play_set(zoomable, EINA_TRUE); + efl_player_playing_set(zoomable, EINA_TRUE); } rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, win, diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c index edcc185a33..5f04ead424 100644 --- a/src/lib/edje/edje_legacy.c +++ b/src/lib/edje/edje_legacy.c @@ -1202,13 +1202,13 @@ edje_object_calc_force(Edje_Object *obj) EAPI void edje_object_play_set(Evas_Object *obj, Eina_Bool play) { - efl_player_play_set(obj, play); + efl_player_paused_set(obj, !play); } EAPI Eina_Bool edje_object_play_get(const Evas_Object *obj) { - return efl_player_play_get(obj); + return !efl_player_paused_get(obj); } EAPI void diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 7acf644145..c0b37dbdc1 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -543,28 +543,26 @@ _efl_canvas_layout_efl_playable_playable_get(const Eo *obj EINA_UNUSED, Edje *pd return EINA_TRUE; } -EOLIAN void -_efl_canvas_layout_efl_player_play_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool play) +EOLIAN Eina_Bool +_efl_canvas_layout_efl_player_paused_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool paused) { double t; Eina_List *l; Edje_Running_Program *runp; unsigned short i; - if (!ed) return; - if (ed->delete_me) return; - if (play) + if (!ed) return EINA_FALSE; + if (ed->delete_me) return EINA_FALSE; + paused = !!paused; + if (ed->paused == paused) return EINA_TRUE; + if (!paused) { - if (!ed->paused) return; - ed->paused = EINA_FALSE; t = ecore_time_get() - ed->paused_at; EINA_LIST_FOREACH(ed->actions, l, runp) runp->start_time += t; } else { - if (ed->paused) return; - ed->paused = EINA_TRUE; ed->paused_at = ecore_time_get(); } @@ -576,18 +574,17 @@ _efl_canvas_layout_efl_player_play_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool ((rp->type == EDJE_RP_TYPE_SWALLOW) && (rp->typedata.swallow)) && (rp->typedata.swallow->swallowed_object)) - edje_object_play_set(rp->typedata.swallow->swallowed_object, play); + efl_player_paused_set(rp->typedata.swallow->swallowed_object, paused); } + return EINA_TRUE; } EOLIAN Eina_Bool -_efl_canvas_layout_efl_player_play_get(const Eo *obj EINA_UNUSED, Edje *ed) +_efl_canvas_layout_efl_player_paused_get(const Eo *obj EINA_UNUSED, Edje *ed) { if (!ed) return EINA_FALSE; if (ed->delete_me) return EINA_FALSE; - if (ed->paused) return EINA_FALSE; - - return EINA_TRUE; + return ed->paused; } EOLIAN void diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo index 0f7a185d27..5a9f0ac237 100644 --- a/src/lib/edje/efl_canvas_layout.eo +++ b/src/lib/edje/efl_canvas_layout.eo @@ -127,7 +127,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl. Efl.Part.part_get; [[Returns @Efl.Canvas.Layout_Part]] Efl.Observer.update; Efl.Playable.playable { get; } - Efl.Player.play { get; set; } + Efl.Player.paused { get; set; } Efl.Player.play_speed { get; set; } } } diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 619fcd5ea8..bf100a2b1d 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -23,19 +23,22 @@ interface @beta Efl.Player playing: bool; [[$true if playing, $false otherwise.]] } } - @property play { - [[Playback state of the media file. + @property paused { + [[Pause state of the media file. - This property sets the currently playback state of the - video. Using this function to play or pause the video - doesn't alter it's current position. + This property sets the pause state of the media. Re-setting the current + pause state has no effect. + + If @.playing is set to $true, this property can be used to pause and resume + playback of the media without changing its @.progress property. ]] set { + return: bool(false); [[If $true, the property change has succeeded.]] } get { } values { - play: bool; [[$true if playing, $false otherwise.]] + paused: bool; [[$true if paused, $false otherwise.]] } } @property playback_position { diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index bbeffb2228..3047787ea1 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -871,6 +871,8 @@ _efl_ui_image_efl_object_constructor(Eo *obj, Efl_Ui_Image_Data *pd) pd->scale_type = EFL_GFX_IMAGE_SCALE_METHOD_FIT; pd->self = obj; + /* legacy elm_image starts paused */ + pd->paused = elm_widget_is_legacy(obj); return obj; } @@ -930,8 +932,11 @@ _efl_ui_image_efl_file_load(Eo *obj, Efl_Ui_Image_Data *sd) if (sd->anim) { ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); - sd->play = EINA_FALSE; + sd->paused = elm_widget_is_legacy(obj); sd->anim = EINA_FALSE; + sd->frame_count = -1; + sd->cur_frame = -1; + sd->frame_duration = -1; } if (file && _efl_ui_image_is_remote(file)) @@ -967,8 +972,11 @@ _efl_ui_image_efl_file_unload(Eo *obj, Efl_Ui_Image_Data *sd) if (sd->anim) { ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); - sd->play = EINA_FALSE; + sd->paused = elm_widget_is_legacy(obj); sd->anim = EINA_FALSE; + sd->frame_count = -1; + sd->cur_frame = -1; + sd->frame_duration = -1; } if (sd->prev_img) @@ -1727,21 +1735,21 @@ _efl_ui_image_efl_playable_playable_get(const Eo *obj, Efl_Ui_Image_Data *sd) return evas_object_image_animated_get(elm_image_object_get(obj)); } -static void +static Eina_Bool _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool anim) { anim = !!anim; - if (sd->anim == anim) return; - - sd->anim = anim; + if (sd->anim == anim) return EINA_TRUE; if (sd->edje) { edje_object_animation_set(sd->img, anim); - return; + sd->anim = anim; + return EINA_TRUE; } sd->img = elm_image_object_get(obj); - if (!evas_object_image_animated_get(sd->img)) return; + if (!evas_object_image_animated_get(sd->img)) return EINA_FALSE; + sd->anim = anim; if (anim) { @@ -1751,13 +1759,18 @@ _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool an evas_object_image_animated_frame_duration_get (sd->img, sd->cur_frame, 0); evas_object_image_animated_frame_set(sd->img, sd->cur_frame); + if (!sd->paused)//legacy + sd->anim_timer = ecore_timer_add + (sd->frame_duration, _efl_ui_image_animate_cb, obj); } else { sd->frame_count = -1; sd->cur_frame = -1; sd->frame_duration = -1; + ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); } + return EINA_TRUE; } static Eina_Bool @@ -1784,18 +1797,31 @@ elm_image_animated_get(const Evas_Object *obj) return _efl_ui_image_animated_get_internal(obj, sd); } -static void -_efl_ui_image_animated_play_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool play) +EOLIAN static Eina_Bool +_efl_ui_image_efl_player_playing_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool playing) { - if (!sd->anim) return; - if (sd->play == play) return; - sd->play = play; + return _efl_ui_image_animated_set_internal(obj, sd, playing); +} + +EOLIAN static Eina_Bool +_efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd) +{ + return _efl_ui_image_animated_get_internal(obj, sd); +} + +static Eina_Bool +_efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused) +{ + paused = !!paused; + if (!sd->anim) return EINA_FALSE; + if (sd->paused == paused) return EINA_TRUE; + sd->paused = paused; if (sd->edje) { - edje_object_play_set(sd->img, play); - return; + edje_object_play_set(sd->img, !paused); + return EINA_TRUE; } - if (play) + if (!paused) { sd->anim_timer = ecore_timer_add (sd->frame_duration, _efl_ui_image_animate_cb, obj); @@ -1804,14 +1830,15 @@ _efl_ui_image_animated_play_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bo { ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); } + return EINA_TRUE; } static Eina_Bool -_efl_ui_image_animated_play_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +_efl_ui_image_animated_paused_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) { if (sd->edje) - return edje_object_play_get(sd->img); - return sd->play; + return !edje_object_play_get(sd->img); + return sd->paused; } EAPI void @@ -1819,7 +1846,7 @@ elm_image_animated_play_set(Elm_Image *obj, Eina_Bool play) { Efl_Ui_Image_Data *sd = efl_data_scope_get(obj, MY_CLASS); if (!sd) return; - _efl_ui_image_animated_play_set_internal(obj, sd, play); + _efl_ui_image_animated_paused_set_internal(obj, sd, !play); } EAPI Eina_Bool @@ -1827,21 +1854,19 @@ elm_image_animated_play_get(const Elm_Image *obj) { Efl_Ui_Image_Data *sd = efl_data_scope_get(obj, MY_CLASS); if (!sd) return EINA_FALSE; - return _efl_ui_image_animated_play_get_internal(obj, sd); -} - -EOLIAN static void -_efl_ui_image_efl_player_play_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool play) -{ - if (play && !_efl_ui_image_animated_get_internal(obj, sd)) - _efl_ui_image_animated_set_internal(obj, sd, play); - _efl_ui_image_animated_play_set_internal(obj, sd, play); + return _efl_ui_image_animated_paused_get_internal(obj, sd); } EOLIAN static Eina_Bool -_efl_ui_image_efl_player_play_get(const Eo *obj, Efl_Ui_Image_Data *sd) +_efl_ui_image_efl_player_paused_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused) { - return _efl_ui_image_animated_play_get_internal(obj, sd); + return _efl_ui_image_animated_paused_set_internal(obj, sd, paused); +} + +EOLIAN static Eina_Bool +_efl_ui_image_efl_player_paused_get(const Eo *obj, Efl_Ui_Image_Data *sd) +{ + return _efl_ui_image_animated_paused_get_internal(obj, sd); } EOLIAN static void diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 21035452a7..6ea6b27266 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -98,7 +98,8 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. Efl.Gfx.Image.content_hint { get; set; } Efl.Gfx.Image.image_load_error { get; } Efl.Playable.playable { get; } - Efl.Player.play { get; set; } + Efl.Player.playing { get; set; } + Efl.Player.paused { get; set; } Efl.Layout.Signal.signal_emit; Efl.Layout.Signal.message_send; Efl.Layout.Signal.signal_callback_add; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 0549a67190..129619aa9d 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -3017,39 +3017,6 @@ _efl_ui_image_zoomable_animated_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_I return sd->anim; } -static void -_efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool anim) -{ - anim = !!anim; - if (sd->anim == anim) return; - - sd->anim = anim; - - if (sd->edje) - { - edje_object_animation_set(sd->edje, anim); - return; - } - - if (!evas_object_image_animated_get(sd->img)) return; - - if (anim) - { - sd->frame_count = evas_object_image_animated_frame_count_get(sd->img); - sd->cur_frame = 1; - sd->frame_duration = - evas_object_image_animated_frame_duration_get - (sd->img, sd->cur_frame, 0); - evas_object_image_animated_frame_set(sd->img, sd->cur_frame); - } - else - { - sd->frame_count = -1; - sd->cur_frame = -1; - sd->frame_duration = -1; - } -} - static Eina_Bool _efl_ui_image_zoomable_animate_cb(void *data) { @@ -3072,18 +3039,56 @@ _efl_ui_image_zoomable_animate_cb(void *data) return ECORE_CALLBACK_RENEW; } -static void -_efl_ui_image_zoomable_animated_play_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool play) +static Eina_Bool +_efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool anim) { - if (!sd->anim) return; - if (sd->play == play) return; - sd->play = play; + anim = !!anim; + if (sd->anim == anim) return EINA_TRUE; + if (sd->edje) { - edje_object_play_set(sd->edje, play); - return; + sd->anim = anim; + edje_object_animation_set(sd->edje, anim); + return EINA_TRUE; } - if (play) + + if (!evas_object_image_animated_get(sd->img)) return EINA_FALSE; + sd->anim = anim; + if (anim) + { + sd->frame_count = evas_object_image_animated_frame_count_get(sd->img); + sd->cur_frame = 1; + sd->frame_duration = + evas_object_image_animated_frame_duration_get + (sd->img, sd->cur_frame, 0); + evas_object_image_animated_frame_set(sd->img, sd->cur_frame); + if (!sd->paused)//legacy + sd->anim_timer = ecore_timer_add + (sd->frame_duration, _efl_ui_image_zoomable_animate_cb, obj); + } + else + { + sd->frame_count = -1; + sd->cur_frame = -1; + sd->frame_duration = -1; + ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); + } + return EINA_TRUE; +} + +static Eina_Bool +_efl_ui_image_zoomable_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool paused) +{ + paused = !!paused; + if (!sd->anim) return EINA_FALSE; + if (sd->paused == paused) return EINA_TRUE; + sd->paused = paused; + if (sd->edje) + { + edje_object_play_set(sd->edje, !paused); + return EINA_TRUE; + } + if (!paused) { sd->anim_timer = ecore_timer_add (sd->frame_duration, _efl_ui_image_zoomable_animate_cb, obj); @@ -3092,30 +3097,33 @@ _efl_ui_image_zoomable_animated_play_set_internal(Eo *obj, Efl_Ui_Image_Zoomable { ELM_SAFE_FREE(sd->anim_timer, ecore_timer_del); } -} - -EOLIAN static void -_efl_ui_image_zoomable_efl_player_play_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool play) -{ - evas_object_image_preload(sd->img, EINA_FALSE); - if (play && !_efl_ui_image_zoomable_animated_get_internal(obj, sd)) - _efl_ui_image_zoomable_animated_set_internal(obj, sd, play); - - _efl_ui_image_zoomable_animated_play_set_internal(obj, sd, play); -} - -static Eina_Bool -_efl_ui_image_zoomable_animated_play_get_internal(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) -{ - if (sd->edje) - return edje_object_play_get(sd->edje); - return sd->play; + return EINA_TRUE; } EOLIAN static Eina_Bool -_efl_ui_image_zoomable_efl_player_play_get(const Eo *obj, Efl_Ui_Image_Zoomable_Data *sd) +_efl_ui_image_zoomable_efl_player_playing_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool playing) { - return _efl_ui_image_zoomable_animated_play_get_internal(obj, sd); + return _efl_ui_image_zoomable_animated_set_internal(obj, sd, playing); +} + +EOLIAN static Eina_Bool +_efl_ui_image_zoomable_efl_player_paused_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool paused) +{ + return _efl_ui_image_zoomable_animated_paused_set_internal(obj, sd, paused); +} + +EOLIAN static Eina_Bool +_efl_ui_image_zoomable_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Zoomable_Data *sd) +{ + return _efl_ui_image_zoomable_animated_get_internal(obj, sd); +} + +EOLIAN static Eina_Bool +_efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + if (sd->edje) + return !edje_object_play_get(sd->edje); + return sd->paused; } EOLIAN static void diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 1157cbd698..bed8b367df 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -44,7 +44,8 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Gfx.Image.image_size { get; } Efl.Ui.Image.icon { set; get; } Efl.Playable.playable { get; } - Efl.Player.play { get; set; } + Efl.Player.playing { get; set; } + Efl.Player.paused { get; set; } Efl.Ui.Zoom.zoom_animation { set; get; } Efl.Ui.Zoom.zoom_level { set; get; } Efl.Ui.Zoom.zoom_mode { set; get; } diff --git a/src/lib/elementary/efl_ui_image_zoomable_private.h b/src/lib/elementary/efl_ui_image_zoomable_private.h index d8b95ebaba..f2833c838c 100644 --- a/src/lib/elementary/efl_ui_image_zoomable_private.h +++ b/src/lib/elementary/efl_ui_image_zoomable_private.h @@ -140,7 +140,6 @@ struct _Efl_Ui_Image_Zoomable_Data Eina_Bool on_hold : 1; Eina_Bool paused : 1; Eina_Bool orientation_changed : 1; - Eina_Bool play : 1; Eina_Bool anim : 1; Eina_Bool freeze_want : 1; Eina_Bool show_item: 1; diff --git a/src/lib/elementary/efl_ui_spotlight_manager_stack.c b/src/lib/elementary/efl_ui_spotlight_manager_stack.c index 9d920346f9..e93c82080f 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_stack.c +++ b/src/lib/elementary/efl_ui_spotlight_manager_stack.c @@ -23,7 +23,7 @@ _geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd) { Eina_Array *array = eina_array_new(2); Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group); - if (efl_player_play_get(pd->hide)) + if (efl_player_playing_get(pd->hide)) { //we are currently in animation, sync the geometry of the targets eina_array_push(array, efl_animation_player_target_get(pd->hide)); @@ -132,7 +132,7 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp pd->show = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, obj); efl_animation_player_animation_set(pd->show, show_anim); - efl_player_play_set(pd->show, EINA_FALSE); + efl_player_playing_set(pd->show, EINA_FALSE); efl_event_callback_array_add(pd->show, _anim_show_event_cb(), obj); //Default Hide Animation @@ -143,7 +143,7 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp pd->hide = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, obj); efl_animation_player_animation_set(pd->hide, hide_anim); - efl_player_play_set(pd->hide, EINA_FALSE); + efl_player_playing_set(pd->hide, EINA_FALSE); efl_event_callback_array_add(pd->hide, _anim_hide_event_cb(), obj); for (int i = 0; i < efl_content_count(spotlight) ; ++i) { diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c index e5bf59b4f0..172e9122cc 100644 --- a/src/lib/elementary/efl_ui_video.c +++ b/src/lib/elementary/efl_ui_video.c @@ -95,7 +95,7 @@ _key_action_move(Evas_Object *obj, const char *params) static Eina_Bool _key_action_play(Evas_Object *obj, const char *params EINA_UNUSED) { - if (efl_player_play_get(obj)) + if (!efl_player_paused_get(obj)) elm_video_pause(obj); else elm_video_play(obj); @@ -327,15 +327,17 @@ _efl_ui_video_emotion_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) return sd->emotion; } -EOLIAN static void -_efl_ui_video_efl_player_play_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool play) +EOLIAN static Eina_Bool +_efl_ui_video_efl_player_paused_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool paused) { - if (emotion_object_play_get(sd->emotion) == !!play) return; + paused = !!paused; + /* can't pause if we're stopped */ + if (sd->stop) return EINA_FALSE; + if (emotion_object_play_get(sd->emotion) == !paused) return EINA_TRUE; - if (play) + if (!paused) { ELM_SAFE_FREE(sd->timer, ecore_timer_del); - sd->stop = EINA_FALSE; emotion_object_play_set(sd->emotion, EINA_TRUE); if(elm_widget_is_legacy(obj)) @@ -356,6 +358,7 @@ _efl_ui_video_efl_player_play_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool play else elm_layout_signal_emit(obj, "efl,video,pause", "efl"); } + return EINA_TRUE; } /* FIXME: stop should go into hibernate state directly. @@ -397,9 +400,10 @@ _efl_ui_video_efl_player_playing_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Dat } EOLIAN static Eina_Bool -_efl_ui_video_efl_player_play_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) +_efl_ui_video_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd) { - return emotion_object_play_get(sd->emotion); + /* pause is when !playing and !stopped */ + return !emotion_object_play_get(sd->emotion) && !sd->stop; } EOLIAN static const char* @@ -533,13 +537,16 @@ elm_video_play_position_get(const Evas_Object *obj) EAPI Eina_Bool elm_video_is_playing_get(Evas_Object *obj) { - return efl_player_play_get(obj); + return efl_player_playing_get(obj) && !efl_player_paused_get(obj); } EAPI void elm_video_play(Evas_Object *obj) { - efl_player_play_set(obj, EINA_TRUE); + if (efl_player_playing_get(obj)) + efl_player_paused_set(obj, EINA_FALSE); + else + efl_player_playing_set(obj, EINA_TRUE); } EAPI void @@ -551,7 +558,7 @@ elm_video_stop(Evas_Object *obj) EAPI void elm_video_pause(Evas_Object *obj) { - efl_player_play_set(obj, EINA_FALSE); + efl_player_paused_set(obj, EINA_TRUE); } #include "efl_ui_video_legacy_eo.c" diff --git a/src/lib/elementary/efl_ui_video.eo b/src/lib/elementary/efl_ui_video.eo index 77a550c68f..d585a0c634 100644 --- a/src/lib/elementary/efl_ui_video.eo +++ b/src/lib/elementary/efl_ui_video.eo @@ -44,6 +44,6 @@ class @beta Efl.Ui.Video extends Efl.Ui.Layout_Base Efl.Ui.Widget.widget_input_event_handler; Efl.Access.Widget.Action.elm_actions { get; } Efl.Player.playing { get; set; } - Efl.Player.play { get; set; } + Efl.Player.paused { get; set; } } } diff --git a/src/lib/elementary/efl_ui_widget_image.h b/src/lib/elementary/efl_ui_widget_image.h index 7c775f0868..ad31ef33e9 100644 --- a/src/lib/elementary/efl_ui_widget_image.h +++ b/src/lib/elementary/efl_ui_widget_image.h @@ -96,7 +96,7 @@ struct _Efl_Ui_Image_Data Eina_Bool edit : 1; Eina_Bool edje : 1; Eina_Bool anim : 1; - Eina_Bool play : 1; + Eina_Bool paused : 1; Eina_Bool async_enable : 1; Eina_Bool scale_up : 1; Eina_Bool scale_down : 1; diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo index d8bb286fd3..21bb8a362a 100644 --- a/src/lib/emotion/efl_canvas_video.eo +++ b/src/lib/emotion/efl_canvas_video.eo @@ -57,7 +57,8 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group Efl.File.unload; Efl.File.file { set; } Efl.File.loaded { get; } - Efl.Player.play { get; set; } + Efl.Player.playing { get; set; } + Efl.Player.paused { get; set; } Efl.Player.playback_position { get; set; } Efl.Player.progress { get; } Efl.Audio_Control.volume { get; set; } diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index e5183ea1ea..5569e54be6 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -116,6 +116,7 @@ struct _Efl_Canvas_Video_Data Eina_Bool open : 1; Eina_Bool play : 1; + Eina_Bool pause : 1; Eina_Bool remember_play : 1; Eina_Bool seek : 1; Eina_Bool seeking : 1; @@ -645,40 +646,85 @@ emotion_object_keep_aspect_get(const Evas_Object *obj) EAPI void emotion_object_play_set(Evas_Object *obj, Eina_Bool play) { - efl_player_play_set(obj, play); + /* avoid calling playback_position_set(0) for legacy */ + if (play) + efl_player_playing_set(obj, EINA_TRUE); + efl_player_paused_set(obj, !play); } -EOLIAN static void -_efl_canvas_video_efl_player_play_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool play) +EOLIAN static Eina_Bool +_efl_canvas_video_efl_player_playing_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool play) { + play = !!play; DBG("play=" FMT_UCHAR ", was=" FMT_UCHAR, play, sd->play); - if (!sd->engine_instance) return; + if (!sd->engine_instance) return EINA_FALSE; + /* always unset pause if playing is false */ + if (!play) sd->pause = EINA_FALSE; if (!sd->open) { sd->remember_play = play; - return; + return EINA_TRUE; } - if (play == sd->play) return; + if (play == sd->play) return EINA_TRUE; sd->play = play; sd->remember_play = play; if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP); - if (sd->play) emotion_engine_instance_play(sd->engine_instance, sd->pos); - else emotion_engine_instance_stop(sd->engine_instance); + if (sd->play) emotion_engine_instance_play(sd->engine_instance, 0.0); + else + { + emotion_engine_instance_stop(sd->engine_instance); + efl_player_playback_position_set(obj, 0.0); + } + return EINA_TRUE; +} + +EOLIAN static Eina_Bool +_efl_canvas_video_efl_player_paused_set(Eo *obj, Efl_Canvas_Video_Data *sd, Eina_Bool paused) +{ + paused = !!paused; + DBG("paused=" FMT_UCHAR ", was=" FMT_UCHAR, paused, sd->pause); + if (!sd->engine_instance) return EINA_FALSE; + if (!sd->open) + { + /* queue pause */ + if (sd->remember_play) + sd->pause = paused; + return sd->remember_play; + } + if (!sd->play) return EINA_FALSE; + if (paused == sd->pause) return EINA_TRUE; + sd->pause = paused; + if (sd->pause) + emotion_engine_instance_stop(sd->engine_instance); + else + { + if (sd->state != EMOTION_WAKEUP) emotion_object_suspend_set(obj, EMOTION_WAKEUP); + emotion_engine_instance_play(sd->engine_instance, sd->pos); + } + return EINA_TRUE; } EAPI Eina_Bool emotion_object_play_get(const Evas_Object *obj) { - return efl_player_play_get(obj); + return efl_player_playing_get(obj) && !efl_player_paused_get(obj); } EOLIAN static Eina_Bool -_efl_canvas_video_efl_player_play_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_player_playing_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { if (!sd->engine_instance) return EINA_FALSE; return sd->play; } +EOLIAN static Eina_Bool +_efl_canvas_video_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +{ + if (!sd->engine_instance) return EINA_FALSE; + if (!sd->play) return EINA_FALSE; + return sd->pause; +} + EAPI void emotion_object_position_set(Evas_Object *obj, double sec) { @@ -1632,7 +1678,12 @@ _emotion_open_done(Evas_Object *obj) if (!EINA_DBL_EQ(sd->remember_jump, 0.0)) emotion_object_position_set(obj, sd->remember_jump); if (sd->remember_play != sd->play) - emotion_object_play_set(obj, sd->remember_play); + { + if (sd->pause) + sd->play = sd->remember_play; + else + emotion_object_play_set(obj, sd->remember_play); + } efl_event_callback_call(obj, EFL_CANVAS_VIDEO_EVENT_OPEN_DONE, NULL); evas_object_smart_callback_call(obj, "open_done", NULL); } diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c index 981ece8b80..45c3be5859 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.c +++ b/src/lib/evas/canvas/efl_canvas_animation_player.c @@ -222,35 +222,25 @@ _player_stop(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Efl_Canvas_Animat //Reset the state of the target to the initial state efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj)); - Eina_Bool play = efl_player_play_get(eo_obj); - if (play) + if (efl_animation_final_state_keep_get(anim)) { - efl_player_play_set(eo_obj, EINA_FALSE); - if (efl_animation_final_state_keep_get(anim)) + if (_is_final_state(anim, pd->progress)) { - if (_is_final_state(anim, pd->progress)) - { - /* Keep the final state only if efl_player_stop is called at - * the end of _animator_cb. */ - efl_animation_apply(anim, pd->progress, - efl_animation_player_target_get(eo_obj)); - } - else - { - pd->progress = 0.0; - } + /* Keep the final state only if efl_player_playing_set(EINA_FALSE) is called at + * the end of _animator_cb. */ + efl_animation_apply(anim, pd->progress, + efl_animation_player_target_get(eo_obj)); } else { pd->progress = 0.0; } - efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL); } else { pd->progress = 0.0; } - + efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL); if (pd->auto_del) efl_del(eo_obj); } @@ -266,6 +256,8 @@ _efl_canvas_animation_player_efl_player_playing_set(Eo *eo_obj, Efl_Canvas_Anima pd->is_play = !!playing; if (!playing) { + if (!pd->is_play) return EINA_TRUE; + pd->is_paused = EINA_FALSE; _player_stop(eo_obj, pd, anim); return EINA_TRUE; } @@ -290,19 +282,20 @@ _efl_canvas_animation_player_efl_player_playing_get(const Eo *eo_obj EINA_UNUSED return pd->is_play; } -EOLIAN static void -_efl_canvas_animation_player_efl_player_play_set(Eo *eo_obj, +EOLIAN static Eina_Bool +_efl_canvas_animation_player_efl_player_paused_set(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, - Eina_Bool play) + Eina_Bool paused) { - if (efl_player_play_get(eo_obj) == !!play) - return; - - pd->is_play = play; - if (play) + paused = !!paused; + /* can't pause if not playing */ + if (!pd->is_play) return EINA_FALSE; + if (pd->is_paused == paused) return EINA_TRUE; + pd->is_paused = paused; + if (!paused) { //TODO: check this case is correct. - if (pd->start_delay_timer) return; + if (pd->start_delay_timer) return EINA_FALSE; pd->time.prev = ecore_loop_time_get(); pd->animator = ecore_evas_animator_add(pd->target, _animator_cb, eo_obj); @@ -316,13 +309,14 @@ _efl_canvas_animation_player_efl_player_play_set(Eo *eo_obj, ecore_animator_del(pd->animator); pd->animator = NULL; } + return EINA_TRUE; } EOLIAN static Eina_Bool -_efl_canvas_animation_player_efl_player_play_get(const Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_player_paused_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd) { - return pd->is_play; + return pd->is_paused; } EOLIAN static Eina_Bool diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.eo b/src/lib/evas/canvas/efl_canvas_animation_player.eo index 57e13f1035..4bcdf60b9b 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.eo +++ b/src/lib/evas/canvas/efl_canvas_animation_player.eo @@ -36,7 +36,7 @@ class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player Efl.Object.constructor; Efl.Object.destructor; Efl.Player.playing { get; set; } - Efl.Player.play { get; set; } + Efl.Player.paused { get; set; } Efl.Playable.playable { get; } Efl.Player.playback_position { get; set; } Efl.Player.progress { get;} diff --git a/src/lib/evas/canvas/efl_canvas_animation_player_private.h b/src/lib/evas/canvas/efl_canvas_animation_player_private.h index f0128aaa74..aff74db408 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player_private.h +++ b/src/lib/evas/canvas/efl_canvas_animation_player_private.h @@ -41,6 +41,7 @@ typedef struct _Efl_Canvas_Animation_Player_Data Eina_Bool auto_del : 1; Eina_Bool is_play : 1; + Eina_Bool is_paused : 1; Eina_Bool keep_final_state : 1; Eina_Bool is_direction_forward : 1; } Efl_Canvas_Animation_Player_Data; diff --git a/src/lib/evas/canvas/evas_object_intercept.c b/src/lib/evas/canvas/evas_object_intercept.c index 5729493e99..9911a5b1f3 100644 --- a/src/lib/evas/canvas/evas_object_intercept.c +++ b/src/lib/evas/canvas/evas_object_intercept.c @@ -107,7 +107,7 @@ _evas_object_intercept_call_internal(Evas_Object *eo_obj, /* If show is called during hide animation is running, then the * current hide animation is cancelled and show operation is * proceeded. */ - if ((!obj->anim_player) || (!efl_player_play_get(obj->anim_player))) + if ((!obj->anim_player) || (!efl_player_playing_get(obj->anim_player))) return 1; } if (!obj->interceptors) return 0; From b730443e2dfa8d7092ef51212856c1d7054f0272 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 14:16:13 -0400 Subject: [PATCH 056/115] efl/player: play_speed -> playback_speed no functional changes ref T7877 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10115 --- src/lib/edje/edje_legacy.c | 4 ++-- src/lib/edje/edje_smart.c | 4 ++-- src/lib/edje/efl_canvas_layout.eo | 4 ++-- src/lib/edje/efl_canvas_layout_eo.legacy.h | 4 ++-- src/lib/efl/interfaces/efl_player.eo | 2 +- src/lib/evas/canvas/efl_canvas_animation_player.c | 4 ++-- src/lib/evas/canvas/efl_canvas_animation_player.eo | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c index 5f04ead424..a93ed061a6 100644 --- a/src/lib/edje/edje_legacy.c +++ b/src/lib/edje/edje_legacy.c @@ -1215,13 +1215,13 @@ EAPI void edje_object_transition_duration_factor_set(Evas_Object *obj, double scale) { if (scale <= 0.0) return; - efl_player_play_speed_set(obj, 1.0/scale); + efl_player_playback_speed_set(obj, 1.0/scale); } EAPI double edje_object_transition_duration_factor_get(const Evas_Object *obj) { - double speed = efl_player_play_speed_get(obj); + double speed = efl_player_playback_speed_get(obj); if (speed <= 0.0) speed = 1.0; return 1.0/speed; diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index c0b37dbdc1..de2575c6a6 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -588,14 +588,14 @@ _efl_canvas_layout_efl_player_paused_get(const Eo *obj EINA_UNUSED, Edje *ed) } EOLIAN void -_efl_canvas_layout_efl_player_play_speed_set(Eo *obj EINA_UNUSED, Edje *pd , double speed) +_efl_canvas_layout_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Edje *pd , double speed) { if (speed <= 0.0) speed = 1.0; pd->duration_scale = 1.0/speed; } EOLIAN double -_efl_canvas_layout_efl_player_play_speed_get(const Eo *obj EINA_UNUSED, Edje *pd) +_efl_canvas_layout_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Edje *pd) { return 1.0/pd->duration_scale; } diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo index 5a9f0ac237..f037f31c44 100644 --- a/src/lib/edje/efl_canvas_layout.eo +++ b/src/lib/edje/efl_canvas_layout.eo @@ -18,7 +18,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl. If animations are disabled, transitions between states (as defined in EDC) are then instantaneous. This is conceptually similar - to setting the @Efl.Player.play_speed to an infinitely high + to setting the @Efl.Player.playback_speed to an infinitely high value. ]] get { @@ -128,6 +128,6 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl. Efl.Observer.update; Efl.Playable.playable { get; } Efl.Player.paused { get; set; } - Efl.Player.play_speed { get; set; } + Efl.Player.playback_speed { get; set; } } } diff --git a/src/lib/edje/efl_canvas_layout_eo.legacy.h b/src/lib/edje/efl_canvas_layout_eo.legacy.h index 0155eb96b2..057bd77e93 100644 --- a/src/lib/edje/efl_canvas_layout_eo.legacy.h +++ b/src/lib/edje/efl_canvas_layout_eo.legacy.h @@ -22,7 +22,7 @@ typedef Eo Efl_Canvas_Layout; * * If animations are disabled, transitions between states (as defined in EDC) * are then instantaneous. This is conceptually similar to setting the - * @ref Efl.Player.play_speed to an infinitely high value. + * @ref Efl.Player.playback_speed to an infinitely high value. * * Start or stop animating this object. * @@ -41,7 +41,7 @@ EAPI void edje_object_animation_set(Efl_Canvas_Layout *obj, Eina_Bool on); * * If animations are disabled, transitions between states (as defined in EDC) * are then instantaneous. This is conceptually similar to setting the - * @ref Efl.Player.play_speed to an infinitely high value. + * @ref Efl.Player.playback_speed to an infinitely high value. * * Get the current state of animation, @c true by default. * diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index bf100a2b1d..a79c9b965f 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -69,7 +69,7 @@ interface @beta Efl.Player progress: double; [[The progress within the [0, 1] range.]] } } - @property play_speed { + @property playback_speed { [[Control the play speed of the media file. This function control the speed with which the media file will diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c index 45c3be5859..7db178754e 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.c +++ b/src/lib/evas/canvas/efl_canvas_animation_player.c @@ -367,7 +367,7 @@ _efl_canvas_animation_player_efl_player_progress_get(const Eo *eo_obj EINA_UNUSE } EOLIAN static void -_efl_canvas_animation_player_efl_player_play_speed_set(Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_player_playback_speed_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd, double play_speed) { @@ -378,7 +378,7 @@ _efl_canvas_animation_player_efl_player_play_speed_set(Eo *eo_obj EINA_UNUSED, } EOLIAN static double -_efl_canvas_animation_player_efl_player_play_speed_get(const Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_player_playback_speed_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd) { return pd->play_speed; diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.eo b/src/lib/evas/canvas/efl_canvas_animation_player.eo index 4bcdf60b9b..2b716fc2c0 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.eo +++ b/src/lib/evas/canvas/efl_canvas_animation_player.eo @@ -40,7 +40,7 @@ class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player Efl.Playable.playable { get; } Efl.Player.playback_position { get; set; } Efl.Player.progress { get;} - Efl.Player.play_speed { get; set; } + Efl.Player.playback_speed { get; set; } //Efl.Player.volume { get; set; } //Efl.Player.mute { get; set; } Efl.Playable.length { get; } From 4b9d85173b99e2b13d763dc0c878eabb07b379f0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 14:21:04 -0400 Subject: [PATCH 057/115] efl/player: progress -> playback_progress no functional changes ref T7877 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10116 --- src/lib/efl/interfaces/efl_player.eo | 2 +- src/lib/emotion/efl_canvas_video.eo | 2 +- src/lib/emotion/emotion_smart.c | 4 ++-- src/lib/evas/canvas/efl_canvas_animation_player.c | 4 ++-- src/lib/evas/canvas/efl_canvas_animation_player.eo | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index a79c9b965f..5e991aea6e 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -57,7 +57,7 @@ interface @beta Efl.Player sec: double; [[The position (in seconds).]] } } - @property progress { + @property playback_progress { [[How much of the file has been played. This function gets the progress in playing the file, the diff --git a/src/lib/emotion/efl_canvas_video.eo b/src/lib/emotion/efl_canvas_video.eo index 21bb8a362a..162e0fcc27 100644 --- a/src/lib/emotion/efl_canvas_video.eo +++ b/src/lib/emotion/efl_canvas_video.eo @@ -60,7 +60,7 @@ class @beta Efl.Canvas.Video extends Efl.Canvas.Group Efl.Player.playing { get; set; } Efl.Player.paused { get; set; } Efl.Player.playback_position { get; set; } - Efl.Player.progress { get; } + Efl.Player.playback_progress { get; } Efl.Audio_Control.volume { get; set; } Efl.Audio_Control.mute { get; set; } Efl.Playable.length { get; } diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index 5569e54be6..9a86bfd689 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -1207,11 +1207,11 @@ emotion_object_progress_info_get(const Evas_Object *obj) EAPI double emotion_object_progress_status_get(const Evas_Object *obj) { - return efl_player_progress_get(obj); + return efl_player_playback_progress_get(obj); } EOLIAN static double -_efl_canvas_video_efl_player_progress_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) +_efl_canvas_video_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Video_Data *sd) { return sd->progress.stat; } diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c index 7db178754e..5e2d4046a0 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.c +++ b/src/lib/evas/canvas/efl_canvas_animation_player.c @@ -336,7 +336,7 @@ _efl_canvas_animation_player_efl_player_playback_position_get(const Eo *eo_obj, Efl_Canvas_Animation *anim = efl_animation_player_animation_get(eo_obj); double length = efl_animation_duration_get(anim); - return length * efl_player_progress_get(eo_obj); + return length * efl_player_playback_progress_get(eo_obj); } EOLIAN static void @@ -360,7 +360,7 @@ _efl_canvas_animation_player_efl_player_playback_position_set(Eo *eo_obj, } EOLIAN static double -_efl_canvas_animation_player_efl_player_progress_get(const Eo *eo_obj EINA_UNUSED, +_efl_canvas_animation_player_efl_player_playback_progress_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd) { return pd->progress; diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.eo b/src/lib/evas/canvas/efl_canvas_animation_player.eo index 2b716fc2c0..361dfcbad5 100644 --- a/src/lib/evas/canvas/efl_canvas_animation_player.eo +++ b/src/lib/evas/canvas/efl_canvas_animation_player.eo @@ -39,7 +39,7 @@ class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player Efl.Player.paused { get; set; } Efl.Playable.playable { get; } Efl.Player.playback_position { get; set; } - Efl.Player.progress { get;} + Efl.Player.playback_progress { get;} Efl.Player.playback_speed { get; set; } //Efl.Player.volume { get; set; } //Efl.Player.mute { get; set; } From 189c9a16a40e294c921462af447bb9f21c6f2ab9 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 14:21:29 -0400 Subject: [PATCH 058/115] efl/player: improve docs some doc improvements ref T7877 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10117 --- src/lib/efl/interfaces/efl_player.eo | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 5e991aea6e..269c41b1d4 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -9,8 +9,11 @@ interface @beta Efl.Player This property sets the playback state of the object. Re-setting the current playback state has no effect. - If set to $false, the object's @.progress property is reset to $0.0. Applying - the $false playing state also has the same effect as the player object reaching + If set to $false, the object's @.playback_progress property is, by default, reset to $0.0. A + class may alter this behavior, and it will be stated in the documentation for a class + if such behavior changes should be expected. + + Applying the $false playing state also has the same effect as the player object reaching the end of its playback, which may invoke additional behavior based on a class's implementation. ]] @@ -30,7 +33,8 @@ interface @beta Efl.Player pause state has no effect. If @.playing is set to $true, this property can be used to pause and resume - playback of the media without changing its @.progress property. + playback of the media without changing its @.playback_progress property. This property + cannot be changed if @.playing is $false. ]] set { return: bool(false); [[If $true, the property change has succeeded.]] @@ -47,7 +51,7 @@ interface @beta Efl.Player This property sets the current position of the media file to $sec seconds since the beginning of the media file. This only works on seekable streams. Setting the - position doesn't change the playing state of the media file. + position doesn't change the @.playing or @.paused states of the media file. ]] set { } @@ -70,7 +74,7 @@ interface @beta Efl.Player } } @property playback_speed { - [[Control the play speed of the media file. + [[Control the playback speed of the media file. This function control the speed with which the media file will be played. 1.0 represents the normal speed, 2 double speed, 0.5 From e4ce41d6a698866850f398e59d5aa48ff479fb2b Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 15:27:24 -0400 Subject: [PATCH 059/115] efl_ui/image: implement required efl.player::playback_position methods Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10119 --- src/lib/elementary/efl_ui_image.c | 24 +++++++++++++++++++++ src/lib/elementary/efl_ui_image.eo | 1 + src/lib/elementary/efl_ui_image_zoomable.c | 24 +++++++++++++++++++++ src/lib/elementary/efl_ui_image_zoomable.eo | 1 + 4 files changed, 50 insertions(+) diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 3047787ea1..b2347c64ff 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -1809,6 +1809,30 @@ _efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd) return _efl_ui_image_animated_get_internal(obj, sd); } +EOLIAN static void +_efl_ui_image_efl_player_playback_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double sec) +{ + EINA_SAFETY_ON_TRUE_RETURN(sec < 0.0); + if (sd->edje) + efl_player_playback_position_set(sd->img, sec); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + { + /* validate total animation time */ + EINA_SAFETY_ON_TRUE_RETURN(sd->frame_count * sd->frame_duration < sec); + sd->cur_frame = lround(sec / sd->frame_duration); + } +} + +EOLIAN static double +_efl_ui_image_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +{ + if (sd->edje) + efl_player_playback_position_get(sd->img); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + return sd->cur_frame * sd->frame_duration; + return 0.0; +} + static Eina_Bool _efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused) { diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 6ea6b27266..ced215a3d1 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -100,6 +100,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. Efl.Playable.playable { get; } Efl.Player.playing { get; set; } Efl.Player.paused { get; set; } + Efl.Player.playback_position { get; set; } Efl.Layout.Signal.signal_emit; Efl.Layout.Signal.message_send; Efl.Layout.Signal.signal_callback_add; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 129619aa9d..07956ee5d9 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -3126,6 +3126,30 @@ _efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_I return sd->paused; } +EOLIAN static void +_efl_ui_image_zoomable_efl_player_playback_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, double sec) +{ + EINA_SAFETY_ON_TRUE_RETURN(sec < 0.0); + if (sd->edje) + efl_player_playback_position_set(sd->edje, sec); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + { + /* validate total animation time */ + EINA_SAFETY_ON_TRUE_RETURN(sd->frame_count * sd->frame_duration < sec); + sd->cur_frame = lround(sec / sd->frame_duration); + } +} + +EOLIAN static double +_efl_ui_image_zoomable_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + if (sd->edje) + efl_player_playback_position_get(sd->edje); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + return sd->cur_frame * sd->frame_duration; + return 0.0; +} + EOLIAN static void _efl_ui_image_zoomable_class_constructor(Efl_Class *klass EINA_UNUSED) { diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index bed8b367df..52df2c3f0c 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -46,6 +46,7 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Playable.playable { get; } Efl.Player.playing { get; set; } Efl.Player.paused { get; set; } + Efl.Player.playback_position { get; set; } Efl.Ui.Zoom.zoom_animation { set; get; } Efl.Ui.Zoom.zoom_level { set; get; } Efl.Ui.Zoom.zoom_mode { set; get; } From 5555c8e8796c41698fa2d52f759e5d403b4aaba3 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 15:30:11 -0400 Subject: [PATCH 060/115] efl_ui/image: implement efl.player::playback_progress method Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10120 --- src/lib/elementary/efl_ui_image.c | 10 ++++++++++ src/lib/elementary/efl_ui_image.eo | 1 + src/lib/elementary/efl_ui_image_zoomable.c | 10 ++++++++++ src/lib/elementary/efl_ui_image_zoomable.eo | 1 + 4 files changed, 22 insertions(+) diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index b2347c64ff..4052bacca7 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -1833,6 +1833,16 @@ _efl_ui_image_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Ui return 0.0; } +EOLIAN static double +_efl_ui_image_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +{ + if (sd->edje) + efl_player_playback_progress_get(sd->img); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + return (sd->cur_frame * sd->frame_duration) / sd->frame_count; + return 0.0; +} + static Eina_Bool _efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused) { diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index ced215a3d1..5d32abdfeb 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -101,6 +101,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. Efl.Player.playing { get; set; } Efl.Player.paused { get; set; } Efl.Player.playback_position { get; set; } + Efl.Player.playback_progress { get; } Efl.Layout.Signal.signal_emit; Efl.Layout.Signal.message_send; Efl.Layout.Signal.signal_callback_add; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 07956ee5d9..2c886c2777 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -3150,6 +3150,16 @@ _efl_ui_image_zoomable_efl_player_playback_position_get(const Eo *obj EINA_UNUSE return 0.0; } +EOLIAN static double +_efl_ui_image_zoomable_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + if (sd->edje) + efl_player_playback_progress_get(sd->edje); + else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) + return (sd->cur_frame * sd->frame_duration) / sd->frame_count; + return 0.0; +} + EOLIAN static void _efl_ui_image_zoomable_class_constructor(Efl_Class *klass EINA_UNUSED) { diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 52df2c3f0c..40dca930c5 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -47,6 +47,7 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Player.playing { get; set; } Efl.Player.paused { get; set; } Efl.Player.playback_position { get; set; } + Efl.Player.playback_progress { get; } Efl.Ui.Zoom.zoom_animation { set; get; } Efl.Ui.Zoom.zoom_level { set; get; } Efl.Ui.Zoom.zoom_mode { set; get; } From 3e7b7a47e766c1a597aa639854769f697e4d8e0e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 15:43:00 -0400 Subject: [PATCH 061/115] efl_ui/image: implement efl.player::playback_speed methods Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10121 --- src/lib/elementary/efl_ui_image.c | 29 +++++++++++++++-- src/lib/elementary/efl_ui_image.eo | 1 + src/lib/elementary/efl_ui_image_zoomable.c | 31 ++++++++++++++++--- src/lib/elementary/efl_ui_image_zoomable.eo | 1 + .../efl_ui_image_zoomable_private.h | 1 + src/lib/elementary/efl_ui_widget_image.h | 1 + 6 files changed, 57 insertions(+), 7 deletions(-) diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 4052bacca7..ade335b3ee 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -141,7 +141,7 @@ _efl_ui_image_animate_cb(void *data) (sd->img, sd->cur_frame, 0); if (sd->frame_duration > 0) - ecore_timer_interval_set(sd->anim_timer, sd->frame_duration); + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration * sd->playback_speed); return ECORE_CALLBACK_RENEW; } @@ -873,6 +873,7 @@ _efl_ui_image_efl_object_constructor(Eo *obj, Efl_Ui_Image_Data *pd) pd->self = obj; /* legacy elm_image starts paused */ pd->paused = elm_widget_is_legacy(obj); + pd->playback_speed = 1; return obj; } @@ -1761,7 +1762,7 @@ _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool an evas_object_image_animated_frame_set(sd->img, sd->cur_frame); if (!sd->paused)//legacy sd->anim_timer = ecore_timer_add - (sd->frame_duration, _efl_ui_image_animate_cb, obj); + (sd->frame_duration * sd->playback_speed, _efl_ui_image_animate_cb, obj); } else { @@ -1809,6 +1810,28 @@ _efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd) return _efl_ui_image_animated_get_internal(obj, sd); } +EOLIAN static void +_efl_ui_image_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double factor) +{ + EINA_SAFETY_ON_TRUE_RETURN(factor < 0.0); + EINA_SAFETY_ON_TRUE_RETURN(EINA_DBL_EQ(factor, 0.0)); + if (EINA_DBL_EQ(sd->playback_speed, factor)) return; + sd->playback_speed = factor; + if (sd->edje) + efl_player_playback_speed_set(sd->img, factor); + else if (sd->anim_timer) + { + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration * sd->playback_speed); + ecore_timer_reset(sd->anim_timer); + } +} + +EOLIAN static double +_efl_ui_image_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +{ + return sd->playback_speed; +} + EOLIAN static void _efl_ui_image_efl_player_playback_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double sec) { @@ -1858,7 +1881,7 @@ _efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_ if (!paused) { sd->anim_timer = ecore_timer_add - (sd->frame_duration, _efl_ui_image_animate_cb, obj); + (sd->frame_duration * sd->playback_speed, _efl_ui_image_animate_cb, obj); } else { diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 5d32abdfeb..f4a8dbcb32 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -102,6 +102,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. Efl.Player.paused { get; set; } Efl.Player.playback_position { get; set; } Efl.Player.playback_progress { get; } + Efl.Player.playback_speed { get; set; } Efl.Layout.Signal.signal_emit; Efl.Layout.Signal.message_send; Efl.Layout.Signal.signal_callback_add; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 2c886c2777..b14bace8a2 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -1938,12 +1938,13 @@ _efl_ui_image_zoomable_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_Image_Z } EOLIAN static Eo * -_efl_ui_image_zoomable_efl_object_constructor(Eo *obj, Efl_Ui_Image_Zoomable_Data *_pd EINA_UNUSED) +_efl_ui_image_zoomable_efl_object_constructor(Eo *obj, Efl_Ui_Image_Zoomable_Data *pd) { obj = efl_constructor(efl_super(obj, MY_CLASS)); evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); efl_access_object_role_set(obj, EFL_ACCESS_ROLE_IMAGE); legacy_object_focus_handle(obj); + pd->playback_speed = 1; return obj; } @@ -3034,7 +3035,7 @@ _efl_ui_image_zoomable_animate_cb(void *data) (sd->img, sd->cur_frame, 0); if (sd->frame_duration > 0) - ecore_timer_interval_set(sd->anim_timer, sd->frame_duration); + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration * sd->playback_speed); return ECORE_CALLBACK_RENEW; } @@ -3064,7 +3065,7 @@ _efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Z evas_object_image_animated_frame_set(sd->img, sd->cur_frame); if (!sd->paused)//legacy sd->anim_timer = ecore_timer_add - (sd->frame_duration, _efl_ui_image_zoomable_animate_cb, obj); + (sd->frame_duration * sd->playback_speed, _efl_ui_image_zoomable_animate_cb, obj); } else { @@ -3091,7 +3092,7 @@ _efl_ui_image_zoomable_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Zoomab if (!paused) { sd->anim_timer = ecore_timer_add - (sd->frame_duration, _efl_ui_image_zoomable_animate_cb, obj); + (sd->frame_duration * sd->playback_speed, _efl_ui_image_zoomable_animate_cb, obj); } else { @@ -3126,6 +3127,28 @@ _efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_I return sd->paused; } +EOLIAN static void +_efl_ui_image_zoomable_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, double factor) +{ + EINA_SAFETY_ON_TRUE_RETURN(factor < 0.0); + EINA_SAFETY_ON_TRUE_RETURN(EINA_DBL_EQ(factor, 0.0)); + if (EINA_DBL_EQ(sd->playback_speed, factor)) return; + sd->playback_speed = factor; + if (sd->edje) + efl_player_playback_speed_set(sd->edje, factor); + else if (sd->anim_timer) + { + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration * sd->playback_speed); + ecore_timer_reset(sd->anim_timer); + } +} + +EOLIAN static double +_efl_ui_image_zoomable_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + return sd->playback_speed; +} + EOLIAN static void _efl_ui_image_zoomable_efl_player_playback_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, double sec) { diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 40dca930c5..945cfaba04 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -48,6 +48,7 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Player.paused { get; set; } Efl.Player.playback_position { get; set; } Efl.Player.playback_progress { get; } + Efl.Player.playback_speed { get; set; } Efl.Ui.Zoom.zoom_animation { set; get; } Efl.Ui.Zoom.zoom_level { set; get; } Efl.Ui.Zoom.zoom_mode { set; get; } diff --git a/src/lib/elementary/efl_ui_image_zoomable_private.h b/src/lib/elementary/efl_ui_image_zoomable_private.h index f2833c838c..e892c1f63c 100644 --- a/src/lib/elementary/efl_ui_image_zoomable_private.h +++ b/src/lib/elementary/efl_ui_image_zoomable_private.h @@ -125,6 +125,7 @@ struct _Efl_Ui_Image_Zoomable_Data Ecore_Timer *anim_timer; double frame_duration; + double playback_speed; int cur_frame; int frame_count; diff --git a/src/lib/elementary/efl_ui_widget_image.h b/src/lib/elementary/efl_ui_widget_image.h index ad31ef33e9..de625b28b4 100644 --- a/src/lib/elementary/efl_ui_widget_image.h +++ b/src/lib/elementary/efl_ui_widget_image.h @@ -56,6 +56,7 @@ struct _Efl_Ui_Image_Data double scale; double frame_duration; + double playback_speed; double align_x, align_y; Eina_Size2D load_size; From 5ccf48355b82818294d0d54418e7ba9696ef5ebf Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 16:53:49 -0400 Subject: [PATCH 062/115] api: mark Efl.Player stable fix T7877 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10127 --- src/lib/efl/interfaces/efl_player.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index 269c41b1d4..e6425ee244 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Player +interface Efl.Player { [[Efl media player interface]] c_prefix: efl_player; From 2c4db3b09a06815783acc3d6946f94c2d3203d4d Mon Sep 17 00:00:00 2001 From: SangHyeon Jade Lee Date: Wed, 25 Sep 2019 16:39:30 +0900 Subject: [PATCH 063/115] efl_ui : reverse the select method name to be ended verb on the last. Summary: our new method naming rule only allow verb at the last position, so change name to fallow rule. Reviewers: bu5hm4n, cedric, segfaultxavi Reviewed By: bu5hm4n, segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10144 --- src/bin/elementary/test_ui_collection.c | 12 +++--- src/lib/elementary/efl_ui_collection.c | 8 ++-- src/lib/elementary/efl_ui_collection.eo | 8 ++-- src/lib/elementary/efl_ui_multi_selectable.eo | 8 ++-- .../efl_ui_multi_selectable_async.eo | 8 ++-- src/lib/elementary/efl_ui_select_model.c | 14 +++---- src/lib/elementary/efl_ui_select_model.eo | 8 ++-- .../spec/efl_test_multi_selectable.c | 40 +++++++++---------- 8 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/bin/elementary/test_ui_collection.c b/src/bin/elementary/test_ui_collection.c index ed98d2e377..f407a6988a 100644 --- a/src/bin/elementary/test_ui_collection.c +++ b/src/bin/elementary/test_ui_collection.c @@ -5,15 +5,15 @@ #include static void -_select_all(void *data, const Efl_Event *ev EINA_UNUSED) +_all_select(void *data, const Efl_Event *ev EINA_UNUSED) { - efl_ui_select_all(data); + efl_ui_all_select(data); } static void -_unselect_all(void *data, const Efl_Event *ev EINA_UNUSED) +_all_unselect(void *data, const Efl_Event *ev EINA_UNUSED) { - efl_ui_unselect_all(data); + efl_ui_all_unselect(data); } static void @@ -284,14 +284,14 @@ void create_item_container_ui(const Efl_Class *collection_class, const Efl_Class efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), efl_gfx_hint_align_set(efl_added, 0, 0.5)); efl_text_set(o, "Select All"); - efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _select_all, item_container); + efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _all_select, item_container); efl_pack_table(tbl, o, 0, 11, 1, 1); o = efl_add(EFL_UI_BUTTON_CLASS, tbl, efl_gfx_hint_weight_set(efl_added, 0.0, 0.0), efl_gfx_hint_align_set(efl_added, 0, 0.5)); efl_text_set(o, "Unselect All"); - efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _unselect_all, item_container); + efl_event_callback_add(o, EFL_INPUT_EVENT_CLICKED, _all_unselect, item_container); efl_pack_table(tbl, o, 0, 12, 1, 1); diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c index dde77ab9b0..b71b1af32c 100644 --- a/src/lib/elementary/efl_ui_collection.c +++ b/src/lib/elementary/efl_ui_collection.c @@ -1079,13 +1079,13 @@ _selectable_range_apply(Eina_List *start, Eina_Bool flag) } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_select_all(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) +_efl_ui_collection_efl_ui_multi_selectable_all_select(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) { _selectable_range_apply(pd->items, EINA_TRUE); } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_unselect_all(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) +_efl_ui_collection_efl_ui_multi_selectable_all_unselect(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) { _selectable_range_apply(pd->items, EINA_FALSE); } @@ -1125,13 +1125,13 @@ _range_selection_find(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_select_range(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) +_efl_ui_collection_efl_ui_multi_selectable_range_select(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) { _range_selection_find(obj, pd, a, b, EINA_TRUE); } EOLIAN static void -_efl_ui_collection_efl_ui_multi_selectable_unselect_range(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) +_efl_ui_collection_efl_ui_multi_selectable_range_unselect(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Selectable *a, Efl_Ui_Selectable *b) { _range_selection_find(obj, pd, a, b, EINA_FALSE); } diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo index 4a320c362a..507477c2bc 100644 --- a/src/lib/elementary/efl_ui_collection.eo +++ b/src/lib/elementary/efl_ui_collection.eo @@ -84,10 +84,10 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Ui.Single_Selectable.last_selected { get; } Efl.Ui.Multi_Selectable.selected_items_get; Efl.Ui.Multi_Selectable.select_mode {get; set;} - Efl.Ui.Multi_Selectable.select_all; - Efl.Ui.Multi_Selectable.unselect_all; - Efl.Ui.Multi_Selectable.select_range; - Efl.Ui.Multi_Selectable.unselect_range; + Efl.Ui.Multi_Selectable.all_select; + Efl.Ui.Multi_Selectable.all_unselect; + Efl.Ui.Multi_Selectable.range_select; + Efl.Ui.Multi_Selectable.range_unselect; Efl.Ui.Single_Selectable.fallback_selection {get; set;} } } diff --git a/src/lib/elementary/efl_ui_multi_selectable.eo b/src/lib/elementary/efl_ui_multi_selectable.eo index a3806c1608..fc10d3ad89 100644 --- a/src/lib/elementary/efl_ui_multi_selectable.eo +++ b/src/lib/elementary/efl_ui_multi_selectable.eo @@ -21,7 +21,7 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable [[Get the selected items in a iterator. The iterator sequence will be decided by selection.]] return: iterator @move @no_unused; [[User has to free the iterator after usage.]] } - select_range { + range_select { [[Select a range of @Efl.Ui.Selectable. This will select the range of selectables from a to b or from b to a depending on which one comes first. @@ -34,7 +34,7 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable b : Efl.Ui.Selectable; [[The other side of the range.]] } } - unselect_range { + range_unselect { [[Unselect a range of @Efl.Ui.Selectable. This will unselect the range of selectables from a to b or from b to a depending on which one comes first. @@ -47,10 +47,10 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable b : Efl.Ui.Selectable; [[The other side of the range.]] } } - select_all { + all_select { [[Select all @Efl.Ui.Selectable]] } - unselect_all { + all_unselect { [[Unselect all @Efl.Ui.Selectable]] } diff --git a/src/lib/elementary/efl_ui_multi_selectable_async.eo b/src/lib/elementary/efl_ui_multi_selectable_async.eo index 6f4ed14abe..0047ed9b00 100644 --- a/src/lib/elementary/efl_ui_multi_selectable_async.eo +++ b/src/lib/elementary/efl_ui_multi_selectable_async.eo @@ -29,7 +29,7 @@ interface @beta Efl.Ui.Multi_Selectable_Async extends Efl.Ui.Single_Selectable return: iterator @move @no_unused; [[The iterator gives indices of unselected children. It is valid until any change is made on the model.]] } - select_range { + range_select { [[Select a range of @Efl.Ui.Selectable. This will select the range of selectables from $a to $b or from $b to $a depending on which one comes first. @@ -41,7 +41,7 @@ interface @beta Efl.Ui.Multi_Selectable_Async extends Efl.Ui.Single_Selectable b : uint64; [[The other side of the range.]] } } - unselect_range { + range_unselect { [[Unselect a range of @Efl.Ui.Selectable. This will unselect the range of selectables from $a to $b or from $b to $a depending on which one comes first. @@ -53,10 +53,10 @@ interface @beta Efl.Ui.Multi_Selectable_Async extends Efl.Ui.Single_Selectable b : uint64; [[The other side of the range.]] } } - select_all { + all_select { [[Select all @Efl.Ui.Selectable]] } - unselect_all { + all_unselect { [[Unselect all @Efl.Ui.Selectable]] } } diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c index b969441bbc..c05d720667 100644 --- a/src/lib/elementary/efl_ui_select_model.c +++ b/src/lib/elementary/efl_ui_select_model.c @@ -501,11 +501,11 @@ _efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_set(Eo *obj, case EFL_UI_SELECT_MODE_SINGLE: mode = EFL_UI_SELECT_MODE_SINGLE; if (pd->selection == EFL_UI_SELECT_MODE_MULTI) - efl_ui_multi_selectable_async_unselect_all(obj); + efl_ui_multi_selectable_async_all_unselect(obj); break; case EFL_UI_SELECT_MODE_NONE: if (pd->selection == EFL_UI_SELECT_MODE_MULTI) - efl_ui_multi_selectable_async_unselect_all(obj); + efl_ui_multi_selectable_async_all_unselect(obj); else if (pd->last_model) { Eina_Value unselect = eina_value_bool_init(EINA_FALSE); @@ -533,7 +533,7 @@ _efl_ui_select_model_efl_ui_multi_selectable_async_select_mode_get(const Eo *obj } static void -_efl_ui_select_model_efl_ui_multi_selectable_async_select_all(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_async_all_select(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { unsigned long count, i; @@ -553,16 +553,16 @@ _efl_ui_select_model_efl_ui_multi_selectable_async_select_all(Eo *obj, } static void -_efl_ui_select_model_efl_ui_multi_selectable_async_unselect_all(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_async_all_unselect(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { uint64_t count = efl_model_children_count_get(obj); - efl_ui_multi_selectable_async_unselect_range(obj, 0, count - 1); + efl_ui_multi_selectable_async_range_unselect(obj, 0, count - 1); } static void -_efl_ui_select_model_efl_ui_multi_selectable_async_select_range(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_async_range_select(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED, uint64_t a, uint64_t b) { @@ -604,7 +604,7 @@ _children_unselect_then(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Va #define BATCH_MAX 100 static void -_efl_ui_select_model_efl_ui_multi_selectable_async_unselect_range(Eo *obj, +_efl_ui_select_model_efl_ui_multi_selectable_async_range_unselect(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED, uint64_t a, uint64_t b) { diff --git a/src/lib/elementary/efl_ui_select_model.eo b/src/lib/elementary/efl_ui_select_model.eo index 4d94d2fa61..7fa0f8411a 100644 --- a/src/lib/elementary/efl_ui_select_model.eo +++ b/src/lib/elementary/efl_ui_select_model.eo @@ -12,10 +12,10 @@ class @beta Efl.Ui.Select_Model extends Efl.Boolean_Model Efl.Ui.Multi_Selectable_Async.selected_iterator_new; Efl.Ui.Multi_Selectable_Async.unselected_iterator_new; Efl.Ui.Multi_Selectable_Async.select_mode {get; set;} - Efl.Ui.Multi_Selectable_Async.select_all; - Efl.Ui.Multi_Selectable_Async.unselect_all; - Efl.Ui.Multi_Selectable_Async.select_range; - Efl.Ui.Multi_Selectable_Async.unselect_range; + Efl.Ui.Multi_Selectable_Async.all_select; + Efl.Ui.Multi_Selectable_Async.all_unselect; + Efl.Ui.Multi_Selectable_Async.range_select; + Efl.Ui.Multi_Selectable_Async.range_unselect; Efl.Ui.Single_Selectable.fallback_selection {get; set;} Efl.Ui.Selectable.selected {get; set;} } diff --git a/src/tests/elementary/spec/efl_test_multi_selectable.c b/src/tests/elementary/spec/efl_test_multi_selectable.c index a2606a13b8..ac0e6424b7 100644 --- a/src/tests/elementary/spec/efl_test_multi_selectable.c +++ b/src/tests/elementary/spec/efl_test_multi_selectable.c @@ -151,12 +151,12 @@ EFL_START_TEST(test_none_select) } EFL_END_TEST -EFL_START_TEST(select_all_api) +EFL_START_TEST(all_select_api) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_all(widget); + efl_ui_all_select(widget); _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 3); @@ -167,14 +167,14 @@ EFL_START_TEST(select_all_api) } EFL_END_TEST -EFL_START_TEST(unselect_all_api) +EFL_START_TEST(all_unselect_api) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE); - efl_ui_unselect_all(widget); + efl_ui_all_unselect(widget); _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); @@ -182,40 +182,40 @@ EFL_START_TEST(unselect_all_api) } EFL_END_TEST -EFL_START_TEST(unselect_range) +EFL_START_TEST(range_unselect) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_all(widget); + efl_ui_all_select(widget); - efl_ui_unselect_range(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); + efl_ui_range_unselect(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); } EFL_END_TEST -EFL_START_TEST(unselect_range2) +EFL_START_TEST(range_unselect2) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_all(widget); + efl_ui_all_select(widget); - efl_ui_unselect_range(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); + efl_ui_range_unselect(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); } EFL_END_TEST -EFL_START_TEST(select_range) +EFL_START_TEST(range_select) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_range(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); + efl_ui_range_select(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); @@ -223,12 +223,12 @@ EFL_START_TEST(select_range) } EFL_END_TEST -EFL_START_TEST(select_range2) +EFL_START_TEST(range_select2) { Eina_Array *arr_selected; efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); - efl_ui_select_range(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); + efl_ui_range_select(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); @@ -244,11 +244,11 @@ efl_ui_multi_selectable_behavior_test(TCase *tc) tcase_add_test(tc, test_multi_select_removal); tcase_add_test(tc, test_single_select); tcase_add_test(tc, test_none_select); - tcase_add_test(tc, select_all_api); - tcase_add_test(tc, unselect_all_api); - tcase_add_test(tc, unselect_range); - tcase_add_test(tc, unselect_range2); - tcase_add_test(tc, select_range); - tcase_add_test(tc, select_range2); + tcase_add_test(tc, all_select_api); + tcase_add_test(tc, all_unselect_api); + tcase_add_test(tc, range_unselect); + tcase_add_test(tc, range_unselect2); + tcase_add_test(tc, range_select); + tcase_add_test(tc, range_select2); efl_ui_single_selectable_behavior_test(tc); } From 1c936631561a5ad3651ec1dcc17490b6e26707fa Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Wed, 25 Sep 2019 05:18:04 +0000 Subject: [PATCH 064/115] efl_ui_win: default window type change should not be applied to legacy one If my understanding is correct, below referenced commit needs to be applied to efl_ui_win only. @ref D10049 Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10143 --- src/lib/elementary/efl_ui_win.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 1dec90aa38..f79d4d1333 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -5960,7 +5960,7 @@ _efl_ui_win_efl_object_constructor(Eo *obj, Efl_Ui_Win_Data *pd) if (!efl_parent_get(obj)) efl_allow_parent_unref_set(obj, EINA_TRUE); - if (elm_widget_is_legacy(obj)) + if (!elm_widget_is_legacy(obj)) pd->type = EFL_UI_WIN_TYPE_BASIC; return obj; From 9b8dcf2f299dfd0cef481bfdfeade0cf3414fdc1 Mon Sep 17 00:00:00 2001 From: SangHyeon Jade Lee Date: Wed, 25 Sep 2019 07:50:06 +0000 Subject: [PATCH 065/115] efl_ui : put beta on range select/unselect as parameter unstable there are more discussion need on this range selection. we could extend this parameter with range structure(aka Eina.Range) so that extendable object to object, int to int, Range to Range. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10145 --- src/lib/elementary/efl_ui_multi_selectable.eo | 4 ++-- src/lib/elementary/efl_ui_multi_selectable_async.eo | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/efl_ui_multi_selectable.eo b/src/lib/elementary/efl_ui_multi_selectable.eo index fc10d3ad89..44b39942fe 100644 --- a/src/lib/elementary/efl_ui_multi_selectable.eo +++ b/src/lib/elementary/efl_ui_multi_selectable.eo @@ -21,7 +21,7 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable [[Get the selected items in a iterator. The iterator sequence will be decided by selection.]] return: iterator @move @no_unused; [[User has to free the iterator after usage.]] } - range_select { + range_select @beta { [[Select a range of @Efl.Ui.Selectable. This will select the range of selectables from a to b or from b to a depending on which one comes first. @@ -34,7 +34,7 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable b : Efl.Ui.Selectable; [[The other side of the range.]] } } - range_unselect { + range_unselect @beta { [[Unselect a range of @Efl.Ui.Selectable. This will unselect the range of selectables from a to b or from b to a depending on which one comes first. diff --git a/src/lib/elementary/efl_ui_multi_selectable_async.eo b/src/lib/elementary/efl_ui_multi_selectable_async.eo index 0047ed9b00..3a09682358 100644 --- a/src/lib/elementary/efl_ui_multi_selectable_async.eo +++ b/src/lib/elementary/efl_ui_multi_selectable_async.eo @@ -29,7 +29,7 @@ interface @beta Efl.Ui.Multi_Selectable_Async extends Efl.Ui.Single_Selectable return: iterator @move @no_unused; [[The iterator gives indices of unselected children. It is valid until any change is made on the model.]] } - range_select { + range_select @beta { [[Select a range of @Efl.Ui.Selectable. This will select the range of selectables from $a to $b or from $b to $a depending on which one comes first. @@ -41,7 +41,7 @@ interface @beta Efl.Ui.Multi_Selectable_Async extends Efl.Ui.Single_Selectable b : uint64; [[The other side of the range.]] } } - range_unselect { + range_unselect @beta { [[Unselect a range of @Efl.Ui.Selectable. This will unselect the range of selectables from $a to $b or from $b to $a depending on which one comes first. From 595987ae177572a2a1c78af666b736946fedbf9f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Sep 2019 16:38:04 -0400 Subject: [PATCH 066/115] efl/image: remove load_controller events these aren't implemented by anything and duplicate the functionality provided by efl.gfx.image::image,preload_state,changed ref T7876 Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10128 --- src/lib/efl/interfaces/efl_gfx_image_load_controller.eo | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo b/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo index d7b0bbf238..c088b776d4 100644 --- a/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo +++ b/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo @@ -164,8 +164,4 @@ interface @beta Efl.Gfx.Image_Load_Controller } } } - events { - load,done: void; [[Emitted after the image has been loaded.]] - load,error: Eina.Error; [[Emitted if an error happened during image loading.]] - } } From ce135194b438790fa0b928824f15fdeb1958e523 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Wed, 25 Sep 2019 11:13:32 +0200 Subject: [PATCH 067/115] release: Update NEWS and bump version for 1.23.0-beta3 release --- NEWS | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index 2e209bf5a7..d33c99d3bc 100644 --- a/NEWS +++ b/NEWS @@ -29,26 +29,6 @@ Features: Fixes: - * eo: Fix missing varags cleanup (CID1399080) - * efl_core_command_line: Fix logically dead code (CID1399106) - * efl_ui_widget_common: Fix potential resource leak (CID1399088) - * efl_ui_selection_manager: Fix unchecked return value (CID1399092) - * evas_device: Fix dereferencing null pointer (CID1399091) - * efl_ui_stack: Fix dereference null return value (CID1399082) - * efl_ui_datepicker: Fix uninitialized scalar value (CID1397006) - * efl_ui_grid: Fix dereferencing null pointer (CID1397000) - * ecore_con: Fix dereferencing of null pointer (CID1396990) - * elm_atspi_bridge: Fix resource leak (CID1399429) - * efl_ui_win: Fix dereference null return value (CID1399428) - * efl_ui_win: Fix dereference null return (CID1399427) - * efl_ui_win: Fix dereference null return (CID1399426) - * efl_ui_win: Fix dereference null return value (CID1399425) - * efreet: Fix resource leak (CID1399090) - * efl_ui_text: Fix resource leak (CID1396998) - * eldbus: Fix dereference after null check (CID1399422) - * efl_ui_focus_manager_calc: Fix resource leaks (CID1396984, CID1396965) - * elm_focus_legacy: Fix resource leaks (CID1399096, CID1399095) - * eldbus: Fix resource leak (CID1399097) * efl_canvas_vg_object: Fix dereference after null check (CID1399423, CID1399421) * efl_ui_win: fix hw accel detection * efl_ui_layout: Eina_Error type has been modified to work correctly. @@ -229,6 +209,8 @@ Fixes: * fix xpm loader to be threadable - fixes so much stuff... * efl: check file's mtime in efl.file::file_set to determine if file is the same * meson.build: allow to disable tiff evas loader + * ecore/signal: also use nonblock for writing side of signal pipe + * ector engine: +null checking. Changes since 1.21.0: --------------------- From eda96947b3720cdaab16ae21880d351618b5e46a Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Wed, 25 Sep 2019 12:33:24 +0200 Subject: [PATCH 068/115] docs: formatting nitpick in Efl.Player.eo --- src/lib/efl/interfaces/efl_player.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_player.eo b/src/lib/efl/interfaces/efl_player.eo index e6425ee244..3157715bec 100644 --- a/src/lib/efl/interfaces/efl_player.eo +++ b/src/lib/efl/interfaces/efl_player.eo @@ -9,7 +9,7 @@ interface Efl.Player This property sets the playback state of the object. Re-setting the current playback state has no effect. - If set to $false, the object's @.playback_progress property is, by default, reset to $0.0. A + If set to $false, the object's @.playback_progress property is, by default, reset to $[0.0]. A class may alter this behavior, and it will be stated in the documentation for a class if such behavior changes should be expected. From 09b2ecec6d84c81e7f22eddb0daacd9412bfd69c Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Wed, 25 Sep 2019 06:44:56 -0400 Subject: [PATCH 069/115] efl_ui_layout: fix null pointer dereferences Summary: If theme doesn't have version data, `version` can be NULL. Reviewers: zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10146 --- src/lib/elementary/efl_ui_layout.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 8935e017d0..ec5e731dfd 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -547,13 +547,16 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) if (!version) ERR("Widget(%p) with type '%s' is not providing a version in its theme!", obj, efl_class_name_get(efl_class_get(obj))); - errno = 0; - sd->version = strtoul(version, NULL, 10); - if (errno) + else { - ERR("Widget(%p) with type '%s' is not providing a valid version in its theme!", obj, - efl_class_name_get(efl_class_get(obj))); - sd->version = 0; + errno = 0; + sd->version = strtoul(version, NULL, 10); + if (errno) + { + ERR("Widget(%p) with type '%s' is not providing a valid version in its theme!", obj, + efl_class_name_get(efl_class_get(obj))); + sd->version = 0; + } } } if (!version) From 14a6dd6ab0e5ef077866b9d2ac4cd4b94e4a8934 Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Wed, 25 Sep 2019 06:53:51 -0400 Subject: [PATCH 070/115] efl_ui_spin_button: mark "direct_text_input" property @beta Summary: After making efl_ui_text interface be stabilized, this property can be considered again about its opening. ref T8097 Reviewers: zmike, bu5hm4n Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8097 Differential Revision: https://phab.enlightenment.org/D10140 --- src/lib/elementary/efl_ui_spin_button.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_spin_button.eo b/src/lib/elementary/efl_ui_spin_button.eo index a8b2778b58..b6fa111a31 100644 --- a/src/lib/elementary/efl_ui_spin_button.eo +++ b/src/lib/elementary/efl_ui_spin_button.eo @@ -42,7 +42,7 @@ class @beta Efl.Ui.Spin_Button extends Efl.Ui.Spin circulate: bool(false); [[$true to enable circulate or $false to disable it.]] } } - @property direct_text_input { + @property direct_text_input @beta { [[Control whether the spin can be directly edited by the user. Spin objects can have editing disabled, in which case they can only From 5fa21a962966c46f636640a210a96e8e98e69e64 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Wed, 25 Sep 2019 06:53:53 -0400 Subject: [PATCH 071/115] evas_callbacks: check if obj is NULL before using it Summary: evas_object_callbacks_finalized could take NULL obj because _efl_canvas_object_efl_object_finalize could call it with NULL obj. Reviewers: bu5hm4n, jsuya, Hermet Reviewed By: bu5hm4n Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10141 --- src/lib/evas/canvas/evas_callbacks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c index cadd0212f0..35ef78aef2 100644 --- a/src/lib/evas/canvas/evas_callbacks.c +++ b/src/lib/evas/canvas/evas_callbacks.c @@ -805,6 +805,8 @@ _animator_repeater(void *data, const Efl_Event *event) void evas_object_callbacks_finalized(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) { + EINA_SAFETY_ON_NULL_RETURN(obj); + if (obj->animator_ref > 0) { if (obj->layer && obj->layer->evas) From 05a7168ca37fe3c0c01c03304f6ac34950b3f436 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 13:22:34 +0200 Subject: [PATCH 072/115] efl/arrangement: mark content_padding beta Summary: this still potentially needs some work and changing the implementations now would be too invasive ref T7864 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7864 Differential Revision: https://phab.enlightenment.org/D10149 --- src/lib/efl/interfaces/efl_gfx_arrangement.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_gfx_arrangement.eo b/src/lib/efl/interfaces/efl_gfx_arrangement.eo index 02cda25495..00f3fe4281 100644 --- a/src/lib/efl/interfaces/efl_gfx_arrangement.eo +++ b/src/lib/efl/interfaces/efl_gfx_arrangement.eo @@ -28,7 +28,7 @@ interface @beta Efl.Gfx.Arrangement axis and 1.0 is at the end.]] } } - @property content_padding { + @property content_padding @beta { [[This property determines the space between a container's content items. It is different than the @Efl.Gfx.Hint.hint_margin property in that it is applied to each From a171b5bd10a8fbb1ae9ccc43dc3321de4efb8fce Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 13:27:42 +0200 Subject: [PATCH 073/115] api: mark Efl.Ui.Box_Stack stable Summary: fix T8207 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T8207 Differential Revision: https://phab.enlightenment.org/D10150 --- src/lib/elementary/efl_ui_box_stack.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_box_stack.eo b/src/lib/elementary/efl_ui_box_stack.eo index 060f470f35..688f0ef6b7 100644 --- a/src/lib/elementary/efl_ui_box_stack.eo +++ b/src/lib/elementary/efl_ui_box_stack.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Box_Stack extends Efl.Ui.Box +class Efl.Ui.Box_Stack extends Efl.Ui.Box { [[A custom layout engine for @Efl.Ui.Box that stacks items. From b7ed1901d56b05783c820879ecaa9ea5ac643d6a Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 13:28:46 +0200 Subject: [PATCH 074/115] api: mark Efl.Ui.Spin_Button stable Summary: fix T8097 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T8097 Differential Revision: https://phab.enlightenment.org/D10152 --- src/lib/elementary/efl_ui_spin_button.eo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/elementary/efl_ui_spin_button.eo b/src/lib/elementary/efl_ui_spin_button.eo index b6fa111a31..d8e09d91d3 100644 --- a/src/lib/elementary/efl_ui_spin_button.eo +++ b/src/lib/elementary/efl_ui_spin_button.eo @@ -1,6 +1,6 @@ -class @beta Efl.Ui.Spin_Button extends Efl.Ui.Spin - implements Efl.Ui.Focus.Composition, Efl.Ui.Layout_Orientable, Efl.Ui.Range_Interactive, - Efl.Access.Widget.Action +class Efl.Ui.Spin_Button extends Efl.Ui.Spin + implements Efl.Ui.Focus.Composition, Efl.Ui.Layout_Orientable, Efl.Ui.Range_Interactive, + Efl.Access.Widget.Action { [[A Button Spin. From 0b8862642a96c2031d0ba47d6d4d1dfdfc4bc235 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 13:34:01 +0200 Subject: [PATCH 075/115] api: mark Efl.Ui.Scrollable stable Summary: fix T7883 Subscribers: cedric, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T7883 Differential Revision: https://phab.enlightenment.org/D10151 --- src/lib/efl/interfaces/efl_ui_scrollable.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_ui_scrollable.eo b/src/lib/efl/interfaces/efl_ui_scrollable.eo index 520cdd1d13..8baf832fa8 100644 --- a/src/lib/efl/interfaces/efl_ui_scrollable.eo +++ b/src/lib/efl/interfaces/efl_ui_scrollable.eo @@ -1,7 +1,7 @@ import eina_types; import efl_ui_layout_orientable; -interface @beta Efl.Ui.Scrollable +interface Efl.Ui.Scrollable { [[Efl UI scrollable interface]] event_prefix: efl_ui; From 883cb445c68a2ed9033ad7c46f35ccfbc6f00e12 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 15:02:52 +0200 Subject: [PATCH 076/115] efl_ui/layout: improve docs Summary: add doc notes for these classes Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10155 --- src/lib/elementary/efl_ui_layout.eo | 2 +- src/lib/elementary/efl_ui_layout_base.eo | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_layout.eo b/src/lib/elementary/efl_ui_layout.eo index 0ebbb4e1cd..f8ff7a9e39 100644 --- a/src/lib/elementary/efl_ui_layout.eo +++ b/src/lib/elementary/efl_ui_layout.eo @@ -2,7 +2,7 @@ import efl_ui; class Efl.Ui.Layout extends Efl.Ui.Layout_Base implements Efl.File { - [[Elementary layout class + [[EFL layout widget class. When loading layouts from a file, use the @Efl.File.key property to specify the group that the data belongs to, in case it's an EET file diff --git a/src/lib/elementary/efl_ui_layout_base.eo b/src/lib/elementary/efl_ui_layout_base.eo index 4f4624744a..aa616c777a 100644 --- a/src/lib/elementary/efl_ui_layout_base.eo +++ b/src/lib/elementary/efl_ui_layout_base.eo @@ -5,7 +5,19 @@ abstract Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container, Efl.Layout.Calc, Efl.Layout.Signal, Efl.Layout.Group { - [[Elementary layout abstract + [[EFL layout widget abstract. + + A "layout" in the context of EFL is an object which interfaces with the internal layout engine. + Layouts are created using the EDC language, and any widget which implements this abstract must + have a corresponding theme group to load in order to graphically display anything. + + Theme groups for EFL widgets must be versioned. This means having a "version" $[data.item] key in + the theme group for the widget. If the loaded theme group for a widget has version info which + is lower than the currently-running EFL version, a warning will be printed to notify the user that + new features may be available. If the loaded theme group for a widget has no version info, an + error will be generated. If the loaded theme group for a widget has a version that is newer than + the currently-running EFL version, a critical error will be printed to notify the user that + the theme may not be compatible. @since 1.22 ]] From 71cd89c5809e957b42ff76642f34bb5789ad6a78 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Wed, 25 Sep 2019 18:17:48 +0200 Subject: [PATCH 077/115] eolian: expose most API as stable There is still some TODO with builtin types, parameter directions and prefixes, which will be resolved in the next commits. --- src/bindings/luajit/eolian.lua | 14 ++-- src/lib/eolian/Eolian.h | 84 ++++++++++-------------- src/lib/eolian/database_class_api.c | 2 +- src/lib/eolian/database_type_api.c | 7 -- src/lib/eolian/database_var_api.c | 2 +- src/lib/eolian/eo_parser.c | 32 ++++----- src/lib/eolian/eolian_database.h | 1 - src/lib/eolian_cxx/grammar/klass_def.hpp | 4 +- src/scripts/pyolian/eolian.py | 12 ++-- src/scripts/pyolian/eolian_lib.py | 16 ++--- src/scripts/pyolian/test_eolian.py | 5 +- src/tests/eolian/eolian_parsing.c | 6 +- 12 files changed, 75 insertions(+), 110 deletions(-) diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index bd3b20601b..8671fc5c2a 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -339,7 +339,7 @@ ffi.cdef [[ Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass); const Eolian_Documentation *eolian_class_documentation_get(const Eolian_Class *klass); - const char *eolian_class_eo_prefix_get(const Eolian_Class *klass); + const char *eolian_class_c_prefix_get(const Eolian_Class *klass); const char *eolian_class_event_prefix_get(const Eolian_Class *klass); const char *eolian_class_data_type_get(const Eolian_Class *klass); const Eolian_Class *eolian_class_parent_get(const Eolian_Class *klass); @@ -454,7 +454,7 @@ ffi.cdef [[ const Eolian_Expression *eolian_expression_unary_expression_get(const Eolian_Expression *expr); Eolian_Value_t eolian_expression_value_get(const Eolian_Expression *expr); const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var); - const Eolian_Type *eolian_constant_base_type_get(const Eolian_Constant *var); + const Eolian_Type *eolian_constant_type_get(const Eolian_Constant *var); const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var); Eina_Bool eolian_constant_is_extern(const Eolian_Constant *var); const char *eolian_documentation_summary_get(const Eolian_Documentation *doc); @@ -1435,8 +1435,8 @@ M.Class = ffi.metatype("Eolian_Class", { return v end, - eo_prefix_get = function(self) - local v = eolian.eolian_class_eo_prefix_get(self) + c_prefix_get = function(self) + local v = eolian.eolian_class_c_prefix_get(self) if v == nil then local buf = self:namespaces_get() buf[#buf + 1] = self:short_name_get() @@ -1448,7 +1448,7 @@ M.Class = ffi.metatype("Eolian_Class", { event_prefix_get = function(self) local v = eolian.eolian_class_event_prefix_get(self) if v == nil then - return self:eo_prefix_get() + return self:c_prefix_get() end return ffi.string(v) end, @@ -1713,8 +1713,8 @@ M.Constant = ffi.metatype("Eolian_Constant", { return v end, - base_type_get = function(self) - local v = eolian.eolian_constant_base_type_get(self) + type_get = function(self) + local v = eolian.eolian_constant_type_get(self) if v == nil then return nil end return v end, diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index b0d7a4e9ce..33e571c491 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -34,7 +34,7 @@ extern "C" { #include /** - * @page eolian_main Eolian (BETA) + * @page eolian_main Eolian * * @date 2014 (created) * @@ -82,8 +82,6 @@ extern "C" { * @{ */ -#ifdef EFL_BETA_API_SUPPORT - /* The maximum format version supported by this version of Eolian */ #define EOLIAN_FILE_FORMAT_VERSION 1 @@ -284,7 +282,9 @@ typedef enum EOLIAN_TYPE_REGULAR, EOLIAN_TYPE_CLASS, EOLIAN_TYPE_ERROR, +#ifdef EFL_BETA_API_SUPPORT EOLIAN_TYPE_UNDEFINED +#endif } Eolian_Type_Type; typedef enum @@ -336,7 +336,7 @@ typedef enum EOLIAN_TYPE_BUILTIN_ARRAY, EOLIAN_TYPE_BUILTIN_FUTURE, EOLIAN_TYPE_BUILTIN_ITERATOR, - EOLIAN_TYPE_BUILTIN_HASH, + EOLIAN_TYPE_BUILTIN_HASH, /* FIXME: beta */ EOLIAN_TYPE_BUILTIN_LIST, EOLIAN_TYPE_BUILTIN_ANY_VALUE, @@ -348,7 +348,9 @@ typedef enum EOLIAN_TYPE_BUILTIN_STRINGSHARE, EOLIAN_TYPE_BUILTIN_STRBUF, +#ifdef EOLIAN_BETA_API_SUPPORT EOLIAN_TYPE_BUILTIN_VOID_PTR +#endif } Eolian_Type_Builtin_Type; typedef enum @@ -1498,14 +1500,14 @@ EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass); EAPI const Eolian_Documentation *eolian_class_documentation_get(const Eolian_Class *klass); /* - * @brief Returns the eo prefix of a class + * @brief Returns the C function prefix of a class * * @param[in] klass the class * @return the eo prefix * * @ingroup Eolian */ -EAPI Eina_Stringshare* eolian_class_eo_prefix_get(const Eolian_Class *klass); +EAPI Eina_Stringshare* eolian_class_c_prefix_get(const Eolian_Class *klass); /* * @brief Returns the event prefix of a class @@ -1701,16 +1703,6 @@ eolian_function_is_beta(const Eolian_Function *function_id) */ EAPI Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass); -/* - * @brief Get whether a function is a function pointer. - * - * @param[in] function_id Id of the function - * @return EINA_TRUE and EINA_FALSE respectively - * - * @ingroup Eolian - */ -EAPI Eina_Bool eolian_function_is_function_pointer(const Eolian_Function *function_id); - /* * @brief Returns an iterator to the parameter handles for a method/ctor/dtor. * @@ -2612,17 +2604,6 @@ EAPI const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(co */ EAPI const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force); -/* - * @brief Get the legacy prefix of enum field names. When not specified, - * enum name is used. - * - * @param[in] tp the type declaration. - * @return the legacy prefix or NULL. - * - * @ingroup Eolian - */ -EAPI Eina_Stringshare *eolian_typedecl_enum_legacy_prefix_get(const Eolian_Typedecl *tp); - /* * @brief Get the documentation of a struct/alias type. * @@ -2866,18 +2847,6 @@ EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp); */ EAPI const Eolian_Error *eolian_type_error_get(const Eolian_Type *tp); -/* - * @brief Get whether the given type is owned. - * - * This is true when a parameter, return or whatever is marked as @owned. - * - * @param[in] tp the type. - * @return EINA_TRUE when the type is marked owned, EINA_FALSE otherwise. - * - * @ingroup Eolian - */ -EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); - /* * @brief Get whether the given type is moved with its parent type. * @@ -2903,16 +2872,6 @@ EAPI Eina_Bool eolian_type_is_move(const Eolian_Type *tp); */ EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp); -/* - * @brief Get whether the given type is a reference. - * - * @param[in] tp the type. - * @return EINA_TRUE when the type is marked ref, EINA_FALSE otherwise. - * - * @ingroup Eolian - */ -EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp); - /* * @brief Get the full C type name of the given type. * @@ -3133,7 +3092,7 @@ EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_ * * @ingroup Eolian */ -EAPI const Eolian_Type *eolian_constant_base_type_get(const Eolian_Constant *var); +EAPI const Eolian_Type *eolian_constant_type_get(const Eolian_Constant *var); /* * @brief Get the value of a constant. @@ -3439,7 +3398,30 @@ EAPI char *eolian_doc_token_text_get(const Eolian_Doc_Token *tok); */ EAPI Eolian_Object_Type eolian_doc_token_ref_resolve(const Eolian_Doc_Token *tok, const Eolian_State *state, const Eolian_Object **data, const Eolian_Object **data2); -#endif +#ifdef EFL_BETA_API_SUPPORT + +/* + * @brief Get the legacy prefix of enum field names. When not specified, + * enum name is used. (BETA) + * + * @param[in] tp the type declaration. + * @return the legacy prefix or NULL. + * + * @ingroup Eolian + */ +EAPI Eina_Stringshare *eolian_typedecl_enum_legacy_prefix_get(const Eolian_Typedecl *tp); + +/* + * @brief Get whether the given type is a reference. + * + * @param[in] tp the type. + * @return EINA_TRUE when the type is marked ref, EINA_FALSE otherwise. + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp); + +#endif /* EFL_BETA_API_SUPPORT */ /** * @} diff --git a/src/lib/eolian/database_class_api.c b/src/lib/eolian/database_class_api.c index 07e781db7a..74cff1b06b 100644 --- a/src/lib/eolian/database_class_api.c +++ b/src/lib/eolian/database_class_api.c @@ -21,7 +21,7 @@ eolian_class_documentation_get(const Eolian_Class *cl) } EAPI Eina_Stringshare* -eolian_class_eo_prefix_get(const Eolian_Class *cl) +eolian_class_c_prefix_get(const Eolian_Class *cl) { EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL); return cl->c_prefix; diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c index 59a149337f..675d5471d4 100644 --- a/src/lib/eolian/database_type_api.c +++ b/src/lib/eolian/database_type_api.c @@ -231,13 +231,6 @@ eolian_type_error_get(const Eolian_Type *tp) return tp->error; } -EAPI Eina_Bool -eolian_type_is_owned(const Eolian_Type *tp) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE); - return tp->owned; -} - EAPI Eina_Bool eolian_type_is_move(const Eolian_Type *tp) { diff --git a/src/lib/eolian/database_var_api.c b/src/lib/eolian/database_var_api.c index 260baa638f..b6f2d1f1bc 100644 --- a/src/lib/eolian/database_var_api.c +++ b/src/lib/eolian/database_var_api.c @@ -13,7 +13,7 @@ eolian_constant_documentation_get(const Eolian_Constant *var) } EAPI const Eolian_Type * -eolian_constant_base_type_get(const Eolian_Constant *var) +eolian_constant_type_get(const Eolian_Constant *var) { EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); return var->base_type; diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index faaaf4fb3d..d30d285a2c 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -517,7 +517,7 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, FILL_BASE(fdef->base, ls, fline, fcol, STRUCT_FIELD); fdef->type = eo_lexer_type_release(ls, tp); fdef->base.name = eina_stringshare_ref(fname); - Eina_Bool has_owned = EINA_FALSE, has_by_ref = EINA_FALSE; + Eina_Bool has_move = EINA_FALSE, has_by_ref = EINA_FALSE; for (;;) switch (ls->t.kw) { case KW_at_by_ref: @@ -526,8 +526,8 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, eo_lexer_get(ls); break; case KW_at_move: - CASE_LOCK(ls, owned, "owned qualifier"); - fdef->type->owned = fdef->move = EINA_TRUE; + CASE_LOCK(ls, move, "move qualifier"); + fdef->move = EINA_TRUE; eo_lexer_get(ls); break; default: @@ -773,14 +773,14 @@ parse_type_void(Eo_Lexer *ls, Eina_Bool allow_ptr) def->base_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE)); /* view-only types are not allowed to own the contents */ if (tpid == KW_array || tpid == KW_hash || tpid == KW_list || tpid == KW_future) - if ((def->base_type->owned = def->base_type->move = ls->t.kw == KW_at_move)) + if ((def->base_type->move = ls->t.kw == KW_at_move)) eo_lexer_get(ls); if (tpid == KW_hash) { check_next(ls, ','); def->base_type->next_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE)); - if ((def->base_type->next_type->owned = def->base_type->next_type->move = ls->t.kw == KW_at_move)) + if ((def->base_type->next_type->move = ls->t.kw == KW_at_move)) eo_lexer_get(ls); } check_match(ls, '>', '<', bline, bcol); @@ -1014,7 +1014,7 @@ typedef struct _Eo_Ret_Def Eolian_Documentation *doc; Eolian_Expression *default_ret_val; Eina_Bool no_unused: 1; - Eina_Bool owned: 1; + Eina_Bool move: 1; Eina_Bool by_ref: 1; } Eo_Ret_Def; @@ -1031,7 +1031,7 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void, ret->doc = NULL; ret->default_ret_val = NULL; ret->no_unused = EINA_FALSE; - ret->owned = EINA_FALSE; + ret->move = EINA_FALSE; ret->by_ref = EINA_FALSE; if (allow_def && (ls->t.token == '(')) { @@ -1042,7 +1042,7 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void, ls->expr_mode = EINA_FALSE; check_match(ls, ')', '(', line, col); } - Eina_Bool has_no_unused = EINA_FALSE, has_owned = EINA_FALSE, + Eina_Bool has_no_unused = EINA_FALSE, has_move = EINA_FALSE, has_by_ref = EINA_FALSE; if (!is_funcptr) for (;;) switch (ls->t.kw) { @@ -1052,8 +1052,8 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void, eo_lexer_get(ls); break; case KW_at_move: - CASE_LOCK(ls, owned, "owned qualifier"); - ret->owned = EINA_TRUE; + CASE_LOCK(ls, move, "move qualifier"); + ret->move = EINA_TRUE; eo_lexer_get(ls); break; case KW_at_by_ref: @@ -1074,7 +1074,7 @@ parse_param(Eo_Lexer *ls, Eina_List **params, Eina_Bool allow_inout, Eina_Bool is_vals, const Eolian_Function *func) { Eina_Bool has_optional = EINA_FALSE, - has_owned = EINA_FALSE, + has_move = EINA_FALSE, has_by_ref = EINA_FALSE; Eolian_Function_Parameter *par = calloc(1, sizeof(Eolian_Function_Parameter)); par->param_dir = EOLIAN_IN_PARAM; @@ -1130,8 +1130,8 @@ type_done: eo_lexer_get(ls); break; case KW_at_move: - CASE_LOCK(ls, owned, "owned qualifier"); - par->type->owned = par->move = EINA_TRUE; + CASE_LOCK(ls, move, "move qualifier"); + par->move = EINA_TRUE; eo_lexer_get(ls); break; case KW_at_by_ref: @@ -1252,7 +1252,7 @@ parse_accessor: prop->get_ret_val = ret.default_ret_val; prop->get_return_no_unused = ret.no_unused; prop->get_return_by_ref = ret.by_ref; - prop->get_return_move = prop->get_ret_type->owned = ret.owned; + prop->get_return_move = ret.move; } else { @@ -1261,7 +1261,7 @@ parse_accessor: prop->set_ret_val = ret.default_ret_val; prop->set_return_no_unused = ret.no_unused; prop->set_return_by_ref = ret.by_ref; - prop->set_return_move = prop->set_ret_type->owned = ret.owned; + prop->set_return_move = ret.move; } break; case KW_keys: @@ -1573,7 +1573,7 @@ body: meth->get_ret_val = ret.default_ret_val; meth->get_return_no_unused = ret.no_unused; meth->get_return_by_ref = ret.by_ref; - meth->get_return_move = meth->get_ret_type->owned = ret.owned; + meth->get_return_move = ret.move; break; case KW_params: CASE_LOCK(ls, params, "params definition") diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index 3cbf4fbeea..ffe8067e76 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -284,7 +284,6 @@ struct _Eolian_Type Eina_Bool is_const :1; Eina_Bool is_ptr :1; Eina_Bool move :1; - Eina_Bool owned :1; Eina_Bool ownable :1; }; diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index ce3053331c..2dcd4bb5ba 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp @@ -1094,9 +1094,9 @@ struct constant_def constant_def(Eolian_Constant const* constant, Eolian_Unit const* unit) : name(::eolian_constant_short_name_get(constant)) , full_name(::eolian_constant_name_get(constant)) - , base_type(::eolian_constant_base_type_get(constant) + , base_type(::eolian_constant_type_get(constant) , unit - , ::eolian_type_c_type_get(eolian_constant_base_type_get(constant)) + , ::eolian_type_c_type_get(eolian_constant_type_get(constant)) , value_ownership::unmoved , is_by::value) , documentation(::eolian_constant_documentation_get(constant)) diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index 6d800cdd82..23ebd22c66 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -645,8 +645,8 @@ class Class(Object): return ret @cached_property - def eo_prefix(self): - return _str_to_py(lib.eolian_class_eo_prefix_get(self)) + def c_prefix(self): + return _str_to_py(lib.eolian_class_c_prefix_get(self)) @cached_property def event_prefix(self): @@ -1062,10 +1062,6 @@ class Type(Object): c_cls = lib.eolian_type_class_get(self) return Class(c_cls) if c_cls else None - @cached_property - def is_owned(self): - return bool(lib.eolian_type_is_owned(self)) - @cached_property def is_const(self): return bool(lib.eolian_type_is_const(self)) @@ -1231,8 +1227,8 @@ class Constant(Object): return Expression(c_expr) if c_expr else None @cached_property - def base_type(self): - c_type = lib.eolian_constant_base_type_get(self) + def type(self): + c_type = lib.eolian_constant_type_get(self) return Type(c_type) if c_type else None @cached_property diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py index 3a745edf31..36e0341b80 100644 --- a/src/scripts/pyolian/eolian_lib.py +++ b/src/scripts/pyolian/eolian_lib.py @@ -234,9 +234,9 @@ lib.eolian_class_type_get.restype = c_int lib.eolian_class_documentation_get.argtypes = (c_void_p,) lib.eolian_class_documentation_get.restype = c_void_p -# EAPI Eina_Stringshare *eolian_class_eo_prefix_get(const Eolian_Class *klass); -lib.eolian_class_eo_prefix_get.argtypes = (c_void_p,) -lib.eolian_class_eo_prefix_get.restype = c_char_p +# EAPI Eina_Stringshare *eolian_class_c_prefix_get(const Eolian_Class *klass); +lib.eolian_class_c_prefix_get.argtypes = (c_void_p,) +lib.eolian_class_c_prefix_get.restype = c_char_p # EAPI Eina_Stringshare* eolian_class_event_prefix_get(const Eolian_Class *klass); lib.eolian_class_event_prefix_get.argtypes = (c_void_p,) @@ -579,10 +579,6 @@ lib.eolian_type_aliased_base_get.restype = c_void_p lib.eolian_type_class_get.argtypes = (c_void_p,) lib.eolian_type_class_get.restype = c_void_p -# EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); -lib.eolian_type_is_owned.argtypes = (c_void_p,) -lib.eolian_type_is_owned.restype = c_bool - # EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp); lib.eolian_type_is_const.argtypes = (c_void_p,) lib.eolian_type_is_const.restype = c_bool @@ -631,9 +627,9 @@ lib.eolian_expression_unary_expression_get.restype = c_void_p lib.eolian_constant_documentation_get.argtypes = (c_void_p,) lib.eolian_constant_documentation_get.restype = c_void_p -# EAPI const Eolian_Type *eolian_constant_base_type_get(const Eolian_Constant *var); -lib.eolian_constant_base_type_get.argtypes = (c_void_p,) -lib.eolian_constant_base_type_get.restype = c_void_p +# EAPI const Eolian_Type *eolian_constant_type_get(const Eolian_Constant *var); +lib.eolian_constant_type_get.argtypes = (c_void_p,) +lib.eolian_constant_type_get.restype = c_void_p # EAPI const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var); lib.eolian_constant_value_get.argtypes = (c_void_p,) diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py index 280d4c187c..01e916b4b4 100755 --- a/src/scripts/pyolian/test_eolian.py +++ b/src/scripts/pyolian/test_eolian.py @@ -333,7 +333,7 @@ class TestEolianClass(unittest.TestCase): self.assertEqual(list(cls.namespaces), ['Efl']) self.assertEqual(cls.type, eolian.Eolian_Class_Type.REGULAR) self.assertIsInstance(cls.documentation, eolian.Documentation) - self.assertIsNone(cls.eo_prefix) # TODO fin a class with a value + self.assertIsNone(cls.c_prefix) # TODO fin a class with a value self.assertIsNone(cls.event_prefix) # TODO same as above self.assertIsNone(cls.data_type) # TODO same as above self.assertEqual(cls.parent.name, 'Efl.Loop_Consumer') @@ -475,7 +475,7 @@ class TestEolianConstant(unittest.TestCase): self.assertFalse(var.is_extern) self.assertEqual(list(var.namespaces), ['Efl','Gfx']) self.assertIsInstance(var.documentation, eolian.Documentation) - self.assertIsInstance(var.base_type, eolian.Type) + self.assertIsInstance(var.type, eolian.Type) self.assertIsInstance(var.value, eolian.Expression) self.assertEqual(float(var.value.serialize), +1.0) @@ -553,7 +553,6 @@ class TestEolianType(unittest.TestCase): self.assertEqual(t.file, 'efl_loop_timer.eo') # TODO is this correct ? self.assertIsNone(t.base_type) # TODO find a better test self.assertIsNone(t.next_type) # TODO find a better test - self.assertFalse(t.is_owned) self.assertFalse(t.is_const) self.assertFalse(t.is_ptr) self.assertEqual(list(t.namespaces), []) diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index a6a6d744b4..2e61fb97b2 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -554,7 +554,7 @@ EFL_START_TEST(eolian_simple_parsing) fail_if(eolian_class_type_get(class) != EOLIAN_CLASS_REGULAR); fail_if(eolian_class_parent_get(class) != NULL); fail_if(eolian_class_extensions_get(class) != NULL); - fail_if(strcmp(eolian_class_eo_prefix_get(class), "efl_canvas_object_simple")); + fail_if(strcmp(eolian_class_c_prefix_get(class), "efl_canvas_object_simple")); fail_if(strcmp(eolian_class_data_type_get(class), "Evas_Simple_Data")); Eina_Stringshare *dt = eolian_class_c_data_type_get(class); fail_if(strcmp(dt, "Evas_Simple_Data")); @@ -786,7 +786,7 @@ EFL_START_TEST(eolian_var) /* regular constant */ fail_if(!(var = eolian_unit_constant_by_name_get(unit, "Foo"))); fail_if(eolian_constant_is_extern(var)); - fail_if(!(type = eolian_constant_base_type_get(var))); + fail_if(!(type = eolian_constant_type_get(var))); fail_if(!(name = eolian_type_short_name_get(type))); fail_if(strcmp(name, "int")); fail_if(!(exp = eolian_constant_value_get(var))); @@ -913,7 +913,7 @@ EFL_START_TEST(eolian_enum) eina_stringshare_del(cname); fail_if(!(var = eolian_unit_constant_by_name_get(unit, "Bah"))); - fail_if(!(type = eolian_constant_base_type_get(var))); + fail_if(!(type = eolian_constant_type_get(var))); fail_if(!(name = eolian_type_short_name_get(type))); fail_if(strcmp(name, "Baz")); fail_if(!(exp = eolian_constant_value_get(var))); From 9206960dfac9e2ad6651c69e24a3df5c1b92a2eb Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 07:30:24 -0400 Subject: [PATCH 078/115] efl_ui/layout: add explicit error case when theme version > efl version it's important to handle cases where a "future" theme is trying to be used by "current" efl. this throws a serious error, since it's possible that the widget may look/act in a way that makes it unusable ref T8231 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10153 --- src/lib/elementary/efl_ui.eot | 3 +++ src/lib/elementary/efl_ui_layout.c | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui.eot b/src/lib/elementary/efl_ui.eot index b397b27094..eaa4ae41be 100644 --- a/src/lib/elementary/efl_ui.eot +++ b/src/lib/elementary/efl_ui.eot @@ -11,6 +11,9 @@ error Efl.Ui.Theme.Apply_Error.DEFAULT = "Fallback to default style was enabled error Efl.Ui.Theme.Apply_Error.GENERIC = "An error occurred and no theme could be set for this widget"; [[ Failed to apply theme. The widget may become unusable. ]] +error Efl.Ui.Theme.Apply_Error.VERSION = "The widget attempted to load a theme that is incompatible with the current EFL version"; [[ + The theme was applied. The widget may not function or look as expected. +]] enum Efl.Ui.Focus.Direction { diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index ec5e731dfd..c4310f01c1 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -545,8 +545,11 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) { const char *version = edje_object_data_get(wd->resize_obj, "version"); if (!version) - ERR("Widget(%p) with type '%s' is not providing a version in its theme!", obj, - efl_class_name_get(efl_class_get(obj))); + { + ERR("Widget(%p) with type '%s' is not providing a version in its theme!", obj, + efl_class_name_get(efl_class_get(obj))); + return EFL_UI_THEME_APPLY_ERROR_VERSION; + } else { errno = 0; @@ -556,6 +559,7 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) ERR("Widget(%p) with type '%s' is not providing a valid version in its theme!", obj, efl_class_name_get(efl_class_get(obj))); sd->version = 0; + return EFL_UI_THEME_APPLY_ERROR_VERSION; } } } @@ -575,6 +579,13 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) if (sd->version < version) WRN("Widget(%p) with type '%s' is providing a potentially old version in its theme: found %u, should be %u", obj, efl_class_name_get(efl_class_get(obj)), sd->version, version); + else if (sd->version > version) + { + CRI("Widget(%p) with type '%s' is attempting to use a theme that is too new: found %u, should be %u", obj, + efl_class_name_get(efl_class_get(obj)), sd->version, version); + CRI("\tTheme file: %s\tTheme group: %s", efl_file_get(obj), efl_file_key_get(obj)); + return EFL_UI_THEME_APPLY_ERROR_VERSION; + } } return EFL_UI_THEME_APPLY_ERROR_NONE; From a4597c8326d340b93cfcfd62a72057aae9b9f506 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 06:47:49 -0400 Subject: [PATCH 079/115] efl_ui/image: fix playback_speed timer calcs I accidentally inverted this; the frame timing needs to be divided by the playback speed to have the correct time here Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10147 --- src/lib/elementary/efl_ui_image.c | 8 ++++---- src/lib/elementary/efl_ui_image_zoomable.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index ade335b3ee..f732d44add 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -141,7 +141,7 @@ _efl_ui_image_animate_cb(void *data) (sd->img, sd->cur_frame, 0); if (sd->frame_duration > 0) - ecore_timer_interval_set(sd->anim_timer, sd->frame_duration * sd->playback_speed); + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration / sd->playback_speed); return ECORE_CALLBACK_RENEW; } @@ -1762,7 +1762,7 @@ _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool an evas_object_image_animated_frame_set(sd->img, sd->cur_frame); if (!sd->paused)//legacy sd->anim_timer = ecore_timer_add - (sd->frame_duration * sd->playback_speed, _efl_ui_image_animate_cb, obj); + (sd->frame_duration / sd->playback_speed, _efl_ui_image_animate_cb, obj); } else { @@ -1821,7 +1821,7 @@ _efl_ui_image_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Da efl_player_playback_speed_set(sd->img, factor); else if (sd->anim_timer) { - ecore_timer_interval_set(sd->anim_timer, sd->frame_duration * sd->playback_speed); + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration / sd->playback_speed); ecore_timer_reset(sd->anim_timer); } } @@ -1881,7 +1881,7 @@ _efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_ if (!paused) { sd->anim_timer = ecore_timer_add - (sd->frame_duration * sd->playback_speed, _efl_ui_image_animate_cb, obj); + (sd->frame_duration / sd->playback_speed, _efl_ui_image_animate_cb, obj); } else { diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index b14bace8a2..a08a72ca8a 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -3035,7 +3035,7 @@ _efl_ui_image_zoomable_animate_cb(void *data) (sd->img, sd->cur_frame, 0); if (sd->frame_duration > 0) - ecore_timer_interval_set(sd->anim_timer, sd->frame_duration * sd->playback_speed); + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration / sd->playback_speed); return ECORE_CALLBACK_RENEW; } @@ -3065,7 +3065,7 @@ _efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Z evas_object_image_animated_frame_set(sd->img, sd->cur_frame); if (!sd->paused)//legacy sd->anim_timer = ecore_timer_add - (sd->frame_duration * sd->playback_speed, _efl_ui_image_zoomable_animate_cb, obj); + (sd->frame_duration / sd->playback_speed, _efl_ui_image_zoomable_animate_cb, obj); } else { @@ -3092,7 +3092,7 @@ _efl_ui_image_zoomable_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Zoomab if (!paused) { sd->anim_timer = ecore_timer_add - (sd->frame_duration * sd->playback_speed, _efl_ui_image_zoomable_animate_cb, obj); + (sd->frame_duration / sd->playback_speed, _efl_ui_image_zoomable_animate_cb, obj); } else { @@ -3138,7 +3138,7 @@ _efl_ui_image_zoomable_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui efl_player_playback_speed_set(sd->edje, factor); else if (sd->anim_timer) { - ecore_timer_interval_set(sd->anim_timer, sd->frame_duration * sd->playback_speed); + ecore_timer_interval_set(sd->anim_timer, sd->frame_duration / sd->playback_speed); ecore_timer_reset(sd->anim_timer); } } From 78ee2ca6b0604ddf6ac2479da9585b68ad937613 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Tue, 24 Sep 2019 17:13:49 -0700 Subject: [PATCH 080/115] elementary: add support for default property on item being created by Efl.Ui.Widget_Factory. Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D10129 --- src/lib/elementary/efl_ui_widget_factory.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index 00ba103cda..54b1b8dc09 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -36,6 +36,8 @@ struct _Efl_Ui_Widget_Factory_Data Eina_Hash *parts; + Eina_Stringshare *default_property; + Eina_Stringshare *style; }; @@ -182,6 +184,9 @@ _efl_ui_widget_factory_releasing(void *data, const Efl_Event *ev) efl_key_data_set(ui_view, "efl.ui.widget.factory.size_check", NULL); if (efl_isa(ui_view, EFL_UI_ITEM_CLASS)) efl_ui_item_calc_locked_set(ui_view, EINA_TRUE); + // Bind default property + if (pd->default_property) efl_ui_property_bind(ui_view, NULL, pd->default_property); + // Bind all property before the object is finalize it = eina_hash_iterator_data_new(pd->parts); EINA_ITERATOR_FOREACH(it, bpd) @@ -405,6 +410,12 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE return ENOENT; } + if (!key) + { + eina_stringshare_replace(&pd->pd->default_property, property); + return; + } + if (!pd->pd->parts) pd->pd->parts = eina_hash_stringshared_new(NULL); From 267f8fcfa82af22c20c79687eb1aed5d5c513ab8 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 16:52:18 +0000 Subject: [PATCH 081/115] elementary: return an error when unimplemented function on Efl.Ui.Widget_Factory. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10130 --- src/bindings/mono/efl_mono/Bind.cs | 3 +-- src/lib/efl/interfaces/efl_ui_factory_bind.eo | 1 + src/lib/elementary/efl_ui_layout.c | 10 ++++++---- src/lib/elementary/efl_ui_layout_factory.c | 6 ++++-- src/lib/elementary/efl_ui_widget_factory.c | 12 +++++++++++- src/lib/elementary/efl_ui_widget_factory.eo | 1 + 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/bindings/mono/efl_mono/Bind.cs b/src/bindings/mono/efl_mono/Bind.cs index 14c45d9dd0..c31186cbb7 100644 --- a/src/bindings/mono/efl_mono/Bind.cs +++ b/src/bindings/mono/efl_mono/Bind.cs @@ -112,8 +112,7 @@ public class BindableFactoryPart /// Binds the given factory to this part. public Eina.Error BindFactory(Efl.Ui.IFactory factory) { - this.Binder.BindFactory(this.PartName, factory); - return Eina.Error.NO_ERROR; + return this.Binder.BindFactory(this.PartName, factory); } } diff --git a/src/lib/efl/interfaces/efl_ui_factory_bind.eo b/src/lib/efl/interfaces/efl_ui_factory_bind.eo index d26832453f..740c627b82 100644 --- a/src/lib/efl/interfaces/efl_ui_factory_bind.eo +++ b/src/lib/efl/interfaces/efl_ui_factory_bind.eo @@ -14,6 +14,7 @@ interface @beta Efl.Ui.Factory_Bind key: string; [[Key string for bind model property data]] factory: Efl.Ui.Factory; [[@Efl.Ui.Factory for create and bind model property data]] } + return: Eina.Error; [[0 when it succeed, an error code otherwise.]] } } } diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index c4310f01c1..1797d8a45f 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -2527,16 +2527,16 @@ _efl_ui_layout_base_efl_ui_property_bind_property_bind(Eo *obj, Efl_Ui_Layout_Da return 0; } -EOLIAN static void +EOLIAN static Eina_Error _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd, const char *key, Efl_Ui_Factory *factory) { - EINA_SAFETY_ON_NULL_RETURN(key); + EINA_SAFETY_ON_NULL_RETURN_VAL(key, EFL_PROPERTY_ERROR_INVALID_KEY); Efl_Ui_Layout_Factory_Tracking *tracking; Eina_Stringshare *ss_key; if (!_elm_layout_part_aliasing_eval(obj, &key, EINA_TRUE)) - return; + return EFL_PROPERTY_ERROR_INVALID_KEY; // Check if there is a model and register it _efl_ui_layout_base_model_watch(obj, pd); @@ -2566,7 +2566,7 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui else { tracking = calloc(1, sizeof (Efl_Ui_Layout_Factory_Tracking)); - if (!tracking) return ; + if (!tracking) return ENOMEM; tracking->key = ss_key; @@ -2577,6 +2577,8 @@ _efl_ui_layout_base_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui tracking->factory = efl_ref(factory); _efl_ui_layout_view_model_content_update(pd, tracking, ss_key); + + return EINA_ERROR_NO_ERROR; } EOLIAN void diff --git a/src/lib/elementary/efl_ui_layout_factory.c b/src/lib/elementary/efl_ui_layout_factory.c index cfc2749dd3..b6032e70e9 100644 --- a/src/lib/elementary/efl_ui_layout_factory.c +++ b/src/lib/elementary/efl_ui_layout_factory.c @@ -88,7 +88,7 @@ _efl_ui_layout_factory_efl_object_destructor(Eo *obj, Efl_Ui_Layout_Factory_Data efl_destructor(efl_super(obj, MY_CLASS)); } -EOLIAN static void +EOLIAN static Eina_Error _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd, const char *key, Efl_Ui_Factory *factory) { @@ -99,7 +99,7 @@ _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl if (factory == NULL) { eina_hash_del(pd->bind.factories, ss_key, NULL); - return; + return EINA_ERROR_NO_ERROR; } f_old = eina_hash_set(pd->bind.factories, ss_key, efl_ref(factory)); @@ -108,6 +108,8 @@ _efl_ui_layout_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, Efl efl_unref(f_old); eina_stringshare_del(ss_key); } + + return EINA_ERROR_NO_ERROR; } EOLIAN static Eina_Error diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index 54b1b8dc09..13160af8e1 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -413,7 +413,7 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE if (!key) { eina_stringshare_replace(&pd->pd->default_property, property); - return; + return 0; } if (!pd->pd->parts) @@ -443,5 +443,15 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE return 0; } +static Eina_Error +_efl_ui_widget_factory_efl_ui_factory_bind_factory_bind(Eo *obj EINA_UNUSED, + Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, + const char *key EINA_UNUSED, + Efl_Ui_Factory *factory EINA_UNUSED) +{ + ERR("Efl.Ui.Widget_Factory doesn't support efl.ui.factory_bind.\n"); + return EINA_ERROR_NOT_IMPLEMENTED; +} + #include "efl_ui_property_bind_part.eo.c" #include "efl_ui_widget_factory.eo.c" diff --git a/src/lib/elementary/efl_ui_widget_factory.eo b/src/lib/elementary/efl_ui_widget_factory.eo index 82ce7292bd..7cdfab2887 100644 --- a/src/lib/elementary/efl_ui_widget_factory.eo +++ b/src/lib/elementary/efl_ui_widget_factory.eo @@ -21,6 +21,7 @@ class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Fa Efl.Ui.Factory.create; Efl.Ui.Factory.release; Efl.Ui.Property_Bind.property_bind; + Efl.Ui.Factory_Bind.factory_bind; Efl.Part.part_get; Efl.Object.finalize; } From e5ad8716bd1f0f94a9d6b789c99fc00721d419f8 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Tue, 24 Sep 2019 16:48:31 -0700 Subject: [PATCH 082/115] elementary: properly mark iterator usage in Efl.Ui.Factory. Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D10132 --- src/lib/efl/interfaces/efl_ui_factory.eo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo index 47dd203f6e..b0518a0755 100644 --- a/src/lib/efl/interfaces/efl_ui_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_factory.eo @@ -21,10 +21,10 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind Note: This is the function you need to implement for a custom factory, but if you want to use a factory, you should rely on @Efl.Ui.View_Factory.create_with_event.]] params { - models: iterator; [[Efl iterator providing the model to be associated to the new item. + models: iterator @move; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]] } - return: future; [[Created UI object.]] + return: future @move @no_unused; [[Created UI object.]] } release { [[Release a UI object and disconnect from models.]] From 10cdb070180e0f1e62d5b8e5d5164a19fbc51548 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 23 Sep 2019 20:43:47 +0200 Subject: [PATCH 083/115] elm: add basics test to create a destroy *every* widget with errors this simply creates packs, resizes, and destroys every single widget that we have in legacy elm. This i made to ensure that there are no mistakes in the construction chain. Additionally, a second test case checks that creation with none elm parents is erroring but not failing, this seems weird, but we have provided that in the past, so we should continue providing this. Differential Revision: https://phab.enlightenment.org/D10088 --- src/tests/elementary/elm_suite.c | 1 + src/tests/elementary/elm_suite.h | 1 + src/tests/elementary/elm_test_widget_basics.c | 137 ++++++++++++++++++ src/tests/elementary/meson.build | 3 +- 4 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 src/tests/elementary/elm_test_widget_basics.c diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c index 87fac6e4e1..d6aa4636e8 100644 --- a/src/tests/elementary/elm_suite.c +++ b/src/tests/elementary/elm_suite.c @@ -86,6 +86,7 @@ static const Efl_Test_Case etc[] = { { "elm_code_widget_selection", elm_code_test_widget_selection }, { "elm_code_widget_undo", elm_code_test_widget_undo }, { "elm_widget_focus", elm_test_widget_focus}, + { "elm_widget_basics", elm_test_widget_basics}, { NULL, NULL } }; diff --git a/src/tests/elementary/elm_suite.h b/src/tests/elementary/elm_suite.h index ba76b29615..67f5d0d5c4 100644 --- a/src/tests/elementary/elm_suite.h +++ b/src/tests/elementary/elm_suite.h @@ -84,6 +84,7 @@ void elm_test_slideshow(TCase *tc); void elm_test_spinner(TCase *tc); void elm_test_plug(TCase *tc); void elm_test_widget_focus(TCase *tc); +void elm_test_widget_basics(TCase *tc); void elm_code_file_test_load(TCase *tc); void elm_code_file_test_memory(TCase *tc); diff --git a/src/tests/elementary/elm_test_widget_basics.c b/src/tests/elementary/elm_test_widget_basics.c new file mode 100644 index 0000000000..e66a9ac149 --- /dev/null +++ b/src/tests/elementary/elm_test_widget_basics.c @@ -0,0 +1,137 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include +#include "elm_suite.h" + +typedef struct _Simple_Test_Widget +{ + Evas_Object* (*constructor)(Evas_Object *win); + const char *name; +} Simple_Test_Widget; + + +static const Simple_Test_Widget simple_widgets[] = { + {elm_flip_add, "flip"}, + {elm_frame_add, "frame"}, + {elm_player_add, "player"}, + {elm_video_add, "video"}, + {elm_ctxpopup_add, "ctxpopup"}, + {elm_fileselector_add, "fileselector"}, + {elm_hoversel_add, "hoversel"}, + {elm_multibuttonentry_add, "multibuttonentry"}, + {elm_naviframe_add, "naviframe"}, + {elm_popup_add, "popup"}, + {elm_actionslider_add, "actionslider"}, + {elm_bg_add, "bg"}, + {elm_box_add, "box"}, + {elm_bubble_add, "bubble"}, + {elm_calendar_add, "calendar"}, + {elm_button_add, "button"}, + {elm_check_add, "check"}, + {elm_clock_add, "clock"}, + {elm_colorselector_add, "colorselector"}, + {elm_conformant_add, "conformant"}, + {elm_dayselector_add, "dayselector"}, + {elm_entry_add, "entry"}, + {elm_flipselector_add, "flipselector"}, + {elm_gengrid_add, "gengrid"}, + {elm_genlist_add, "genlist"}, + {elm_glview_add, "glview"}, + {elm_grid_add, "grid"}, + {elm_hover_add, "hover"}, + {elm_icon_add, "icon"}, + {elm_image_add, "image"}, + {elm_index_add, "index"}, + {elm_label_add, "label"}, + {elm_layout_add, "layout"}, + {elm_list_add, "list"}, + {elm_map_add, "map"}, + {elm_mapbuf_add, "mapbuf"}, + {elm_menu_add, "menu"}, + {elm_notify_add, "notify"}, + {elm_panel_add, "panel"}, + {elm_panes_add, "panes"}, + {elm_photo_add, "photo"}, + {elm_photocam_add, "photocam"}, + {elm_plug_add, "plug"}, + {elm_prefs_add, "prefs"}, + {elm_progressbar_add, "progressbar"}, + {elm_radio_add, "radio"}, + {elm_route_add, "route"}, + {elm_separator_add, "seperator"}, + {elm_slider_add, "slider"}, + {elm_slideshow_add, "slideshow"}, + {elm_spinner_add, "spinner"}, + {elm_table_add, "table"}, + {elm_textpath_add, "textpath"}, + {elm_toolbar_add, "toolbar"}, + {elm_web_add, "web"}, + {elm_diskselector_add, "diskselector"}, + {elm_datetime_add, "datetime"}, + //{elm_combobox_add, "button"}, This is a beta widget which was never public and is written in a few ways that break basic assertions of widgets base class + //{elm_thumb_add, "button"}, This dies because of a ethumb bug, where the log domain is not correctly inited + //{elm_systray_add, "button"}, This is not a elm widget, but matches the API regax + //{elm_factory_add, "button"}, This is a beta widget which was never public but matches the API regax + {NULL, NULL}, +}; + +EFL_START_TEST(elm_test_widget_creation_easy) +{ + Evas_Object *win, *o; + win = win_add(); + + evas_object_resize(win, 200, 200); + evas_object_show(win); + for (int i = 0; simple_widgets[i].name; ++i) + { + o = simple_widgets[i].constructor(win); + ck_assert_ptr_nonnull(o); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, o); + evas_object_show(o); + evas_object_del(o); + } +} +EFL_END_TEST + +EFL_START_TEST(elm_test_widget_creation_error_parent) +{ + Evas_Object *win, *o, *parent; + Evas *evas; + + win = win_add(); + evas = evas_object_evas_get(win); + evas_object_resize(win, 200, 200); + evas_object_show(win); + + parent = evas_object_rectangle_add(evas); + + for (int i = 0; simple_widgets[i].name; ++i) + { + if (eina_streq(simple_widgets[i].name, "gengrid") || + eina_streq(simple_widgets[i].name, "genlist")) + continue; + if (eina_streq(simple_widgets[i].name, "datetime")) //this crashes in textblock + continue; + + EXPECT_ERROR_START; + o = simple_widgets[i].constructor(parent); + EXPECT_ERROR_END; + ck_assert_ptr_nonnull(o); + evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, o); + evas_object_show(o); + evas_object_del(o); + } +} +EFL_END_TEST + +void elm_test_widget_basics(TCase *tc) +{ + tcase_add_test(tc, elm_test_widget_creation_easy); + tcase_add_test(tc, elm_test_widget_creation_error_parent); +} diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build index f7d56d742f..54953158e5 100644 --- a/src/tests/elementary/meson.build +++ b/src/tests/elementary/meson.build @@ -99,7 +99,8 @@ elementary_suite_src = [ 'elm_code_test_widget_text.c', 'elm_code_test_widget_selection.c', 'elm_code_test_widget_undo.c', - 'elm_test_widget_focus.c' + 'elm_test_widget_focus.c', + 'elm_test_widget_basics.c' ] elementary_suite = executable('elementary_suite', From 7884a38dbd46baf4d9636663269bcbb53f6c0b97 Mon Sep 17 00:00:00 2001 From: SangHyeon Jade Lee Date: Wed, 25 Sep 2019 10:57:03 +0000 Subject: [PATCH 084/115] efl_ui : change selected_items_get to selected_iterator_new. multi_selectable_aync already changed name as selected_iterator_new so multi_selectable change name also for unity of API. not sure about we need unselected_items_get in multi_selectable, so skip to create new api for this time. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10148 --- .../elementary/efl_ui_list_example_1.c | 2 +- src/lib/elementary/efl_ui_collection.c | 2 +- src/lib/elementary/efl_ui_collection.eo | 4 ++-- src/lib/elementary/efl_ui_grid.eo | 2 +- src/lib/elementary/efl_ui_list.eo | 2 +- src/lib/elementary/efl_ui_multi_selectable.eo | 2 +- .../spec/efl_test_multi_selectable.c | 20 +++++++++---------- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/examples/elementary/efl_ui_list_example_1.c b/src/examples/elementary/efl_ui_list_example_1.c index cbd05d23d1..dab45ae261 100644 --- a/src/examples/elementary/efl_ui_list_example_1.c +++ b/src/examples/elementary/efl_ui_list_example_1.c @@ -30,7 +30,7 @@ _list_selected(void *data EINA_UNUSED, const Efl_Event *ev) Eo *item = ev->info, *tmp; printf("list item [%p:%d] is %s\n", item, efl_ui_item_index_get(item), (efl_ui_selectable_selected_get(item)? "selected" : "unselected")); - Eina_Iterator *selects = efl_ui_selected_items_get(list); + Eina_Iterator *selects = efl_ui_selected_iterator_new(list); EINA_ITERATOR_FOREACH(selects, tmp) printf("selected [%p:%d] ", tmp, efl_ui_item_index_get(tmp)); diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c index b71b1af32c..abef6732c1 100644 --- a/src/lib/elementary/efl_ui_collection.c +++ b/src/lib/elementary/efl_ui_collection.c @@ -261,7 +261,7 @@ _efl_ui_collection_efl_ui_single_selectable_last_selected_get(const Eo *obj EINA } EOLIAN static Eina_Iterator* -_efl_ui_collection_efl_ui_multi_selectable_selected_items_get(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) +_efl_ui_collection_efl_ui_multi_selectable_selected_iterator_new(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) { return eina_list_iterator_new(pd->selected); } diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo index 507477c2bc..28ecb4975d 100644 --- a/src/lib/elementary/efl_ui_collection.eo +++ b/src/lib/elementary/efl_ui_collection.eo @@ -24,7 +24,7 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements If all items do not fit in the current widget size scrolling facilities are provided. Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_items_get. + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. ]] methods { item_scroll { @@ -82,7 +82,7 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Ui.Widget.focus_state_apply; Efl.Ui.Focus.Manager.move; Efl.Ui.Single_Selectable.last_selected { get; } - Efl.Ui.Multi_Selectable.selected_items_get; + Efl.Ui.Multi_Selectable.selected_iterator_new; Efl.Ui.Multi_Selectable.select_mode {get; set;} Efl.Ui.Multi_Selectable.all_select; Efl.Ui.Multi_Selectable.all_unselect; diff --git a/src/lib/elementary/efl_ui_grid.eo b/src/lib/elementary/efl_ui_grid.eo index 72c2bfface..0b8be563df 100644 --- a/src/lib/elementary/efl_ui_grid.eo +++ b/src/lib/elementary/efl_ui_grid.eo @@ -8,7 +8,7 @@ class Efl.Ui.Grid extends Efl.Ui.Collection @Efl.Ui.Layout_Orientable.orientation. Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_items_get. + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. @Efl.Ui.Grid supports grouping by using @Efl.Ui.Group_Item objects. Group headers are displayed at the top of the viewport if items belonging to the group diff --git a/src/lib/elementary/efl_ui_list.eo b/src/lib/elementary/efl_ui_list.eo index c4481361f6..37173c2e0e 100644 --- a/src/lib/elementary/efl_ui_list.eo +++ b/src/lib/elementary/efl_ui_list.eo @@ -8,7 +8,7 @@ class Efl.Ui.List extends Efl.Ui.Collection @Efl.Ui.Layout_Orientable.orientation. Items inside this widget can be selected according to the @Efl.Ui.Multi_Selectable.select_mode - policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_items_get. + policy, and the selection can be retrieved with @Efl.Ui.Multi_Selectable.selected_iterator_new. @Efl.Ui.List supports grouping by using @Efl.Ui.Group_Item objects. Group headers are displayed at the top or left side of the viewport if items belonging to the group diff --git a/src/lib/elementary/efl_ui_multi_selectable.eo b/src/lib/elementary/efl_ui_multi_selectable.eo index 44b39942fe..ea8e376ad2 100644 --- a/src/lib/elementary/efl_ui_multi_selectable.eo +++ b/src/lib/elementary/efl_ui_multi_selectable.eo @@ -17,7 +17,7 @@ interface @beta Efl.Ui.Multi_Selectable extends Efl.Ui.Single_Selectable mode: Efl.Ui.Select_Mode; [[Type of selection of children]] } } - selected_items_get { + selected_iterator_new { [[Get the selected items in a iterator. The iterator sequence will be decided by selection.]] return: iterator @move @no_unused; [[User has to free the iterator after usage.]] } diff --git a/src/tests/elementary/spec/efl_test_multi_selectable.c b/src/tests/elementary/spec/efl_test_multi_selectable.c index ac0e6424b7..5e2c719d77 100644 --- a/src/tests/elementary/spec/efl_test_multi_selectable.c +++ b/src/tests/elementary/spec/efl_test_multi_selectable.c @@ -52,7 +52,7 @@ EFL_START_TEST(test_multi_select) ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_TRUE); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); @@ -87,7 +87,7 @@ EFL_START_TEST(test_multi_select_removal) c = 0; ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), NULL); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); @@ -114,7 +114,7 @@ EFL_START_TEST(test_single_select) ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 2)); @@ -144,7 +144,7 @@ EFL_START_TEST(test_none_select) ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_FALSE); ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), NULL); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); @@ -157,7 +157,7 @@ EFL_START_TEST(all_select_api) efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); efl_ui_all_select(widget); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 3); @@ -175,7 +175,7 @@ EFL_START_TEST(all_unselect_api) efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE); efl_ui_all_unselect(widget); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 0); ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); @@ -190,7 +190,7 @@ EFL_START_TEST(range_unselect) efl_ui_all_select(widget); efl_ui_range_unselect(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); } @@ -204,7 +204,7 @@ EFL_START_TEST(range_unselect2) efl_ui_all_select(widget); efl_ui_range_unselect(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 1); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); } @@ -216,7 +216,7 @@ EFL_START_TEST(range_select) efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); efl_ui_range_select(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); @@ -229,7 +229,7 @@ EFL_START_TEST(range_select2) efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); efl_ui_range_select(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); - _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); + _iterator_to_array(&arr_selected, efl_ui_selected_iterator_new(widget)); ck_assert_int_eq(eina_array_count(arr_selected), 2); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); From 6592fefcdd3c3d59b0619d1c1ce3a5d5dd7fadef Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Wed, 25 Sep 2019 21:46:54 +0200 Subject: [PATCH 085/115] Revert "elm: add basics test to create a destroy *every* widget with errors" This reverts commit 10cdb070180e0f1e62d5b8e5d5164a19fbc51548. this does not pass on ci ... o.O --- src/tests/elementary/elm_suite.c | 1 - src/tests/elementary/elm_suite.h | 1 - src/tests/elementary/elm_test_widget_basics.c | 137 ------------------ src/tests/elementary/meson.build | 3 +- 4 files changed, 1 insertion(+), 141 deletions(-) delete mode 100644 src/tests/elementary/elm_test_widget_basics.c diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c index d6aa4636e8..87fac6e4e1 100644 --- a/src/tests/elementary/elm_suite.c +++ b/src/tests/elementary/elm_suite.c @@ -86,7 +86,6 @@ static const Efl_Test_Case etc[] = { { "elm_code_widget_selection", elm_code_test_widget_selection }, { "elm_code_widget_undo", elm_code_test_widget_undo }, { "elm_widget_focus", elm_test_widget_focus}, - { "elm_widget_basics", elm_test_widget_basics}, { NULL, NULL } }; diff --git a/src/tests/elementary/elm_suite.h b/src/tests/elementary/elm_suite.h index 67f5d0d5c4..ba76b29615 100644 --- a/src/tests/elementary/elm_suite.h +++ b/src/tests/elementary/elm_suite.h @@ -84,7 +84,6 @@ void elm_test_slideshow(TCase *tc); void elm_test_spinner(TCase *tc); void elm_test_plug(TCase *tc); void elm_test_widget_focus(TCase *tc); -void elm_test_widget_basics(TCase *tc); void elm_code_file_test_load(TCase *tc); void elm_code_file_test_memory(TCase *tc); diff --git a/src/tests/elementary/elm_test_widget_basics.c b/src/tests/elementary/elm_test_widget_basics.c deleted file mode 100644 index e66a9ac149..0000000000 --- a/src/tests/elementary/elm_test_widget_basics.c +++ /dev/null @@ -1,137 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include -#include "elm_suite.h" - -typedef struct _Simple_Test_Widget -{ - Evas_Object* (*constructor)(Evas_Object *win); - const char *name; -} Simple_Test_Widget; - - -static const Simple_Test_Widget simple_widgets[] = { - {elm_flip_add, "flip"}, - {elm_frame_add, "frame"}, - {elm_player_add, "player"}, - {elm_video_add, "video"}, - {elm_ctxpopup_add, "ctxpopup"}, - {elm_fileselector_add, "fileselector"}, - {elm_hoversel_add, "hoversel"}, - {elm_multibuttonentry_add, "multibuttonentry"}, - {elm_naviframe_add, "naviframe"}, - {elm_popup_add, "popup"}, - {elm_actionslider_add, "actionslider"}, - {elm_bg_add, "bg"}, - {elm_box_add, "box"}, - {elm_bubble_add, "bubble"}, - {elm_calendar_add, "calendar"}, - {elm_button_add, "button"}, - {elm_check_add, "check"}, - {elm_clock_add, "clock"}, - {elm_colorselector_add, "colorselector"}, - {elm_conformant_add, "conformant"}, - {elm_dayselector_add, "dayselector"}, - {elm_entry_add, "entry"}, - {elm_flipselector_add, "flipselector"}, - {elm_gengrid_add, "gengrid"}, - {elm_genlist_add, "genlist"}, - {elm_glview_add, "glview"}, - {elm_grid_add, "grid"}, - {elm_hover_add, "hover"}, - {elm_icon_add, "icon"}, - {elm_image_add, "image"}, - {elm_index_add, "index"}, - {elm_label_add, "label"}, - {elm_layout_add, "layout"}, - {elm_list_add, "list"}, - {elm_map_add, "map"}, - {elm_mapbuf_add, "mapbuf"}, - {elm_menu_add, "menu"}, - {elm_notify_add, "notify"}, - {elm_panel_add, "panel"}, - {elm_panes_add, "panes"}, - {elm_photo_add, "photo"}, - {elm_photocam_add, "photocam"}, - {elm_plug_add, "plug"}, - {elm_prefs_add, "prefs"}, - {elm_progressbar_add, "progressbar"}, - {elm_radio_add, "radio"}, - {elm_route_add, "route"}, - {elm_separator_add, "seperator"}, - {elm_slider_add, "slider"}, - {elm_slideshow_add, "slideshow"}, - {elm_spinner_add, "spinner"}, - {elm_table_add, "table"}, - {elm_textpath_add, "textpath"}, - {elm_toolbar_add, "toolbar"}, - {elm_web_add, "web"}, - {elm_diskselector_add, "diskselector"}, - {elm_datetime_add, "datetime"}, - //{elm_combobox_add, "button"}, This is a beta widget which was never public and is written in a few ways that break basic assertions of widgets base class - //{elm_thumb_add, "button"}, This dies because of a ethumb bug, where the log domain is not correctly inited - //{elm_systray_add, "button"}, This is not a elm widget, but matches the API regax - //{elm_factory_add, "button"}, This is a beta widget which was never public but matches the API regax - {NULL, NULL}, -}; - -EFL_START_TEST(elm_test_widget_creation_easy) -{ - Evas_Object *win, *o; - win = win_add(); - - evas_object_resize(win, 200, 200); - evas_object_show(win); - for (int i = 0; simple_widgets[i].name; ++i) - { - o = simple_widgets[i].constructor(win); - ck_assert_ptr_nonnull(o); - evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_win_resize_object_add(win, o); - evas_object_show(o); - evas_object_del(o); - } -} -EFL_END_TEST - -EFL_START_TEST(elm_test_widget_creation_error_parent) -{ - Evas_Object *win, *o, *parent; - Evas *evas; - - win = win_add(); - evas = evas_object_evas_get(win); - evas_object_resize(win, 200, 200); - evas_object_show(win); - - parent = evas_object_rectangle_add(evas); - - for (int i = 0; simple_widgets[i].name; ++i) - { - if (eina_streq(simple_widgets[i].name, "gengrid") || - eina_streq(simple_widgets[i].name, "genlist")) - continue; - if (eina_streq(simple_widgets[i].name, "datetime")) //this crashes in textblock - continue; - - EXPECT_ERROR_START; - o = simple_widgets[i].constructor(parent); - EXPECT_ERROR_END; - ck_assert_ptr_nonnull(o); - evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_win_resize_object_add(win, o); - evas_object_show(o); - evas_object_del(o); - } -} -EFL_END_TEST - -void elm_test_widget_basics(TCase *tc) -{ - tcase_add_test(tc, elm_test_widget_creation_easy); - tcase_add_test(tc, elm_test_widget_creation_error_parent); -} diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build index 54953158e5..f7d56d742f 100644 --- a/src/tests/elementary/meson.build +++ b/src/tests/elementary/meson.build @@ -99,8 +99,7 @@ elementary_suite_src = [ 'elm_code_test_widget_text.c', 'elm_code_test_widget_selection.c', 'elm_code_test_widget_undo.c', - 'elm_test_widget_focus.c', - 'elm_test_widget_basics.c' + 'elm_test_widget_focus.c' ] elementary_suite = executable('elementary_suite', From 25cba85a6a060c89d77ac76c63cc1979b6388dbe Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 15:50:35 -0400 Subject: [PATCH 086/115] efl: improve error message to be really useful. Reviewers: zmike, bu5hm4n Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10168 --- src/lib/efl/interfaces/efl_file.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_file.c b/src/lib/efl/interfaces/efl_file.c index d6f262d3e2..a35710f0f3 100644 --- a/src/lib/efl/interfaces/efl_file.c +++ b/src/lib/efl/interfaces/efl_file.c @@ -172,7 +172,11 @@ efl_file_simple_load(Eo *obj, const char *file, const char *key) { EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); efl_ref(obj); - EINA_SAFETY_ON_TRUE_GOTO(efl_file_set(obj, file), fail); + if (efl_file_set(obj, file)) + { + EINA_LOG_ERR("File set to '%s' on '%s' failed.", file, efl_debug_name_get(obj)); + goto fail; + } efl_file_key_set(obj, key); if (file) { From 1115752451f8c0095762a407dec08f42a7cbca06 Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Wed, 25 Sep 2019 16:15:43 -0400 Subject: [PATCH 087/115] elm: Avoid maybe unitialized variable accesses Reviewers: cedric, bu5hm4n, zmike, felipealmeida Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10170 --- src/lib/elementary/efl_ui_collection_view.c | 2 +- src/lib/elementary/efl_ui_layout.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index aa3b9c56d4..a13e69e49a 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -494,7 +494,7 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v) Efl_Ui_Collection_Request *request = data; Efl_Gfx_Entity *child; unsigned int i, len; - uint64_t updated_size_start_id, updated_entity_start_id; + uint64_t updated_size_start_id = 0, updated_entity_start_id = 0; Eina_Bool updated_size = EINA_FALSE, updated_entity = EINA_FALSE; EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 1797d8a45f..05a9063db1 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -522,7 +522,7 @@ EOLIAN static Eina_Error _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) { Eina_Error theme_apply_ret, theme_apply_internal_ret; - Elm_Widget_Smart_Data *wd; + Elm_Widget_Smart_Data *wd = NULL; char buf[64]; static unsigned int version = 0; From 31b99e67c475e7687dbed64514e1692f552506e8 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 11:45:38 -0300 Subject: [PATCH 088/115] elementary: stabilize Efl.Ui.Widget_Factory. Summary: T8271 Depends on D10130 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7885 Differential Revision: https://phab.enlightenment.org/D10131 --- src/lib/elementary/efl_ui_widget_factory.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_widget_factory.eo b/src/lib/elementary/efl_ui_widget_factory.eo index 7cdfab2887..47367b395c 100644 --- a/src/lib/elementary/efl_ui_widget_factory.eo +++ b/src/lib/elementary/efl_ui_widget_factory.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Factory, Efl.Part +class Efl.Ui.Widget_Factory extends Efl.Loop_Consumer implements Efl.Ui.Factory, Efl.Part { [[Efl Ui Factory that provides @Efl.Ui.Widget. From bf1f7cfab78b408bc015dca299bdcef6b1776ea3 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 11:55:30 -0300 Subject: [PATCH 089/115] efl: stabilize Efl.Ui.Factory. Summary: T8262 Depends on D10132 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7885 Differential Revision: https://phab.enlightenment.org/D10133 --- src/lib/efl/interfaces/efl_ui_factory.eo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo index b0518a0755..61d0ce961e 100644 --- a/src/lib/efl/interfaces/efl_ui_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_factory.eo @@ -1,10 +1,10 @@ -struct @beta Efl.Ui.Factory_Item_Created_Event { +struct Efl.Ui.Factory_Item_Created_Event { [[EFL UI Factory event structure provided when an item was just created.]] model: Efl.Model; [[The model already set on the new item.]] item: Efl.Gfx.Entity; [[The item that was just created.]] } -interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind +interface Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind { [[Interface for factory-pattern object creation. From 31dda961147428b609c7d82735911a9ec1737c62 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 11:56:54 -0300 Subject: [PATCH 090/115] efl: stabilize Efl.Ui.Property_Bind Summary: T7579 Depends on D10133 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7885 Differential Revision: https://phab.enlightenment.org/D10134 --- src/lib/efl/interfaces/efl_ui_property_bind.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_ui_property_bind.eo b/src/lib/efl/interfaces/efl_ui_property_bind.eo index 31d66e0134..aafd772e58 100644 --- a/src/lib/efl/interfaces/efl_ui_property_bind.eo +++ b/src/lib/efl/interfaces/efl_ui_property_bind.eo @@ -6,7 +6,7 @@ struct Efl.Ui.Property_Event { changed_properties: array; [[List of changed properties]] } -interface @beta Efl.Ui.Property_Bind +interface Efl.Ui.Property_Bind { [[Efl UI Property_Bind interface. view object can have @Efl.Model to manage the data, From c3db2793043b40c943f589ac37ebf60cd3385d4e Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 11:59:45 -0300 Subject: [PATCH 091/115] efl: stabilize Efl.Ui.Factory_Bind Summary: T8264 Depends on D10134 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7885 Differential Revision: https://phab.enlightenment.org/D10135 --- src/lib/efl/interfaces/efl_ui_factory_bind.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_ui_factory_bind.eo b/src/lib/efl/interfaces/efl_ui_factory_bind.eo index 740c627b82..f924073954 100644 --- a/src/lib/efl/interfaces/efl_ui_factory_bind.eo +++ b/src/lib/efl/interfaces/efl_ui_factory_bind.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Ui.Factory_Bind +interface Efl.Ui.Factory_Bind { [[Efl UI Property interface. view object can have @Efl.Model and need to set cotent with those model stored data. From 2078fe00e07e7e86f2c784e8b676cbfdfa697ea4 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 12:00:28 -0300 Subject: [PATCH 092/115] efl: stabilize Efl.Model Summary: T8267 Depends on D10135 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7885 Differential Revision: https://phab.enlightenment.org/D10136 --- src/lib/efl/interfaces/efl_model.eo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo index 5713df6dc4..477e9e10b5 100644 --- a/src/lib/efl/interfaces/efl_model.eo +++ b/src/lib/efl/interfaces/efl_model.eo @@ -1,4 +1,4 @@ -struct @beta Efl.Model_Property_Event { +struct Efl.Model_Property_Event { [[EFL model property event data structure]] changed_properties: array; [[List of changed properties]] invalidated_properties: array; [[Removed properties identified by name]] @@ -13,7 +13,7 @@ struct @beta Efl.Model_Children_Event { the parent, it will be available here.]] } -interface @beta Efl.Model +interface Efl.Model { [[Basic Model abstraction. @@ -178,8 +178,8 @@ interface @beta Efl.Model properties,changed: Efl.Model_Property_Event; [[Event dispatched when properties list is available.]] - child,added: Efl.Model_Children_Event; [[Event dispatched when new child is added.]] - child,removed: Efl.Model_Children_Event; [[Event dispatched when child is removed.]] + child,added @beta: Efl.Model_Children_Event; [[Event dispatched when new child is added.]] + child,removed @beta: Efl.Model_Children_Event; [[Event dispatched when child is removed.]] children,count,changed: void; [[Event dispatched when children count is finished.]] } } From 4473483503813a3ae79b88cd9d47fa1edfcde9ee Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 12:02:14 -0300 Subject: [PATCH 093/115] elementary: stabilize Efl.Ui.View_Model Summary: T8268 Depends on D10136 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7885 Differential Revision: https://phab.enlightenment.org/D10137 --- src/lib/elementary/efl_ui_view_model.eo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/elementary/efl_ui_view_model.eo b/src/lib/elementary/efl_ui_view_model.eo index a5caaa8d1c..ebc25dd342 100644 --- a/src/lib/elementary/efl_ui_view_model.eo +++ b/src/lib/elementary/efl_ui_view_model.eo @@ -17,7 +17,7 @@ function @beta EflUiViewModelPropertySet { return: future; [[The value that was finally set.]] }; -class @beta Efl.Ui.View_Model extends Efl.Composite_Model +class Efl.Ui.View_Model extends Efl.Composite_Model { [[Efl model providing helpers for custom properties used when linking a model to a view and you need to generate/adapt values for display. @@ -60,7 +60,7 @@ class @beta Efl.Ui.View_Model extends Efl.Composite_Model } return: Eina.Error; } - property_logic_add { + property_logic_add @beta { [[Add callbacks that will be triggered when someone ask for the specified property name when getting or setting a property. @@ -79,7 +79,7 @@ class @beta Efl.Ui.View_Model extends Efl.Composite_Model } return: Eina.Error; } - property_logic_del { + property_logic_del @beta { [[Delete previously added callbacks that were triggered when someone asked for the specified property name when getting or setting a property. From acb314fb1dade1cc37b2a2025da928cf5b338940 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 12:03:27 -0300 Subject: [PATCH 094/115] ecore: stabilize Efl.Composite_Model. Summary: Depends on D10137 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7885 Differential Revision: https://phab.enlightenment.org/D10138 --- src/lib/ecore/efl_composite_model.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ecore/efl_composite_model.eo b/src/lib/ecore/efl_composite_model.eo index 4244e930bc..34c2e203d4 100644 --- a/src/lib/ecore/efl_composite_model.eo +++ b/src/lib/ecore/efl_composite_model.eo @@ -1,4 +1,4 @@ -class @beta Efl.Composite_Model extends Efl.Loop_Model implements Efl.Ui.View +class Efl.Composite_Model extends Efl.Loop_Model implements Efl.Ui.View { [[Efl model for all composite class which provide a unified API to set source of data. From a55580ab27d268af8c559edd762cdf09ba31fbf8 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 12:05:38 -0300 Subject: [PATCH 095/115] ecore: stabilize Efl.Loop_Model Summary: T8270 Depends on D10138 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7885 Differential Revision: https://phab.enlightenment.org/D10139 --- src/lib/ecore/efl_loop_model.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ecore/efl_loop_model.eo b/src/lib/ecore/efl_loop_model.eo index 3a15490fce..ec2488e4fd 100644 --- a/src/lib/ecore/efl_loop_model.eo +++ b/src/lib/ecore/efl_loop_model.eo @@ -1,4 +1,4 @@ -abstract @beta Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model +abstract Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model { data: null; methods { From d2adb0d3086025ba3a7f4fb92eb206db7d29b861 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:55:19 -0400 Subject: [PATCH 096/115] theme: /efl,orient,(horizontal|vertical)/efl,state,(horizontal|vertical)/ Summary: these signals aren't actually used by anything, just changing for grep ref T8231 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10156 --- data/elementary/themes/edc/efl/tab_bar.edc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/elementary/themes/edc/efl/tab_bar.edc b/data/elementary/themes/edc/efl/tab_bar.edc index 4fc3c8d75e..6573bfe7c2 100644 --- a/data/elementary/themes/edc/efl/tab_bar.edc +++ b/data/elementary/themes/edc/efl/tab_bar.edc @@ -436,13 +436,13 @@ group { "efl/tab_bar/tab"; programs { EFL_UI_CLICKABLE_PART_BIND(event) program { - signal: "efl,orient,horizontal"; source: "efl"; + signal: "efl,state,horizontal"; source: "efl"; action: STATE_SET "default" 0.0; target: "base"; target: "bend_clip"; } program { - signal: "efl,orient,vertical"; source: "efl"; + signal: "efl,state,vertical"; source: "efl"; action: STATE_SET "vert" 0.0; target: "base"; target: "bend_clip"; From 75c8fd1cc297b6c14f1626ad10483f948ea064e5 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:55:24 -0400 Subject: [PATCH 097/115] api: move eo-based radio and check widgets to use selectable signal names Summary: this is a more standardized name ref T8231 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10157 --- data/elementary/themes/edc/efl/check.edc | 16 ++++++++-------- data/elementary/themes/edc/efl/radio.edc | 4 ++-- src/lib/elementary/efl_ui_check.c | 22 +++++++++++----------- src/lib/elementary/efl_ui_radio.c | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/data/elementary/themes/edc/efl/check.edc b/data/elementary/themes/edc/efl/check.edc index cccd10b824..62d85ed085 100644 --- a/data/elementary/themes/edc/efl/check.edc +++ b/data/elementary/themes/edc/efl/check.edc @@ -258,12 +258,12 @@ group { "efl/check"; data.item: "version" "123"; programs { EFL_UI_CLICKABLE_PART_BIND(event) program { - signal: "efl,state,check,on"; source: "efl"; + signal: "efl,state,selected"; source: "efl"; action: STATE_SET "selected" 0.0; target: "indicator"; } program { - signal: "efl,state,check,off"; source: "efl"; + signal: "efl,state,unselected"; source: "efl"; action: STATE_SET "default" 0.0; target: "indicator"; } @@ -773,7 +773,7 @@ group { "efl/check:toggle"; data.item: "version" "123"; programs { EFL_UI_CLICKABLE_PART_BIND(event) program { - signal: "efl,state,check,on"; source: "efl"; + signal: "efl,state,selected"; source: "efl"; script { new Float:drag; if (get_int(is_rtl) == 0) { @@ -785,7 +785,7 @@ group { "efl/check:toggle"; data.item: "version" "123"; } } program { - signal: "efl,state,check,off"; source: "efl"; + signal: "efl,state,unselected"; source: "efl"; script { new Float:drag; if (get_int(is_rtl) == 0) { @@ -809,9 +809,9 @@ group { "efl/check:toggle"; data.item: "version" "123"; } if (((get_int(is_rtl) == 1) && (dx <= 0.5)) || (get_int(is_rtl) == 0) && (dx > 0.5)) { - emit("efl,action,check,off", "efl"); + emit("efl,action,unselect", "efl"); } else { - emit("efl,action,check,on", "efl"); + emit("efl,action,select", "efl"); } } } @@ -842,9 +842,9 @@ group { "efl/check:toggle"; data.item: "version" "123"; } if (((get_int(is_rtl) == 1) && (dx <= 0.5)) || (get_int(is_rtl) == 0) && (dx > 0.5)) { - emit("efl,action,check,on", "efl"); + emit("efl,action,select", "efl"); } else { - emit("efl,action,check,off", "efl"); + emit("efl,action,unselect", "efl"); } set_int(was_drag, 1); set_int(is_drag, 0); diff --git a/data/elementary/themes/edc/efl/radio.edc b/data/elementary/themes/edc/efl/radio.edc index 4efbd8eff8..c2fc2141c5 100644 --- a/data/elementary/themes/edc/efl/radio.edc +++ b/data/elementary/themes/edc/efl/radio.edc @@ -225,12 +225,12 @@ group { "efl/radio"; programs { EFL_UI_CLICKABLE_PART_BIND(event) program { - signal: "efl,state,radio,on"; source: "efl"; + signal: "efl,state,selected"; source: "efl"; action: STATE_SET "selected" 0.0; target: "indicator"; } program { - signal: "efl,state,radio,off"; source: "efl"; + signal: "efl,state,unselected"; source: "efl"; action: STATE_SET "default" 0.0; target: "indicator"; } diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c index 190242e3ef..15f528168a 100644 --- a/src/lib/elementary/efl_ui_check.c +++ b/src/lib/elementary/efl_ui_check.c @@ -79,14 +79,14 @@ _activate(Evas_Object *obj) // so that we can distinguish between state change by user or state change // by calling state_change() api. Keep both the signal for backward compatibility // and remove "elm,state,check,on" signal emission when we can break ABI. - // efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,check,*" + // efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,*selected" if (elm_widget_is_legacy(obj)) { elm_layout_signal_emit(obj, "elm,activate,check,on", "elm"); } else { - elm_layout_signal_emit(obj, "efl,activate,check,on", "efl"); + elm_layout_signal_emit(obj, "efl,state,selected", "efl"); } if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) @@ -98,14 +98,14 @@ _activate(Evas_Object *obj) // so that we can distinguish between state change by user or state change // by calling state_change() api. Keep both the signal for backward compatibility // and remove "elm,state,check,off" signal emission when we can break ABI. - // efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,check,*" + // efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,*selected" if (elm_widget_is_legacy(obj)) { elm_layout_signal_emit(obj, "elm,activate,check,off", "elm"); } else { - elm_layout_signal_emit(obj, "efl,activate,check,off", "efl"); + elm_layout_signal_emit(obj, "efl,state,unselected", "efl"); } if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) @@ -113,7 +113,7 @@ _activate(Evas_Object *obj) } //This commit will update the theme with the correct signals // "elm,state,check,on" or "elm,state,check,off" for legacy - // "efl,state,check,on" or "efl,state,check,off" for eo-api + // "efl,state,selected" or "efl,state,unselected" for eo-api efl_ui_selectable_selected_set(obj, !efl_ui_selectable_selected_get(obj)); if (elm_widget_is_legacy(obj)) _check_legacy_event(obj); @@ -174,9 +174,9 @@ _efl_ui_check_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Check_Data *sd EINA_UNUS else { if (!efl_ui_selectable_selected_get(obj)) - elm_layout_signal_emit(obj, "efl,state,check,off", "efl"); + elm_layout_signal_emit(obj, "efl,state,unselected", "efl"); else - elm_layout_signal_emit(obj, "efl,state,check,on", "efl"); + elm_layout_signal_emit(obj, "efl,state,selected", "efl"); } edje_object_message_signal_process(wd->resize_obj); @@ -310,9 +310,9 @@ _efl_ui_check_efl_ui_selectable_selected_set(Eo *obj, Efl_Ui_Check_Data *pd, Ein else { if (value == 1) - elm_layout_signal_emit(obj, "efl,state,check,on", "efl"); + elm_layout_signal_emit(obj, "efl,state,selected", "efl"); else - elm_layout_signal_emit(obj, "efl,state,check,off", "efl"); + elm_layout_signal_emit(obj, "efl,state,unselected", "efl"); } edje_object_message_signal_process(wd->resize_obj); @@ -345,9 +345,9 @@ _efl_ui_check_efl_object_constructor(Eo *obj, Efl_Ui_Check_Data *pd EINA_UNUSED) else { efl_layout_signal_callback_add - (wd->resize_obj, "efl,action,check,on", "*", obj, _on_check_on, NULL); + (wd->resize_obj, "efl,action,select", "*", obj, _on_check_on, NULL); efl_layout_signal_callback_add - (wd->resize_obj, "efl,action,check,off", "*", obj, _on_check_off, NULL); + (wd->resize_obj, "efl,action,unselect", "*", obj, _on_check_off, NULL); efl_event_callback_add(obj, EFL_INPUT_EVENT_CLICKED, _clicked_cb, obj); } diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c index 18f0c6b3c3..e631cb81f3 100644 --- a/src/lib/elementary/efl_ui_radio.c +++ b/src/lib/elementary/efl_ui_radio.c @@ -170,8 +170,8 @@ _efl_ui_radio_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Radio_Data *sd EINA_UNUS } else { - if (efl_ui_selectable_selected_get(obj)) elm_layout_signal_emit(obj, "efl,state,radio,on", "efl"); - else elm_layout_signal_emit(obj, "efl,state,radio,off", "efl"); + if (efl_ui_selectable_selected_get(obj)) elm_layout_signal_emit(obj, "efl,state,selected", "efl"); + else elm_layout_signal_emit(obj, "efl,state,unselected", "efl"); } edje_object_message_signal_process(wd->resize_obj); From f24ce654c0c20ac77644e2021e2271ec6c58c67f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:55:29 -0400 Subject: [PATCH 098/115] efl_ui/layout: add mechanism for deferring versioned theme signals Summary: the theme version isn't available until the theme has been applied, so we can create an array of all the pending signals and defer them until such time as we get a theme or destroy the object this is internal and can be reworked at a later time as needed ref T8231 Depends on D10157 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10164 --- src/lib/elementary/efl_ui_layout.c | 46 ++++++++++++++++++++++++++ src/lib/elementary/elm_widget_layout.h | 1 + 2 files changed, 47 insertions(+) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 05a9063db1..2d73dee6f0 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -70,6 +70,13 @@ static const char *_efl_ui_layout_swallow_parts[] = { NULL }; +typedef struct _Deferred_Version_Signal +{ + Eina_Stringshare *old_sig; + Eina_Stringshare *new_sig; + unsigned int version_threshold; +} Deferred_Version_Signal; + typedef struct _Efl_Ui_Layout_Factory_Tracking Efl_Ui_Layout_Factory_Tracking; struct _Efl_Ui_Layout_Factory_Tracking @@ -222,6 +229,19 @@ _efl_ui_layout_subobjs_calc_set(Eo *obj, Eina_Bool set) sd->calc_subobjs = !!set; } +static void +_defer_version_signal(Efl_Ui_Layout_Data *sd, Eina_Stringshare *old_sig, Eina_Stringshare *new_sig, unsigned int version_threshold) +{ + Deferred_Version_Signal dvs; + if (!sd->deferred_signals) + sd->deferred_signals = eina_inarray_new(sizeof(Deferred_Version_Signal), 5); + EINA_SAFETY_ON_NULL_RETURN(sd->deferred_signals); + dvs.old_sig = old_sig; + dvs.new_sig = new_sig; + dvs.version_threshold = version_threshold; + eina_inarray_push(sd->deferred_signals, &dvs); +} + /* common content cases for layout objects: icon and text */ static inline void _signals_emit(Eo *obj, @@ -563,6 +583,21 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) } } } + if (sd->deferred_signals) + { + do + { + Deferred_Version_Signal *dvs = eina_inarray_pop(sd->deferred_signals); + + if (sd->version < dvs->version_threshold) + efl_layout_signal_emit(sd->obj, dvs->old_sig, "efl"); + else + efl_layout_signal_emit(sd->obj, dvs->new_sig, "efl"); + eina_stringshare_del(dvs->old_sig); + eina_stringshare_del(dvs->new_sig); + } while (eina_inarray_count(sd->deferred_signals)); + ELM_SAFE_FREE(sd->deferred_signals, eina_inarray_free); + } if (!version) { snprintf(buf, sizeof(buf), "%d%d", EFL_VERSION_MAJOR, EFL_VERSION_MINOR); @@ -903,6 +938,17 @@ _efl_ui_layout_base_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_Data *sd) sd->connect.signals = NULL; eina_hash_free(sd->connect.factories); sd->connect.factories = NULL; + if (sd->deferred_signals) + { + do + { + Deferred_Version_Signal *dvs = eina_inarray_pop(sd->deferred_signals); + + eina_stringshare_del(dvs->old_sig); + eina_stringshare_del(dvs->new_sig); + } while (eina_inarray_count(sd->deferred_signals)); + ELM_SAFE_FREE(sd->deferred_signals, eina_inarray_free); + } /* let's make our Edje object the *last* to be processed, since it * may (smart) parent other sub objects here */ diff --git a/src/lib/elementary/elm_widget_layout.h b/src/lib/elementary/elm_widget_layout.h index 5e411eb4c5..299fdc11a6 100644 --- a/src/lib/elementary/elm_widget_layout.h +++ b/src/lib/elementary/elm_widget_layout.h @@ -53,6 +53,7 @@ typedef struct _Efl_Ui_Layout_Data Eina_List *subs; /**< List of Elm_Layout_Sub_Object_Data structs, to hold the actual sub objects such as text, content and the children of box and table. */ Eina_List *edje_signals; /**< The list of edje signal callbacks. */ Eina_List *parts_cursors; /**< The list of cursor names of layout parts. This is a list of Elm_Layout_Sub_Object_Cursor struct. */ + Eina_Inarray *deferred_signals; /**< signals which were generated during construction */ struct { Eina_Hash *properties; /**< The list of properties connected to layout parts. */ From 9b18e5a29160a631943b5b99e305a41e8aa16410 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:55:35 -0400 Subject: [PATCH 099/115] theme: efl,state,(content|text),(set|unset) -> efl,(content|text),(set|unset) Summary: this is versioned, so the correct signal will always be emitted for the theme version that is provided ref T8231 Depends on D10164 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10158 --- data/elementary/themes/edc/efl/button.edc | 16 +++++++------- data/elementary/themes/edc/efl/check.edc | 16 +++++++------- data/elementary/themes/edc/efl/popup.edc | 4 ++-- data/elementary/themes/edc/efl/progress.edc | 16 +++++++------- data/elementary/themes/edc/efl/radio.edc | 8 +++---- data/elementary/themes/edc/efl/tab_bar.edc | 4 ++-- src/lib/elementary/efl_ui_layout.c | 23 ++++++++++++++------- 7 files changed, 47 insertions(+), 40 deletions(-) diff --git a/data/elementary/themes/edc/efl/button.edc b/data/elementary/themes/edc/efl/button.edc index 0f24ebbf7e..cf86312688 100644 --- a/data/elementary/themes/edc/efl/button.edc +++ b/data/elementary/themes/edc/efl/button.edc @@ -331,7 +331,7 @@ group { name: "efl/button"; data.item: "version" "123"; target: "base"; } program { name: "button_text_visible"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -339,7 +339,7 @@ group { name: "efl/button"; data.item: "version" "123"; } } program { name: "button_text_hidden"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -347,7 +347,7 @@ group { name: "efl/button"; data.item: "version" "123"; } } program { name: "button_icon_visible"; - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -355,7 +355,7 @@ group { name: "efl/button"; data.item: "version" "123"; } } program { name: "button_icon_hidden"; - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); @@ -713,7 +713,7 @@ group { name: "efl/button:anchor"; data.item: "version" "123"; action: SIGNAL_EMIT "efl,action,click" "efl"; } program { name: "button_text_visible"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -721,7 +721,7 @@ group { name: "efl/button:anchor"; data.item: "version" "123"; } } program { name: "button_text_hidden"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -729,7 +729,7 @@ group { name: "efl/button:anchor"; data.item: "version" "123"; } } program { name: "button_icon_visible"; - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -737,7 +737,7 @@ group { name: "efl/button:anchor"; data.item: "version" "123"; } } program { name: "button_icon_hidden"; - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); diff --git a/data/elementary/themes/edc/efl/check.edc b/data/elementary/themes/edc/efl/check.edc index 62d85ed085..5aabedee9e 100644 --- a/data/elementary/themes/edc/efl/check.edc +++ b/data/elementary/themes/edc/efl/check.edc @@ -268,7 +268,7 @@ group { "efl/check"; data.item: "version" "123"; target: "indicator"; } program { - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -276,7 +276,7 @@ group { "efl/check"; data.item: "version" "123"; } } program { - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -284,7 +284,7 @@ group { "efl/check"; data.item: "version" "123"; } } program { - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -292,7 +292,7 @@ group { "efl/check"; data.item: "version" "123"; } } program { - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); @@ -864,7 +864,7 @@ group { "efl/check:toggle"; data.item: "version" "123"; target: "glow_but"; } program { - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -872,7 +872,7 @@ group { "efl/check:toggle"; data.item: "version" "123"; } } program { - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -880,7 +880,7 @@ group { "efl/check:toggle"; data.item: "version" "123"; } } program { - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -888,7 +888,7 @@ group { "efl/check:toggle"; data.item: "version" "123"; } } program { - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc index 462fe29365..44557dc944 100644 --- a/data/elementary/themes/edc/efl/popup.edc +++ b/data/elementary/themes/edc/efl/popup.edc @@ -157,13 +157,13 @@ group { "efl/popup/backwall"; data.item: "version" "123"; programs { program { - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; action: STATE_SET "content_visible" 0.0; target: "base"; target: "efl.content"; } program { - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; action: STATE_SET "default" 0.0; target: "base"; target: "efl.content"; diff --git a/data/elementary/themes/edc/efl/progress.edc b/data/elementary/themes/edc/efl/progress.edc index 23f3e07432..d319097727 100644 --- a/data/elementary/themes/edc/efl/progress.edc +++ b/data/elementary/themes/edc/efl/progress.edc @@ -505,7 +505,7 @@ group { "efl/progressbar/horizontal"; target: "efl.text.status"; } program { name: "text-visible"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(slmode); m |= LABEL; set_int(slmode, m); @@ -513,7 +513,7 @@ group { "efl/progressbar/horizontal"; } } program { name: "text-hidden"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(slmode); m &= ~LABEL; set_int(slmode, m); @@ -521,7 +521,7 @@ group { "efl/progressbar/horizontal"; } } program { name: "icon-visible"; - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(slmode); m |= ICON; set_int(slmode, m); @@ -529,7 +529,7 @@ group { "efl/progressbar/horizontal"; } } program { name: "icon-hidden"; - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(slmode); m &= ~ICON; set_int(slmode, m); @@ -1079,7 +1079,7 @@ group { "efl/progressbar/vertical"; target: "efl.text.status"; } program { name: "text-visible"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(slmode); m |= LABEL; set_int(slmode, m); @@ -1087,7 +1087,7 @@ group { "efl/progressbar/vertical"; } } program { name: "text-hidden"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(slmode); m &= ~LABEL; set_int(slmode, m); @@ -1095,7 +1095,7 @@ group { "efl/progressbar/vertical"; } } program { name: "icon-visible"; - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(slmode); m |= ICON; set_int(slmode, m); @@ -1103,7 +1103,7 @@ group { "efl/progressbar/vertical"; } } program { name: "icon-hidden"; - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(slmode); m &= ~ICON; set_int(slmode, m); diff --git a/data/elementary/themes/edc/efl/radio.edc b/data/elementary/themes/edc/efl/radio.edc index c2fc2141c5..06b064cd4c 100644 --- a/data/elementary/themes/edc/efl/radio.edc +++ b/data/elementary/themes/edc/efl/radio.edc @@ -235,7 +235,7 @@ group { "efl/radio"; target: "indicator"; } program { - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); @@ -243,7 +243,7 @@ group { "efl/radio"; } } program { - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -251,7 +251,7 @@ group { "efl/radio"; } } program { - signal: "efl,state,content,set"; source: "efl"; + signal: "efl,content,set"; source: "efl"; script { new m = get_int(btmode); m |= ICON; set_int(btmode, m); @@ -259,7 +259,7 @@ group { "efl/radio"; } } program { - signal: "efl,state,content,unset"; source: "efl"; + signal: "efl,content,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~ICON; set_int(btmode, m); diff --git a/data/elementary/themes/edc/efl/tab_bar.edc b/data/elementary/themes/edc/efl/tab_bar.edc index 6573bfe7c2..8f1a10549e 100644 --- a/data/elementary/themes/edc/efl/tab_bar.edc +++ b/data/elementary/themes/edc/efl/tab_bar.edc @@ -484,7 +484,7 @@ group { "efl/tab_bar/tab"; target: "highlight"; } program { name: "st1"; - signal: "efl,state,text,unset"; source: "efl"; + signal: "efl,text,unset"; source: "efl"; script { new m = get_int(btmode); m &= ~LABEL; set_int(btmode, m); @@ -492,7 +492,7 @@ group { "efl/tab_bar/tab"; } } program { name: "st2"; - signal: "efl,state,text,set"; source: "efl"; + signal: "efl,text,set"; source: "efl"; script { new m = get_int(btmode); m |= LABEL; set_int(btmode, m); diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 2d73dee6f0..98f76e1749 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -244,23 +244,30 @@ _defer_version_signal(Efl_Ui_Layout_Data *sd, Eina_Stringshare *old_sig, Eina_St /* common content cases for layout objects: icon and text */ static inline void -_signals_emit(Eo *obj, +_signals_emit(Efl_Ui_Layout_Data *sd, const char *type, Eina_Bool set) { char buf[1024]; - if (elm_widget_is_legacy(obj)) + if (elm_widget_is_legacy(sd->obj)) { snprintf(buf, sizeof(buf), "elm,state,%s,%s", type, set ? "visible" : "hidden"); - efl_layout_signal_emit(obj, buf, "elm"); + efl_layout_signal_emit(sd->obj, buf, "elm"); } else { - snprintf(buf, sizeof(buf), "efl,state,%s,%s", type, - set ? "set" : "unset"); - efl_layout_signal_emit(obj, buf, "efl"); + char buf2[1024]; + char *use = buf; + if (sd->version >= 123) // efl,state,(content|text),(set|unset) -> efl,(content|text),(set|unset) + use = buf2; + snprintf(buf, sizeof(buf), "efl,state,%s,%s", type, set ? "set" : "unset"); + snprintf(buf2, sizeof(buf2), "efl,%s,%s", type, set ? "set" : "unset"); + if (efl_finalized_get(sd->obj)) + efl_layout_signal_emit(sd->obj, use, "efl"); + else + _defer_version_signal(sd, eina_stringshare_add(buf), eina_stringshare_add(buf2), 123); } } @@ -311,7 +318,7 @@ _icon_signal_emit(Efl_Ui_Layout_Data *sd, type = sub_d->part; } - _signals_emit(sd->obj, type, visible); + _signals_emit(sd, type, visible); /* themes might need immediate action here */ efl_layout_signal_process(sd->obj, EINA_FALSE); @@ -359,7 +366,7 @@ _text_signal_emit(Efl_Ui_Layout_Data *sd, type = sub_d->part; } - _signals_emit(sd->obj, type, visible); + _signals_emit(sd, type, visible); /* TODO: is this right? It was like that, but IMO it should be removed: */ From 41f37c328ee9dca9a252ac5a81683c2a496d28a0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:55:40 -0400 Subject: [PATCH 100/115] theme: use 'visible' style signals for spin_button button/entry visibility Summary: ref T8231 Depends on D10158 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10159 --- data/elementary/themes/edc/efl/datepicker.edc | 8 ++++---- data/elementary/themes/edc/efl/spin_button.edc | 8 ++++---- src/lib/elementary/efl_ui_spin_button.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data/elementary/themes/edc/efl/datepicker.edc b/data/elementary/themes/edc/efl/datepicker.edc index a0c23597c2..cc913e253b 100644 --- a/data/elementary/themes/edc/efl/datepicker.edc +++ b/data/elementary/themes/edc/efl/datepicker.edc @@ -282,25 +282,25 @@ group { "efl/datepicker/spin_button"; data.item: "version" "123"; } programs { program { "entry_active"; - signal: "efl,state,entry,active"; + signal: "efl,entry,visible,on"; source: "efl"; action: STATE_SET "active"; target: "efl.entry"; } program { "entry_inactive"; - signal: "efl,state,entry,inactive"; + signal: "efl,entry,visible,off"; source: "efl"; action: STATE_SET "default"; target: "efl.entry"; } program { "text_button_active"; - signal: "efl,state,button,active"; + signal: "efl,button,visible,on"; source: "efl"; action: STATE_SET "default"; target: "efl.text_button"; } program { "text_button_inactive"; - signal: "efl,state,button,inactive"; + signal: "efl,button,visible,off"; source: "efl"; action: STATE_SET "inactive"; target: "efl.text_button"; diff --git a/data/elementary/themes/edc/efl/spin_button.edc b/data/elementary/themes/edc/efl/spin_button.edc index 91dff76c20..5008295218 100644 --- a/data/elementary/themes/edc/efl/spin_button.edc +++ b/data/elementary/themes/edc/efl/spin_button.edc @@ -101,25 +101,25 @@ group { "efl/spin_button/horizontal"; } programs { program { "entry_active"; - signal: "efl,state,entry,active"; + signal: "efl,entry,visible,on"; source: "efl"; action: STATE_SET "active"; target: "efl.entry"; } program { "entry_inactive"; - signal: "efl,state,entry,inactive"; + signal: "efl,entry,visible,off"; source: "efl"; action: STATE_SET "default"; target: "efl.entry"; } program { "text_button_active"; - signal: "efl,state,button,active"; + signal: "efl,button,visible,on"; source: "efl"; action: STATE_SET "default"; target: "efl.text_button"; } program { "text_button_inactive"; - signal: "efl,state,button,inactive"; + signal: "efl,button,visible,off"; source: "efl"; action: STATE_SET "inactive"; target: "efl.text_button"; diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c index a4c9122822..bbfd7d7286 100644 --- a/src/lib/elementary/efl_ui_spin_button.c +++ b/src/lib/elementary/efl_ui_spin_button.c @@ -167,8 +167,8 @@ _entry_hide(Evas_Object *obj) { Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS); - efl_layout_signal_emit(obj, "efl,state,button,active", "efl"); - efl_layout_signal_emit(obj, "efl,state,entry,inactive", "efl"); + efl_layout_signal_emit(obj, "efl,button,visible,on", "efl"); + efl_layout_signal_emit(obj, "efl,entry,visible,off", "efl"); if (sd->entry_visible && !evas_focus_state_get(evas_object_evas_get(obj))) sd->entry_reactivate = EINA_TRUE; @@ -343,7 +343,7 @@ _entry_show_cb(void *data, elm_object_focus_set(obj, EINA_TRUE); elm_entry_select_all(obj); sd->entry_visible = EINA_TRUE; - efl_layout_signal_emit(data, "efl,state,button,inactive", "efl"); + efl_layout_signal_emit(data, "efl,button,visible,off", "efl"); } static void @@ -378,7 +378,7 @@ _toggle_entry(Evas_Object *obj) efl_event_callback_add(sd->ent, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, _entry_focus_changed_cb, obj); sd->entry_visible = EINA_TRUE; - efl_layout_signal_emit(obj, "efl,state,entry,active", "efl"); + efl_layout_signal_emit(obj, "efl,entry,visible,on", "efl"); { Eina_List *items = NULL; From ab8306135c584eec65b7eafcbc8cd3a3e190921f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:55:45 -0400 Subject: [PATCH 101/115] theme: use more explicit signal names for C -> theme scrollbar signals Summary: ref T8231 Depends on D10159 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10160 --- data/elementary/themes/edc/efl/scroller.edc | 8 ++++---- src/lib/elementary/efl_ui_image_zoomable.c | 8 ++++---- src/lib/elementary/efl_ui_scroll_util.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data/elementary/themes/edc/efl/scroller.edc b/data/elementary/themes/edc/efl/scroller.edc index 8ab02628d8..aba12ffbc4 100644 --- a/data/elementary/themes/edc/efl/scroller.edc +++ b/data/elementary/themes/edc/efl/scroller.edc @@ -301,7 +301,7 @@ group { name: "efl/scroller"; } } program { - signal: "efl,vbar,visible,on"; source: "efl"; + signal: "efl,vertical_bar,visible,on"; source: "efl"; action: STATE_SET "default" 0.0; target: "sb_vbar"; target: "sb_vbar_show"; @@ -316,7 +316,7 @@ group { name: "efl/scroller"; target: "arrow2_vbar_indent"; } program { - signal: "efl,vbar,visible,off"; source: "efl"; + signal: "efl,vertical_bar,visible,off"; source: "efl"; action: STATE_SET "hidden" 0.0; target: "sb_vbar"; target: "sb_vbar_show"; @@ -568,7 +568,7 @@ group { name: "efl/scroller"; } } program { - signal: "efl,hbar,visible,on"; source: "efl"; + signal: "efl,horizontal_bar,visible,on"; source: "efl"; action: STATE_SET "default" 0.0; target: "sb_hbar"; target: "sb_hbar_show"; @@ -583,7 +583,7 @@ group { name: "efl/scroller"; target: "arrow2_hbar_indent"; } program { - signal: "efl,hbar,visible,off"; source: "efl"; + signal: "efl,horizontal_bar,visible,off"; source: "efl"; action: STATE_SET "hidden" 0.0; target: "sb_hbar"; target: "sb_hbar_show"; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index a08a72ca8a..1967c93bc4 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -1550,9 +1550,9 @@ _efl_ui_image_zoomable_bar_show_cb(void *data, const Efl_Event *event) else { if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,hbar,visible,on", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,on", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,vbar,visible,on", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,on", "efl"); } } @@ -1573,9 +1573,9 @@ _efl_ui_image_zoomable_bar_hide_cb(void *data, const Efl_Event *event) else { if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - edje_object_signal_emit(wd->resize_obj, "efl,hbar,visible,off", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,off", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - edje_object_signal_emit(wd->resize_obj, "efl,vbar,visible,off", "efl"); + edje_object_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,off", "efl"); } } diff --git a/src/lib/elementary/efl_ui_scroll_util.c b/src/lib/elementary/efl_ui_scroll_util.c index 019b68dbfb..fba8ecdfd0 100644 --- a/src/lib/elementary/efl_ui_scroll_util.c +++ b/src/lib/elementary/efl_ui_scroll_util.c @@ -227,9 +227,9 @@ _scroll_connector_bar_show_cb(void *data, const Efl_Event *event) Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - efl_layout_signal_emit(wd->resize_obj, "efl,hbar,visible,on", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,on", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - efl_layout_signal_emit(wd->resize_obj, "efl,vbar,visible,on", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,on", "efl"); } static void @@ -240,9 +240,9 @@ _scroll_connector_bar_hide_cb(void *data, const Efl_Event *event) Efl_Ui_Layout_Orientation type = *(Efl_Ui_Layout_Orientation *)(event->info); if (type == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - efl_layout_signal_emit(wd->resize_obj, "efl,hbar,visible,off", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,off", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - efl_layout_signal_emit(wd->resize_obj, "efl,vbar,visible,off", "efl"); + efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,off", "efl"); } void From edab064de9af47c9b8b2bbdece73ad2ecbc88063 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:55:50 -0400 Subject: [PATCH 102/115] theme: efl,action,clicked -> efl,action,click Summary: action signals should infinitives ref T8231 Depends on D10160 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10161 --- data/elementary/themes/edc/efl/popup.edc | 2 +- src/lib/elementary/efl_ui_popup.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/elementary/themes/edc/efl/popup.edc b/data/elementary/themes/edc/efl/popup.edc index 44557dc944..c67eabc932 100644 --- a/data/elementary/themes/edc/efl/popup.edc +++ b/data/elementary/themes/edc/efl/popup.edc @@ -170,7 +170,7 @@ group { "efl/popup/backwall"; data.item: "version" "123"; } program { signal: "mouse,clicked,1"; source: "block"; - action: SIGNAL_EMIT "efl,action,clicked" "efl"; + action: SIGNAL_EMIT "efl,action,click" "efl"; } } } diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c index b4d1226465..edf71073aa 100644 --- a/src/lib/elementary/efl_ui_popup.c +++ b/src/lib/elementary/efl_ui_popup.c @@ -554,7 +554,7 @@ _efl_ui_popup_efl_object_constructor(Eo *obj, Efl_Ui_Popup_Data *pd) evas_object_smart_member_add(pd->backwall, obj); evas_object_stack_below(pd->backwall, wd->resize_obj); - edje_object_signal_callback_add(pd->backwall, "efl,action,clicked", "*", + edje_object_signal_callback_add(pd->backwall, "efl,action,click", "*", _backwall_clicked_cb, obj); pd->align = EFL_UI_POPUP_ALIGN_CENTER; From 6d6bfeecfa85bb3596a5a5b080ba65e58c8e360c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:55:55 -0400 Subject: [PATCH 103/115] theme: use more explicit signal names for C <- theme scrollbar signals Summary: ref T8231 Depends on D10161 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10162 --- data/elementary/themes/edc/efl/scroller.edc | 6 +++--- src/lib/elementary/efl_ui_image_zoomable.c | 8 ++++---- src/lib/elementary/efl_ui_scroll_util.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/data/elementary/themes/edc/efl/scroller.edc b/data/elementary/themes/edc/efl/scroller.edc index aba12ffbc4..6e2769fdae 100644 --- a/data/elementary/themes/edc/efl/scroller.edc +++ b/data/elementary/themes/edc/efl/scroller.edc @@ -1101,7 +1101,7 @@ group { name: "efl/scroller"; } program { signal: "mouse,down,*"; source: "efl.dragable.vbar"; - action: SIGNAL_EMIT "efl,vbar,press" "efl"; + action: SIGNAL_EMIT "efl,vertical_bar,press" "efl"; } program { signal: "mouse,up,1"; source: "efl.dragable.vbar"; @@ -1125,7 +1125,7 @@ group { name: "efl/scroller"; } program { signal: "mouse,down,*"; source: "efl.dragable.hbar"; - action: SIGNAL_EMIT "efl,hbar,press" "efl"; + action: SIGNAL_EMIT "efl,horizontal_bar,press" "efl"; } program { signal: "mouse,up,1"; source: "efl.dragable.hbar"; @@ -1137,7 +1137,7 @@ group { name: "efl/scroller"; } program { signal: "mouse,up,*"; source: "efl.dragable.hbar"; - action: SIGNAL_EMIT "efl,hbar,unpress" "efl"; + action: SIGNAL_EMIT "efl,horizontal_bar,unpress" "efl"; } } } diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 1967c93bc4..ad4d0f57a4 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -1658,7 +1658,7 @@ _efl_ui_image_zoomable_edje_object_attach(Eo *obj) (obj, "drag,page", "efl.dragable.vbar", obj, _efl_ui_image_zoomable_edje_drag_cb, NULL); efl_layout_signal_callback_add - (obj, "efl,vbar,press", "efl", + (obj, "efl,vertical_bar,press", "efl", obj, _efl_ui_image_zoomable_vbar_press_cb, NULL); efl_layout_signal_callback_add (obj, "efl,vbar,unpress", "efl", @@ -1682,7 +1682,7 @@ _efl_ui_image_zoomable_edje_object_attach(Eo *obj) (obj, "drag,page", "efl.dragable.hbar", obj, _efl_ui_image_zoomable_edje_drag_cb, NULL); efl_layout_signal_callback_add - (obj, "efl,hbar,press", "efl", + (obj, "efl,horizontal_bar,press", "efl", obj, _efl_ui_image_zoomable_hbar_press_cb, NULL); efl_layout_signal_callback_add (obj, "efl,hbar,unpress", "efl", @@ -1769,7 +1769,7 @@ _efl_ui_image_zoomable_edje_object_detach(Evas_Object *obj) (obj, "drag,page", "efl.dragable.vbar", obj, _efl_ui_image_zoomable_edje_drag_cb, NULL); efl_layout_signal_callback_del - (obj, "efl,vbar,press", "efl", + (obj, "efl,vertical_bar,press", "efl", obj, _efl_ui_image_zoomable_vbar_press_cb, NULL); efl_layout_signal_callback_del (obj, "efl,vbar,unpress", "efl", @@ -1793,7 +1793,7 @@ _efl_ui_image_zoomable_edje_object_detach(Evas_Object *obj) (obj, "drag,page", "efl.dragable.hbar", obj, _efl_ui_image_zoomable_edje_drag_cb, NULL); efl_layout_signal_callback_del - (obj, "efl,hbar,press", "efl", + (obj, "efl,horizontal_bar,press", "efl", obj, _efl_ui_image_zoomable_hbar_press_cb, NULL); efl_layout_signal_callback_del (obj, "efl,hbar,unpress", "efl", diff --git a/src/lib/elementary/efl_ui_scroll_util.c b/src/lib/elementary/efl_ui_scroll_util.c index fba8ecdfd0..dec7e5dd28 100644 --- a/src/lib/elementary/efl_ui_scroll_util.c +++ b/src/lib/elementary/efl_ui_scroll_util.c @@ -269,7 +269,7 @@ efl_ui_scroll_connector_bind(Eo *obj, Eo *manager) ctx, _scroll_connector_edje_drag_cb, NULL); efl_layout_signal_callback_add(obj, "drag,page", "efl.dragable.vbar", ctx, _scroll_connector_edje_drag_cb, NULL); - efl_layout_signal_callback_add(obj, "efl,vbar,press", "efl", + efl_layout_signal_callback_add(obj, "efl,vertical_bar,press", "efl", ctx, _scroll_connector_vbar_press_cb, NULL); efl_layout_signal_callback_add(obj, "efl,vbar,unpress", "efl", ctx, _scroll_connector_vbar_unpress_cb, NULL); @@ -285,7 +285,7 @@ efl_ui_scroll_connector_bind(Eo *obj, Eo *manager) ctx, _scroll_connector_edje_drag_cb, NULL); efl_layout_signal_callback_add(obj, "drag,page", "efl.dragable.hbar", ctx, _scroll_connector_edje_drag_cb, NULL); - efl_layout_signal_callback_add(obj, "efl,hbar,press", "efl", + efl_layout_signal_callback_add(obj, "efl,horizontal_bar,press", "efl", ctx, _scroll_connector_hbar_press_cb, NULL); efl_layout_signal_callback_add(obj, "efl,hbar,unpress", "efl", ctx, _scroll_connector_hbar_unpress_cb, NULL); @@ -325,7 +325,7 @@ efl_ui_scroll_connector_unbind(Eo *obj) ctx, _scroll_connector_edje_drag_cb, NULL); efl_layout_signal_callback_del(obj, "drag,page", "efl.dragable.vbar", ctx, _scroll_connector_edje_drag_cb, NULL); - efl_layout_signal_callback_del(obj, "efl,vbar,press", "efl", + efl_layout_signal_callback_del(obj, "efl,vertical_bar,press", "efl", ctx, _scroll_connector_vbar_press_cb, NULL); efl_layout_signal_callback_del(obj, "efl,vbar,unpress", "efl", ctx, _scroll_connector_vbar_unpress_cb, NULL); @@ -342,7 +342,7 @@ efl_ui_scroll_connector_unbind(Eo *obj) ctx, _scroll_connector_edje_drag_cb, NULL); efl_layout_signal_callback_del(obj, "drag,page", "efl.dragable.hbar", ctx, _scroll_connector_edje_drag_cb, NULL); - efl_layout_signal_callback_del(obj, "efl,hbar,press", "efl", + efl_layout_signal_callback_del(obj, "efl,horizontal_bar,press", "efl", ctx, _scroll_connector_hbar_press_cb, NULL); efl_layout_signal_callback_del(obj, "efl,hbar,unpress", "efl", ctx, _scroll_connector_hbar_unpress_cb, NULL); From ecd3d2723b79c4e03695f07c203f347ca8c832f4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:56:01 -0400 Subject: [PATCH 104/115] theme: remove unused scroller group Summary: this is just copied from legacy but not used for anything ref T8231 Depends on D10162 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10163 --- data/elementary/themes/edc/efl/scroller.edc | 53 --------------------- 1 file changed, 53 deletions(-) diff --git a/data/elementary/themes/edc/efl/scroller.edc b/data/elementary/themes/edc/efl/scroller.edc index 6e2769fdae..478a973639 100644 --- a/data/elementary/themes/edc/efl/scroller.edc +++ b/data/elementary/themes/edc/efl/scroller.edc @@ -1193,56 +1193,3 @@ group { name: "efl/scroller:popup/no_inset_shadow"; } } } - -group { name: "efl/scroller/contents"; - data.item: "version" "123"; - parts { - part { name: "efl.content"; required; - type: SWALLOW; - description { state: "default" 0.0; - } - } - part { name: "efl.content_r"; required; - type: SWALLOW; - description { state: "default" 0.0; - fixed: 1 1; - rel1 { - relative: 1.0 0.0; - to: "efl.content"; - } - rel2 { - relative: 2.0 1.0; - to: "efl.content"; - } - } - } - part { name: "efl.content_b"; required; - type: SWALLOW; - description { state: "default" 0.0; - fixed: 1 1; - rel1 { - relative: 0.0 1.0; - to: "efl.content"; - } - rel2 { - relative: 1.0 2.0; - to: "efl.content"; - } - } - } - part { name: "efl.content_rb"; required; - type: SWALLOW; - description { state: "default" 0.0; - fixed: 1 1; - rel1 { - relative: 1.0 1.0; - to: "efl.content"; - } - rel2 { - relative: 2.0 2.0; - to: "efl.content"; - } - } - } - } -} From 3ec56e0dc43dc86a3c788db4bd177fe4a3601779 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:56:06 -0400 Subject: [PATCH 105/115] api: efl,state,busy,(start|stop) -> efl,state,busy,(started|stopped) Summary: ref T8231 Depends on D10163 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10165 --- data/elementary/themes/edc/efl/image_zoomable.edc | 6 +++--- src/lib/elementary/efl_ui_image_zoomable.c | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/data/elementary/themes/edc/efl/image_zoomable.edc b/data/elementary/themes/edc/efl/image_zoomable.edc index a1852a2b4a..7ec3644d60 100644 --- a/data/elementary/themes/edc/efl/image_zoomable.edc +++ b/data/elementary/themes/edc/efl/image_zoomable.edc @@ -46,7 +46,7 @@ group { name: "efl/image_zoomable"; } programs { program { name: "spin"; - signal: "efl,state,busy,start"; source: "efl"; + signal: "efl,state,busy,started"; source: "efl"; action: ACTION_STOP; target: "spin"; target: "spin0"; @@ -74,14 +74,14 @@ group { name: "efl/image_zoomable"; } program { - signal: "efl,state,busy,start"; source: "efl"; + signal: "efl,state,busy,started"; source: "efl"; action: STATE_SET "active" 0.0; transition: SINUSOIDAL 0.25; target: "busy_clip"; } program { - signal: "efl,state,busy,stop"; source: "efl"; + signal: "efl,state,busy,stopped"; source: "efl"; action: STATE_SET "default" 0.0; transition: SINUSOIDAL 1.0; target: "busy_clip"; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index ad4d0f57a4..910854ee16 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -276,7 +276,7 @@ _grid_load(Evas_Object *obj, else edje_object_signal_emit (wd->resize_obj, - "efl,state,busy,start", "efl"); + "efl,state,busy,started", "efl"); efl_event_callback_legacy_call (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD_DETAIL, NULL); @@ -294,7 +294,7 @@ _grid_load(Evas_Object *obj, else edje_object_signal_emit (wd->resize_obj, - "efl,state,busy,stop", "efl"); + "efl,state,busy,stopped", "efl"); efl_event_callback_legacy_call (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOADED_DETAIL, NULL); @@ -498,7 +498,7 @@ _grid_clear(Evas_Object *obj, else edje_object_signal_emit (wd->resize_obj, - "efl,state,busy,stop", "efl"); + "efl,state,busy,stopped", "efl"); efl_event_callback_legacy_call (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD_DETAIL, NULL); @@ -536,7 +536,7 @@ _tile_preloaded_cb(void *data, "elm"); else edje_object_signal_emit - (wd->resize_obj, "efl,state,busy,stop", + (wd->resize_obj, "efl,state,busy,stopped", "efl"); efl_event_callback_legacy_call @@ -745,7 +745,7 @@ _main_img_preloaded_cb(void *data, (wd->resize_obj, "elm,state,busy,stop", "elm"); else edje_object_signal_emit - (wd->resize_obj, "efl,state,busy,stop", "efl"); + (wd->resize_obj, "efl,state,busy,stopped", "efl"); efl_event_callback_legacy_call (obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOADED_DETAIL, NULL); @@ -2054,7 +2054,7 @@ _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd, (wd->resize_obj, "elm,state,busy,start", "elm"); else edje_object_signal_emit - (wd->resize_obj, "efl,state,busy,start", "efl"); + (wd->resize_obj, "efl,state,busy,started", "efl"); efl_event_callback_legacy_call(obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD_DETAIL, NULL); } @@ -2139,7 +2139,7 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret (wd->resize_obj, "elm,state,busy,start", "elm"); else edje_object_signal_emit - (wd->resize_obj, "efl,state,busy,start", "efl"); + (wd->resize_obj, "efl,state,busy,started", "efl"); efl_event_callback_legacy_call(obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD_DETAIL, NULL); } From aab934176637d445858d1fded8886ecdb9daa349 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:56:11 -0400 Subject: [PATCH 106/115] theme: efl,state,anim,stop -> efl,state,animating,stopped Summary: ref T8231 Depends on D10165 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10166 --- data/elementary/themes/edc/efl/focus.edc | 2 +- src/lib/elementary/efl_ui_win.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/elementary/themes/edc/efl/focus.edc b/data/elementary/themes/edc/efl/focus.edc index c56428f8db..c1f4695668 100644 --- a/data/elementary/themes/edc/efl/focus.edc +++ b/data/elementary/themes/edc/efl/focus.edc @@ -164,7 +164,7 @@ group { name: "efl/focus_highlight/top"; data.item: "version" "123"; after: "pulse"; } program { - signal: "efl,state,anim,stop"; source: "efl"; + signal: "efl,state,animating,stopped"; source: "efl"; action: STATE_SET "default" 0.0; target: "base"; } diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index f79d4d1333..72a9239a26 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -1226,7 +1226,7 @@ _elm_win_focus_highlight_simple_setup(Efl_Ui_Win_Data *sd, if (elm_widget_is_legacy(sd->obj)) edje_object_signal_emit(obj, "elm,state,anim,stop", "elm"); else - edje_object_signal_emit(obj, "efl,state,anim,stop", "efl"); + edje_object_signal_emit(obj, "efl,state,animating,stopped", "efl"); } static void From 59709bc90776261aee66e1f3d527fca0e5fbe151 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:56:17 -0400 Subject: [PATCH 107/115] theme: migrate all efl,anim,activate (and similar) signals to efl,state,animation,activated Summary: ref T8231 Depends on D10166 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8231 Differential Revision: https://phab.enlightenment.org/D10167 --- data/elementary/themes/edc/efl/button.edc | 4 ++-- data/elementary/themes/edc/efl/calendar.edc | 2 +- data/elementary/themes/edc/efl/spin_button.edc | 2 +- src/lib/elementary/efl_ui_button.c | 4 ++-- src/lib/elementary/efl_ui_spin_button.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/data/elementary/themes/edc/efl/button.edc b/data/elementary/themes/edc/efl/button.edc index cf86312688..bd07559076 100644 --- a/data/elementary/themes/edc/efl/button.edc +++ b/data/elementary/themes/edc/efl/button.edc @@ -320,7 +320,7 @@ group { name: "efl/button"; data.item: "version" "123"; } } program { name: "buttonactivate"; - signal: "efl,anim,activate"; source: "efl"; + signal: "efl,state,animation,activated"; source: "efl"; action: STATE_SET "pressed" 0.0; target: "base"; after: "button_unpressed_anim"; @@ -696,7 +696,7 @@ group { name: "efl/button:anchor"; data.item: "version" "123"; target: "text2"; } program { - signal: "efl,anim,activate"; source: "efl"; + signal: "efl,state,animation,activated"; source: "efl"; action: STATE_SET "clicked" 0.0; target: "bar2"; target: "text2"; diff --git a/data/elementary/themes/edc/efl/calendar.edc b/data/elementary/themes/edc/efl/calendar.edc index 459dbdbf00..7ec30b14fb 100644 --- a/data/elementary/themes/edc/efl/calendar.edc +++ b/data/elementary/themes/edc/efl/calendar.edc @@ -647,7 +647,7 @@ group { "efl/calendar"; data.item: "version" "123"; action: SIGNAL_EMIT "efl,action,click" ""; } program { name: "access_pressed"; - signal: "efl,action,anim,activate"; + signal: "efl,state,animation,activated"; source: "efl"; action: STATE_SET "pressed" 0.0; target: "arrow.image"; diff --git a/data/elementary/themes/edc/efl/spin_button.edc b/data/elementary/themes/edc/efl/spin_button.edc index 5008295218..d359fc3384 100644 --- a/data/elementary/themes/edc/efl/spin_button.edc +++ b/data/elementary/themes/edc/efl/spin_button.edc @@ -311,7 +311,7 @@ group { "efl/spin_button/horizontal/inc_button"; action: SIGNAL_EMIT "efl,action,click" ""; } program { name: "access_pressed"; - signal: "efl,anim,activate"; + signal: "efl,state,animation,activated"; source: "efl"; action: STATE_SET "pressed" 0.0; target: "arrow.image"; diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index 4bcbc11380..7c0a13e478 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -102,7 +102,7 @@ _efl_ui_button_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Button_Data *_pd if (elm_widget_is_legacy(obj)) elm_layout_signal_emit(obj, "elm,anim,activate", "elm"); else - elm_layout_signal_emit(obj, "efl,anim,activate", "efl"); + elm_layout_signal_emit(obj, "efl,state,animation,activated", "efl"); return EINA_TRUE; } @@ -113,7 +113,7 @@ _key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED) if (elm_widget_is_legacy(obj)) elm_layout_signal_emit(obj, "elm,anim,activate", "elm"); else - elm_layout_signal_emit(obj, "efl,anim,activate", "efl"); + elm_layout_signal_emit(obj, "efl,state,animation,activated", "efl"); _activate(obj); return EINA_TRUE; } diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c index bbfd7d7286..9be21373a1 100644 --- a/src/lib/elementary/efl_ui_spin_button.c +++ b/src/lib/elementary/efl_ui_spin_button.c @@ -542,13 +542,13 @@ _access_increment_decrement_info_say(Evas_Object *obj, if (is_incremented) { elm_object_signal_emit - (sd->inc_button, "efl,anim,activate", "efl"); + (sd->inc_button, "efl,state,animation,activated", "efl"); eina_strbuf_append(buf, E_("incremented")); } else { elm_object_signal_emit - (sd->dec_button, "efl,anim,activate", "efl"); + (sd->dec_button, "efl,state,animation,activated", "efl"); eina_strbuf_append(buf, E_("decremented")); } From 8e17112c76fce8d28e4b153d368461b742ee815f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:56:29 -0400 Subject: [PATCH 108/115] api: mark efl.gfx.image and related types stable Summary: fix T7875 fix T7926 fix T7927 fix T7926 fix T7929 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T7929, T7927, T7926, T7875 Differential Revision: https://phab.enlightenment.org/D10124 --- src/lib/efl/interfaces/efl_gfx_image.eo | 8 ++++---- src/lib/efl/interfaces/efl_gfx_types.eot | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_image.eo b/src/lib/efl/interfaces/efl_gfx_image.eo index b9ccac41ea..b89c051f80 100644 --- a/src/lib/efl/interfaces/efl_gfx_image.eo +++ b/src/lib/efl/interfaces/efl_gfx_image.eo @@ -1,7 +1,7 @@ import efl_gfx_types; import eina_types; -enum @beta Efl.Gfx.Image_Content_Hint +enum Efl.Gfx.Image_Content_Hint { [[How an image's data is to be treated by EFL, for optimization.]] none = 0, [[No hint on the content (default).]] @@ -9,7 +9,7 @@ enum @beta Efl.Gfx.Image_Content_Hint static = 2 [[The content won't change over time.]] } -enum @beta Efl.Gfx.Image_Scale_Hint +enum Efl.Gfx.Image_Scale_Hint { /* FIXME: Legacy is in Emile, where it does not belong. */ [[How an image's data is to be treated by EFL, with regard to scaling cache.]] @@ -18,7 +18,7 @@ enum @beta Efl.Gfx.Image_Scale_Hint static = 2 [[Image will not be re-scaled over time, thus turning scaling cache ON for its data.]] } -enum @beta Efl.Gfx.Image_Scale_Method +enum Efl.Gfx.Image_Scale_Method { [[Enumeration that defines scaling methods to be used when rendering an image.]] none, [[Use the image's natural size.]] @@ -58,7 +58,7 @@ struct Efl.Gfx.Image_Stretch_Region length: uint; [[Length of the stretchable region in pixels.]] } -interface @beta Efl.Gfx.Image +interface Efl.Gfx.Image { [[This interface defines a set of common APIs which should be implemented by image objects. diff --git a/src/lib/efl/interfaces/efl_gfx_types.eot b/src/lib/efl/interfaces/efl_gfx_types.eot index 2e14ae9732..2a4e66841c 100644 --- a/src/lib/efl/interfaces/efl_gfx_types.eot +++ b/src/lib/efl/interfaces/efl_gfx_types.eot @@ -152,7 +152,7 @@ enum @beta Efl.Gfx.Vg_Composite_Method mask_difference } -enum @beta Efl.Gfx.Center_Fill_Mode +enum Efl.Gfx.Center_Fill_Mode { [[How an image's center region (the complement to the border region) should be rendered by EFL]] none = 0, [[Image's center region is $not to be rendered]] From b59c00864c1e549ae9ebf94e58a892a3edf36d19 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:56:33 -0400 Subject: [PATCH 109/115] api: mark Efl.Gfx.Image_Load_Controller stable Summary: fix T7876 Depends on D10124 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T7876 Differential Revision: https://phab.enlightenment.org/D10125 --- src/lib/efl/interfaces/efl_gfx_image_load_controller.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo b/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo index c088b776d4..8f6164760f 100644 --- a/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo +++ b/src/lib/efl/interfaces/efl_gfx_image_load_controller.eo @@ -13,7 +13,7 @@ enum @beta Efl.Gfx.Image_Load_Controller_State } */ -interface @beta Efl.Gfx.Image_Load_Controller +interface Efl.Gfx.Image_Load_Controller { [[Common APIs for all loadable 2D images.]] From 593b7426ae230b628a25450c352556f21a29399c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 25 Sep 2019 17:56:38 -0400 Subject: [PATCH 110/115] api: mark Efl.Ui.Image_Zoomable stable Summary: ref T7875 Depends on D10125 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T7875 Differential Revision: https://phab.enlightenment.org/D10126 --- src/lib/elementary/efl_ui_image_zoomable.eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 945cfaba04..d5443b54f8 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -2,7 +2,7 @@ struct @extern Elm.Photocam.Error; [[Photocam error information.]] struct @extern Elm.Photocam.Progress; [[Photocam progress information.]] -class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom +class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar { [[Elementary Image Zoomable class]] From 4c3dce94eb80a22cfd7e0c42a2a0e4bb9091978c Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 21:59:09 -0400 Subject: [PATCH 111/115] elementary: stabilize Efl.Ui.Collection_View. Reviewers: zmike, bu5hm4n, segfaultxavi, lauromoura, SanghyeonLee, felipealmeida Reviewed By: zmike, SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8261 Differential Revision: https://phab.enlightenment.org/D10171 --- src/lib/elementary/efl_ui_collection_view.eo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_collection_view.eo b/src/lib/elementary/efl_ui_collection_view.eo index a0cbbc8545..ac379d94e8 100644 --- a/src/lib/elementary/efl_ui_collection_view.eo +++ b/src/lib/elementary/efl_ui_collection_view.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements +class Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements Efl.Ui.Layout_Orientable, Efl.Ui.Selectable, Efl.Ui.Multi_Selectable_Async, @@ -35,7 +35,7 @@ class @beta Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements factory: Efl.Ui.Factory; [[The factory.]] } } - @property position_manager { + @property position_manager @beta { [[Position manager object that handles placement of items.]] values { position_manager : Efl.Ui.Position_Manager.Entity @move; [[The objects ownership is passed to the item container.]] From 7cf364f270de5a582ad92ec7c3277837e58c045a Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 21:59:14 -0400 Subject: [PATCH 112/115] elementary: rename Efl.Ui.Collection_Event to Efl.Ui.Item_Clickable Summary: Depends on D10171 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: zmike, SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8266 Differential Revision: https://phab.enlightenment.org/D10175 --- src/lib/elementary/Efl_Ui.h | 2 +- src/lib/elementary/efl_ui_collection.eo | 2 +- src/lib/elementary/efl_ui_collection_view.eo | 2 +- src/lib/elementary/efl_ui_item.c | 2 +- .../{efl_ui_collection_events.eo => efl_ui_item_clickable.eo} | 2 +- src/lib/elementary/meson.build | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename src/lib/elementary/{efl_ui_collection_events.eo => efl_ui_item_clickable.eo} (92%) diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 29ef99383e..80cdde78b5 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -307,7 +307,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include -# include +# include # include # include # include diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo index 28ecb4975d..a57e07b028 100644 --- a/src/lib/elementary/efl_ui_collection.eo +++ b/src/lib/elementary/efl_ui_collection.eo @@ -4,7 +4,7 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Ui.Multi_Selectable, Efl.Ui.Focus.Manager_Sub, Efl.Ui.Widget_Focus_Manager, - Efl.Ui.Collection_Events + Efl.Ui.Item_Clickable composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar, diff --git a/src/lib/elementary/efl_ui_collection_view.eo b/src/lib/elementary/efl_ui_collection_view.eo index ac379d94e8..9278cd04c7 100644 --- a/src/lib/elementary/efl_ui_collection_view.eo +++ b/src/lib/elementary/efl_ui_collection_view.eo @@ -4,7 +4,7 @@ class Efl.Ui.Collection_View extends Efl.Ui.Layout_Base implements Efl.Ui.Multi_Selectable_Async, Efl.Ui.Focus.Manager_Sub, Efl.Ui.Widget_Focus_Manager, - Efl.Ui.Collection_Events + Efl.Ui.Item_Clickable composites Efl.Ui.Scrollable, Efl.Ui.Scrollbar, Efl.Ui.Multi_Selectable_Async { [[This widget displays a list of items in an arrangement controlled by an external @.position_manager diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c index 7cdfe16424..3dce9c3837 100644 --- a/src/lib/elementary/efl_ui_item.c +++ b/src/lib/elementary/efl_ui_item.c @@ -237,5 +237,5 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_item, Efl_Ui_Item_Data) #include "efl_ui_selectable.eo.c" #include "efl_ui_multi_selectable.eo.c" #include "efl_ui_single_selectable.eo.c" -#include "efl_ui_collection_events.eo.c" +#include "efl_ui_item_clickable.eo.c" diff --git a/src/lib/elementary/efl_ui_collection_events.eo b/src/lib/elementary/efl_ui_item_clickable.eo similarity index 92% rename from src/lib/elementary/efl_ui_collection_events.eo rename to src/lib/elementary/efl_ui_item_clickable.eo index 653172564b..7177d24f49 100644 --- a/src/lib/elementary/efl_ui_collection_events.eo +++ b/src/lib/elementary/efl_ui_item_clickable.eo @@ -1,4 +1,4 @@ -interface @beta Efl.Ui.Collection_Events +interface @beta Efl.Ui.Item_Clickable { [[Shared sets of events between @Efl.Ui.Collection and @Efl.Ui.Collection_View.]] event_prefix: efl_ui; diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 8166aafd95..c2cd86bbc9 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -171,7 +171,7 @@ pub_eo_files = [ 'efl_ui_relative_layout.eo', 'efl_ui_action_connector.eo', 'efl_ui_format.eo', - 'efl_ui_collection_events.eo', + 'efl_ui_item_clickable.eo', 'efl_ui_collection.eo', 'efl_ui_position_manager_entity.eo', 'efl_ui_position_manager_list.eo', From b8af6c17fc29226d351e141457dcded8c122c5eb Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 21:59:20 -0400 Subject: [PATCH 113/115] elementary: temporary workaround include issue that prevent acces to Evas_Eo.h Summary: Depends on D10175 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8266 Differential Revision: https://phab.enlightenment.org/D10176 --- src/lib/elementary/Efl_Ui.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 80cdde78b5..060fdc93c1 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -307,6 +307,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include # include # include +# include # include # include # include From 26d5b7366eb4852aa4441947201b11ea637a0ad2 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 21:59:25 -0400 Subject: [PATCH 114/115] elementary: forward Efl.Input.Clickable event to Efl.Ui.Collection* event. Summary: Depends on D10176 Reviewers: zmike, segfaultxavi, bu5hm4n, SanghyeonLee, lauromoura, felipealmeida Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8266 Differential Revision: https://phab.enlightenment.org/D10177 --- src/lib/elementary/efl_ui_collection.c | 14 ++++++++++++-- src/lib/elementary/efl_ui_collection_view.c | 13 +++++++++++-- src/lib/elementary/efl_ui_item_clickable.eo | 17 ++++++++++++----- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c index abef6732c1..0dac5b0a60 100644 --- a/src/lib/elementary/efl_ui_collection.c +++ b/src/lib/elementary/efl_ui_collection.c @@ -621,8 +621,18 @@ _redirect_cb(void *data, const Efl_Event *ev) { Eo *obj = data; -#define REDIRECT_EVT(item_evt, item) \ - if (item_evt == ev->desc) efl_event_callback_call(obj, item, ev->object); +#define REDIRECT_EVT(Desc, Item_Desc) \ + if (Desc == ev->desc) \ + { \ + Efl_Ui_Item_Clickable_Clicked item_clicked; \ + Efl_Input_Clickable_Clicked *clicked = ev->info; \ + \ + item_clicked.clicked = *clicked; \ + item_clicked.item = ev->object; \ + \ + efl_event_callback_call(obj, Item_Desc, &item_clicked); \ + } + REDIRECT_EVT(EFL_INPUT_EVENT_PRESSED, EFL_UI_EVENT_ITEM_PRESSED); REDIRECT_EVT(EFL_INPUT_EVENT_UNPRESSED, EFL_UI_EVENT_ITEM_UNPRESSED); REDIRECT_EVT(EFL_INPUT_EVENT_LONGPRESSED, EFL_UI_EVENT_ITEM_LONGPRESSED); diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index a13e69e49a..608c31c059 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -183,8 +183,17 @@ _redirect_item_cb(void *data, const Efl_Event *ev) { Eo *obj = data; -#define REDIRECT_EVT(item_evt, item) \ - if (item_evt == ev->desc) efl_event_callback_call(obj, item, ev->object); +#define REDIRECT_EVT(Desc, Item_Desc) \ + if (Desc == ev->desc) \ + { \ + Efl_Ui_Item_Clickable_Clicked item_clicked; \ + Efl_Input_Clickable_Clicked *clicked = ev->info; \ + \ + item_clicked.clicked = *clicked; \ + item_clicked.item = ev->object; \ + \ + efl_event_callback_call(obj, Item_Desc, &item_clicked); \ + } REDIRECT_EVT(EFL_INPUT_EVENT_PRESSED, EFL_UI_EVENT_ITEM_PRESSED); REDIRECT_EVT(EFL_INPUT_EVENT_UNPRESSED, EFL_UI_EVENT_ITEM_UNPRESSED); REDIRECT_EVT(EFL_INPUT_EVENT_LONGPRESSED, EFL_UI_EVENT_ITEM_LONGPRESSED); diff --git a/src/lib/elementary/efl_ui_item_clickable.eo b/src/lib/elementary/efl_ui_item_clickable.eo index 7177d24f49..1c4f9f318e 100644 --- a/src/lib/elementary/efl_ui_item_clickable.eo +++ b/src/lib/elementary/efl_ui_item_clickable.eo @@ -1,12 +1,19 @@ +import efl_input_clickable; + +struct @beta Efl.Ui.Item_Clickable_Clicked { + clicked: Efl.Input.Clickable_Clicked; + item: Efl.Ui.Item; +} + interface @beta Efl.Ui.Item_Clickable { [[Shared sets of events between @Efl.Ui.Collection and @Efl.Ui.Collection_View.]] event_prefix: efl_ui; events { - item,pressed : Efl.Ui.Item; [[A $press event occurred over an item.]] - item,unpressed : Efl.Ui.Item; [[An $unpress event occurred over an item.]] - item,longpressed : Efl.Ui.Item; [[A $longpressed event occurred over an item.]] - item,clicked : Efl.Ui.Item; [[A $clicked event occurred over an item.]] - item,clicked,any : Efl.Ui.Item; [[A $clicked,any event occurred over an item.]] + item,pressed : Efl.Ui.Item_Clickable_Clicked; [[A $press event occurred over an item.]] + item,unpressed : Efl.Ui.Item_Clickable_Clicked; [[An $unpress event occurred over an item.]] + item,longpressed : Efl.Ui.Item_Clickable_Clicked; [[A $longpressed event occurred over an item.]] + item,clicked : Efl.Ui.Item_Clickable_Clicked; [[A $clicked event occurred over an item.]] + item,clicked,any : Efl.Ui.Item_Clickable_Clicked; [[A $clicked,any event occurred over an item.]] } } \ No newline at end of file From 41d0ead833d0e48fb42aa537439f0fbd27d39a91 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 25 Sep 2019 21:59:29 -0400 Subject: [PATCH 115/115] elementary: stabilize Efl.Ui.Item_Clickable. Summary: Depends on D10177 Reviewers: zmike, bu5hm4n, segfaultxavi, lauromoura, SanghyeonLee, felipealmeida Reviewed By: zmike, SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8266 Differential Revision: https://phab.enlightenment.org/D10173 --- src/lib/elementary/efl_ui_item_clickable.eo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_item_clickable.eo b/src/lib/elementary/efl_ui_item_clickable.eo index 1c4f9f318e..5f92a5fbce 100644 --- a/src/lib/elementary/efl_ui_item_clickable.eo +++ b/src/lib/elementary/efl_ui_item_clickable.eo @@ -1,11 +1,11 @@ import efl_input_clickable; -struct @beta Efl.Ui.Item_Clickable_Clicked { +struct Efl.Ui.Item_Clickable_Clicked { clicked: Efl.Input.Clickable_Clicked; item: Efl.Ui.Item; } -interface @beta Efl.Ui.Item_Clickable +interface Efl.Ui.Item_Clickable { [[Shared sets of events between @Efl.Ui.Collection and @Efl.Ui.Collection_View.]] event_prefix: efl_ui;