Commit Graph

147 Commits

Author SHA1 Message Date
Marcel Hollerbach 0d7535071c elementary: make our tests work again
7321911468 moved the constructor to to
top, which leads to the fact that a few widgets cannot fetch the shared
data of the window. Which made the test suite fail.

With this commit we are just moving the sub_object_add after the
constructor, which fixes the flip crash.
This fixes the test suite
2019-09-21 15:04:42 +02:00
Carsten Haitzler 7321911468 efl ui widget - call parent constructor before doing more init
the object is not properly set up yet for child classes -0 parent like
the main evas object or smart obj havent been constructed yet so call
this really early, not in the middle of construction of an efl ui
widget...

this fixes a segv in elementary_test -to filp where it segv's on
object construction where evas object ->cur/prev are NULL (not set up
yet).
2019-09-21 10:26:46 +01:00
Marcel Hollerbach ccdec4ba68 efl_ui_widget_part: implement all the missing API
Efl.Color and Efl.File cannot be done due to composition. Efl.Gfx.Image
can, so we can solve this via composition, this also resolves all the
other cases for Efl.Gfx.Image.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9991
2019-09-19 14:37:29 -07:00
Xavi Artigas 944d5f37c7 efl/image: Efl.Gfx.Image_Scale_Type -> Efl.Gfx.Image_Scale_Method
ref T7927, T7875
Depends on D9931
2019-09-16 11:06:02 +02:00
Marcel Hollerbach 63fd44ef16 efl_ui_widget: refactor constructor
Summary:
first of all, in efl-ui we should probebly ensure that a widget is
always created in a window object. Otherwise we are looking for trouble.

Additionally, calling efl_ui_win_shared_data_get on anything else than a
window object will result in a returned NULL value.
If we are not having a widget parent, there is also not much point in
calling a API that is only defined on the widget base class, so we also
move that away

Reviewers: kimcinoo, raster

Reviewed By: kimcinoo

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9762
2019-09-11 10:43:08 +09:00
Yeongjong Lee 37a63fb1ee efl_ui_widget: make Efl_Ui_Scrollable_On_Show_Region legacy
Summary:
`Efl_Ui_Scrollable_On_Show_Region` is only used for legacy EAPI. it moved to
elm_widget.h from eo file. also, it renamed `Elm_Widget_On_Show_Region_Cb`.

Reviewers: Jaehyun_Cho, zmike

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9896
2019-09-10 09:16:48 -04:00
Mike Blumenkrantz 121a437c4d api: remove Efl.Ui.Scroll_Block
Summary:
this now uses layout orient enum everywhere

fix T7921

Reviewers: segfaultxavi

Reviewed By: segfaultxavi

Subscribers: segfaultxavi, cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7921

Differential Revision: https://phab.enlightenment.org/D9804
2019-09-03 09:15:31 +02:00
Mike Blumenkrantz 9e0a285eea efl: implement efl.file::unload for classes that implement load
unload is a crucial method for classes that implement load, as this is
the method which is called during e.g., efl_file_simple_load() when
a new file is specified in order to destroy the previous object data

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9786
2019-08-29 17:17:08 +02:00
Shinwoo Kim cfc0d4866c efl_ui_widget: keep backward compatibility
It was possilbe to add an image with improper parent object before aa2d94f and
56752e0. This patch makes it possible. Sure there are error messages when user
adds an image object using non widget object as below but you can see image.

ERR<28822>:elementary ../src/lib/elementary/efl_ui_widget.c:4801 _efl_ui_widget_efl_object_constructor() You passed a wrong parent parameter (0x400000007ced (null)). Elementary widget's parent should be an elementary widget.
ERR<28822>:elementary ../src/lib/elementary/efl_ui_widget.c:4803 _efl_ui_widget_efl_object_constructor() No widget data for object 0x400000007ced ((null))
ERR<28822>:eina_safety ../src/lib/elementary/efl_ui_win.c:9450 efl_ui_win_shared_data_get() safety check failed: pd == NULL
ERR<28822>:eo ../src/lib/eo/eo.c:579 _efl_object_call_resolve() in src/lib/elementary/efl_ui_widget.eo.c:256: func 'efl_ui_widget_sub_object_add' (698) could not be resolved for class 'Evas.Canvas'.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9747
2019-08-27 15:02:32 +02:00
Yeongjong Lee e8a32d72c6 efl_ui_widget: correct the comparison parameter in scroll_freeze_pop
Summary:
It is copy/paste error.
See also, e7986cc646

Reviewers: bu5hm4n, zmike

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9695
2019-08-22 07:17:03 -04:00
Carsten Haitzler be6555e754 fix e did again after crash from dnd fix 2019-08-22 00:47:10 +01:00
Carsten Haitzler aa21bd3c60 elm - efl ui - dont crash if parent is not an elm widget 2019-08-22 00:22:39 +01:00
Marcel Hollerbach b8bf5b31e8 efl_ui_widget: fix model listenting logic
if we are walking this method twice (spoiler we do!) then we subscribe
twice to the event, which leads (depending on the order of executed
deletion) to the accessing of obj after its deleted.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9684
2019-08-21 10:46:37 -07:00
Marcel Hollerbach 4cede693a5 efl_ui_widget: remove self reference
as an example: elm_test uses roughly 500 widgets, this pointer takes 8
bytes, this is wasting quite some time, which can be perfectly safed by
just structuring the code a little bit more. In some callbacks we need
to call one more time efl_data_scope_get but that is not a that big
issue, as most calls after that are also doing a eo call on that object,
so the eo_id is already cached.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9683
2019-08-21 10:46:34 -07:00
Yeongjong Lee bb62f71fe2 efl_ui_widget: ensure that tree_unfocusable is binary number in its getter
since 2dd596084b, tree_unfocusable is changed from
Eina_Bool to int.
Double negation ensure binary return value of `elm_widget_tree_unfocusable_get`

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9673
2019-08-21 14:20:33 +02:00
Marcel Hollerbach b5f458f5b8 efl_ui_widget: fixup field counting
this has to use tree_unfocusable not disabled.

ref D9644

Reviewed-by: YeongJong Lee <yj34.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9671
2019-08-21 11:59:15 +02:00
Yeongjong Lee e7986cc646 efl_ui_widget: correct the comparison parameter in scroll_freeze_push
I guess it is copy/paste error.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9669
2019-08-21 11:59:12 +02:00
Yeongjong Lee 5f4c9a4458 efl_ui_widget: fix dereference null return value issues
Dereference null return value issues is reported by Coverity.

If `sd` is NULL, it will return zero values.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9668
2019-08-21 09:47:19 +02:00
Marcel Hollerbach 3c098673ab efl_ui_widget: remove x,y,w,h
this is used for storing the position and size of the widget. However,
just in elm_test this eats 2KB of ram, just for saving them. The cases
where they have been used do not seem like a great performance hotspot,
additionally, in the panel cases the privat data of the widget is
achived anyways, so eo is involved and we are spending some time there
anyways.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9646
2019-08-20 12:30:07 -07:00
Marcel Hollerbach 56752e0b3b efl_ui_widget: do not walk parent chain for none legacy cases
walking here the parent chain can be very costly, esp. if you make a lot
of widgets visible or hide them. With this commit we ensure that we only
walk the parent chain when there is a custom chain, which is only the
case in legacy. This gets us about 2-3 FPS on the rpi with the
item_container benchmark.

With earlier commits, tree_unfocusable and disabled is honoring the
whole parent chain, so checking that alone, without the parent chain, is
fine.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9645
2019-08-20 12:30:05 -07:00
Marcel Hollerbach 2dd596084b efl_ui_widget: make treeunfocusable state easier
Before this patch tree unfocusable set just set a simple flag, getting
this state however forced you to traverse the whole parent chain to get
the real result.
With this patch the setting of the unfocusable flag is heavier as it
walks all the children of the widget, however, the getting of the flag
is way easier now. The next revision will refactor the focus related
APIs for that.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9644
2019-08-20 12:30:03 -07:00
Marcel Hollerbach b4b17993d5 efl_ui_widget: skip custom focus parent logic
asking for a parent provider only makes sense if we are having a custom
focus parent provider, otherwise this will just result in the normal
parent relation. Not doing this safes us a lot of time that we spent for
nothing in the focus evalulation code.

The gengrid change is needed as the parent provider should be applied
after the constructor is called, otherwise there is no garantee that
shared_win_data is not NULL.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9643
2019-08-20 12:30:00 -07:00
Marcel Hollerbach aa2d94f901 efl_ui_widget: add a place to share data
this introduces a shared place to all widgets. The shared pointer is
allocated in the window, as the window outlifes every widget that is
part of it.

This struct will be later used for further optimizations like:

1. There are really heavy focus operations which are only needed for
gengrid/genlst, there is no point in executing them if there is no
gen**** added to the window object. So we can skip the custom
parent_provider logic that is only introduced for gengrid / genlist.

2. Legacy focus APIs must do list walks, which means, on every focus
operation we always have to walk the full list up to the parent, which
is annoying and slow, as we *most of the time* do not use legacy focus
API.

This list can be continued, the above two cases are fixed in the next
revisions.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9642
2019-08-20 12:29:58 -07:00
Marcel Hollerbach ead8a28057 efl_ui_widget: optimize size / position setting
calling geometry set here is again calling the API in canvas object that
splits this call to size_set and position_set which means we spent quite
a bit of time in eo, just to call the same APIs we could call directly.
With this commit here, the calls are directly going to the right
objects, with the right API.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9619
2019-08-20 07:42:43 +02:00
Cedric BAIL a5a7c67bdf elementary: add support for efl_ui_property_bind to all efl_part inheriting from widget using reflection.
Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D9528
2019-08-12 10:13:35 -07:00
Mike Blumenkrantz 7e517e2a11 elm/efl_ui: remove elm_layout_sizing_eval implementations
Summary:
historically there have been two methods of calculating sizes in elm:
* elm_layout_sizing_eval
* evas_object_smart_calculate (now efl_canvas_group_calculate)

the former was used to set size hints on widgets, while the latter was
used to perform internal size calcs for the widget. for things to
work correctly, these functions had to be triggered in just the right
order at just the right time. many hard-to-fix bugs related to widget
sizing over the years have been the result of this split

this patch removes elm_layout_sizing_eval implementations so that all
widgets perform both internal size calcs and size hint setting all
in the same function, ensuring that these are always in sync

the result is that in the vast majority of cases, far fewer recalcs
happen for widgets, and they are quicker to achieve their final size

Depends on D9438

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: bu5hm4n, cedric, #reviewers, #committers

Tags: #efl_widgets

Maniphest Tasks: T8059

Differential Revision: https://phab.enlightenment.org/D9439
2019-07-30 13:12:52 -04:00
Mike Blumenkrantz e0ae3a9a76 efl_ui/widget: check legacy type on correct object for scroll_hold push/pop
too much copy/paste

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9399
2019-07-29 16:06:20 +02:00
Marcel Hollerbach 5fd3436b17 efl_ui_widget: fix warning 2019-07-22 10:44:30 +02:00
Mike Blumenkrantz 5dac20f69f efl_ui_widget: add safety checks to verify parents aren't being added as children
somehow it was never checked to see if a parent was being added as a subobject
of a parent's own child object (recursive hierarchy)

@fix

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9333
2019-07-22 10:44:30 +02:00
Cedric BAIL 0b949d0e7a elementary: first search on ourself instead of our parent for all providers.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9293
2019-07-17 21:57:54 +02:00
Cedric BAIL 2d481d8593 efl: add a Efl.Model_Provider that every widget will look up for in their parent tree.
This is done to simplify code as you only need to set the model on the
provider and all the widget that are using it as a provider will automatically be
updated. The child will find a provider during at the time the first property binding
is set on the widget by checking if the parent have an Efl.Model_Provider set. It is
not necessary to set a model to have a valid lookup on a Efl.Model_Provider. To disable
a widget lookup, you can just force set a model on it (even NULL) and it will disable
the lookup.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9290
2019-07-17 21:57:51 +02:00
Cedric BAIL 4d071ff1cb efl: implement notification for when the model is changed on a widget.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9288
2019-07-17 21:57:49 +02:00
Marcel Hollerbach a6fa2f12d6 efl_ui_widget: relax the amount of event subscriptions
there is a very basic problem in eo events. We are having one central
array of event subscription, if for example a widget is now listening to
changes in its parent, then we are 100% asking for trouble.

As an example:
- A scroller with 100 buttons in it.
- Every button will have a subscription to the FOCUS_MANAGER_CHANGED
event

If you now scroll, the position is updated in the scroller, therefore
the position in scroller is updated. This has the result that the whole
list of 100 event subscriptions is walked, which is obviously bad,
however, this solution here is way easier than fixing eo (i am not even
sure there is a nice solution to it).

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9324
2019-07-17 10:17:46 -07:00
Marcel Hollerbach e76349cd41 efl_ui_widget: performance optimize deletion
when a logic parent does not have any widgets left, the parent needs to
be reevaluated. However, this only has to happen when there is a change
in state (eg. from 0 -> N or from N -> 0). Every other call can be
safed. This commit introduces this checking, and safes up performance.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9323
2019-07-17 10:17:44 -07:00
Mike Blumenkrantz 66ba42e74d efl_ui_widget_part: implement some expected methods
checking part type and part geometry is pretty common, so these base
implementations can fill in gaps in existing functionality

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9317
2019-07-16 14:48:45 +02:00
Marcel Hollerbach a94c72f4de efl_ui_widget: optimize focus
this commit ensures 2 things:
1. This ensures that the parent is not evaluated when there was no state
changed, this cuts down roughly 30% of the calls to full_eval
2. This ensures that we only listen to parent manager changes when we
are actaully registered. This reduces the amount spend in event emission
a lot.
2019-07-04 20:41:23 +02:00
Mike Blumenkrantz 4046628633 efl_ui/widget: skip updating access info during parent_set(NULL) if dead
Summary:
no need to update access info for dead objects

@fix
Depends on D8983

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8984
2019-05-29 12:29:04 -04:00
Marcel Hollerbach ea4b840539 efl_ui_widget: error on NULL passing
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8747
2019-04-30 20:45:49 +02:00
Marcel Hollerbach 4f0ce2c58c efl_ui: add a internal flag to mark widgets internal
when a widget is marked internal, widgets can use that to behave in
certain ways. Box for example uses this to not alter the widget_parent
property anymore. Which is usefull for when boxes are used internally.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8736
2019-04-30 20:45:40 +02:00
Marcel Hollerbach 3d44b9bdb8 efl_ui_widget: remove unused function
Reviewers: zmike, cedric, segfaultxavi, devilhorns

Reviewed By: devilhorns

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8672
2019-04-22 07:06:40 -04:00
Yeongjong Lee 41136db8e8 ui.widget: remove elm_widget_sub_object_parent_add from each of widgets
since commit a1addad60e, To add myself as a sub object of parent object will be
done in Efl.Ui.Widget constructor.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8280
2019-04-18 11:01:19 +02:00
Marcel Hollerbach adc51e882c efl_ui_widget: we should ensure that every subobject is a gfx entity
we are calling visible_set on them later on, this will drop errors,
additionally this safes us from checking this in the widget-container
code.

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8520
2019-04-17 15:21:09 +02:00
Yeongjong Lee 48c27364fc efl_ui_widget: avoid calling null parent
Summary:
This will fix unnecessary warnings on P280.

Thanks to segfaultxavi for reporting.

ref T7796

Reviewers: zmike, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7796

Differential Revision: https://phab.enlightenment.org/D8599
2019-04-12 09:15:11 +02:00
Woochanlee 638a36ea9a efl_ui_widget: Fix disabled set calling without meaning.
Summary:
The efl_ui_widget_disabled_set calling even the state is not change when widget create and destroy.

It broken backward compatibility.

T7799
@fix

Reviewers: bu5hm4n, Jaehyun_Cho

Reviewed By: Jaehyun_Cho

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8600
2019-04-12 15:45:37 +09:00
Marcel Hollerbach 0c0f47796b efl_ui_widget: move from elm_widget_top_get to provider_find
this resolves a lot of cases where focus_highlight API was called on a
object, which is not a efl_ui_win object. With this patch we ensure that
the object is always a window.

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D8476
2019-03-29 14:02:32 +01:00
Marcel Hollerbach fce4d95596 efl_ui_widget: add implementation for finding the window
the problem with the previous implementation (just redirect the calls to
the widget_parent then to the efl_parent is that after invalidate its
impossible to find the window where the widget is in. However, there are
cases where we want to have access to the window of the widget, for
example, to invalidate focus highlight etc..
The window of a widget is always constant, and cannot be changed (as the
evas object cannot hop accross different evas)

Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D8475
2019-03-29 14:02:31 +01:00
Marcel Hollerbach b54035213f efl_ui_widget: reintroduce legacy behaviour
before the refactoring of the disabled property, there was no way to
enable a widget which has a disabled tree. This here however enables
this to work again like this. The user will be told with an error
message. The integraty of the property is maintained accross reparents.

Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D8459
2019-03-29 08:26:06 +01:00
Marcel Hollerbach bb0290edbe efl_ui_widget: resolve warning about multiple defines
Summary:
the difference here is, that the macro before did not print ERR's the
one now does. Hence this commit remove two error messages.

Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8415
2019-03-19 16:28:10 -04:00
Xavi Artigas 8c39c0e251 Revert "efl_ui_widget: resolve warning about multiple defines"
This reverts commit 9012742f9a.

I landed this too hastily.
2019-03-19 16:50:13 +01:00
Marcel Hollerbach 9012742f9a efl_ui_widget: resolve warning about multiple defines
Summary:
the difference here is, that the macro before did not print ERR's the
one now does. Hence this commit remove two error messages.

Depends on D8394

Reviewers: zmike, segfaultxavi, cedric, devilhorns

Reviewed By: segfaultxavi

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8395
2019-03-19 16:41:45 +01:00