Commit Graph

148 Commits

Author SHA1 Message Date
Marcel Hollerbach 57c7e59850 efl_ui_focus_manager_calc: fix resource leaks
this fixes CIDs 1396965 & 1396984
2019-09-16 17:57:20 +02:00
Marcel Hollerbach cbf7d71eeb efl_ui_focus_manager_calc: use a mempool instead of calloc / free
if we are heaving a streak of showing / hiding a lot of widgets we free
and calloc the same nodes all the time. This now lowers the amount of
callocs / frees that we are doing

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9618
2019-08-20 07:42:41 +02:00
Marcel Hollerbach ef858e1bfa efl_ui_focus_manager_calc: safe if this is root in a flag
otherwise we would need to get the private data of the focus manager
which is quite a heavy operation. This is slowing down enormously the
visibility setting of widgets.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9617
2019-08-20 07:42:39 +02:00
Marcel Hollerbach c1e6197b21 efl_ui_focus_manager_calc: optimize item deletion
if there is high frequency adding and deleting of items, the deletion
here can be quite heavy, this makes freeing a little bit faster.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9616
2019-08-20 07:42:38 +02:00
Mike Blumenkrantz 0dc166adbd efl_ui_focus_manager/calc: handle redirect setting if no previous redirect set
Summary:
use same pointer for conditional to improve readability, avoid passing null to
efl_ui_focus_manager_reset_history() which cannot be passed null

@fix

Depends on D8952

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: bu5hm4n, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8953
2019-05-29 12:29:03 -04:00
Marcel Hollerbach 6dec272d31 efl_ui_focus_object: apply new event calling convention
Summary:
ref T7758
Depends on D8408

Reviewers: cedric, zmike, segfaultxavi

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7758

Differential Revision: https://phab.enlightenment.org/D8409
2019-03-19 16:31:55 -04:00
Marcel Hollerbach e4e14f50db efl_ui_focus_manager_sub: apply new event calling convention
Summary: ref T7758

Reviewers: cedric, zmike, segfaultxavi

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7758

Differential Revision: https://phab.enlightenment.org/D8405
2019-03-19 16:31:34 -04:00
Christopher Michael 5e7bc44d34 efl_ui_focus_manager_calc: Fix resource leaks
Summary:
Coverity reports that we leak old_chain & chain variables here if we return.
Add an eina_array_free for both to clean this up.

Fixes Coverity CID1396984,CID1396965

@fix

Depends on D8353

Reviewers: raster, cedric, zmike, bu5hm4n, stefan_schmidt

Reviewed By: cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8355
2019-03-15 12:57:18 -04:00
Marcel Hollerbach 89b62fd225 efl_ui_focus_object: rename API
these API names have been considered a better choice.

ref T7571

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D7994
2019-02-22 14:00:33 +01:00
Marcel Hollerbach 93903a7ba3 efl_ui_focus_manager: rename focus,changed
focus,changed is already used in efl_ui_focus_object, which makes sense
there. However, here we listen for the property focus_manager, thus its
renamed to focus_manager,changed.

ref T7571

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D7990
2019-02-22 14:00:28 +01:00
Marcel Hollerbach 37d2d378ec eolian: drop class function overriding
Until this commit eo did class functions as part of the vtable, which
enabled those functions to be overwritten in classes inheriting another
class. However in task T7675 we decided that this is not really good for
bindings, as most OOP languages do not support this sort of feature.

After this commit eolian realizes class function completly outside of
the vtable, the c-symbol that is the class funciton is now just directly
redirecting to a implementation, without the involvement of the vtable.

This also means a change to the syntax created by eo:

Calling before:
  class_function(CLASS_A);
Calling after:
   class_function();

Implementation before:
   class_function(const Eo *obj, void *pd) { ... }
Implementation after:
   class_function(void) { ... }

This fixes T7675.

Co-authored-by: lauromauro <lauromoura@expertisesolutions.com.br>

Reviewed-by: Daniel Kolesa <daniel@octaforge.org>
Differential Revision: https://phab.enlightenment.org/D7901
2019-02-13 16:59:58 +01:00
Marcel Hollerbach ef874d5b59 efl_ui_focus_manager: performance optimize order setting
setting the order is a little bit expensive, this performance optimizes
order setting in the focus manager.  We don't need to set the order each
time something is registered, it is enough to set it once we need the
correct order.

We don't need to evalulate the state in the Manager_Root_Focus if the
rect is not registered. If its not, then another new element cannot
cause the rect to be registered.

Reviewed-by: YeongJong Lee <yj34.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D7450
2018-12-17 09:12:22 +01:00
Carsten Haitzler 0e7a24c1b8 efl ui focus manager - remove unused local vars warn 2018-12-04 08:36:00 +00:00
Marcel Hollerbach 1ede2302d3 efl_ui_focus_manager_root_focus: ensure that adapter is part of viewport
This ensures that the adapter part is part of the viewport elements and
border elements. This is done in order to support cases where a
elm_scroller content is not focusable. Before the element was not
correctly in viewport, and so not correctly registered.

ref T6804

Differential Revision: https://phab.enlightenment.org/D7364
2018-12-04 08:45:49 +01:00
Marcel Hollerbach a444ff743f elm_interface_scrollable: add support for *jumping* into a scroller
Until recently we have been only registering the border elements of the
graph, (so only the elements that don't have a neighboor). However this
lead to the situation that a scroller that is scrolled into the middle
(so not the x nor the y axis is scrolled to the max), is not accessable.

Now, we register all elements that have a neighboor in the outside.
The patch in the test suite is required in order to provide the correct
geometry to the implementation of efl_ui_focus_manager_sub.

Differential Revision: https://phab.enlightenment.org/D7360
2018-12-04 08:45:49 +01:00
Marcel Hollerbach ac8d16684d efl_ui_focus_manager_calc: ensure that the coords are marked dirty
this is needed when a object is unregistered, otherwise a user of the
event is not informed when a element is gone, and thus the border
elements might have changed.

Differential Revision: https://phab.enlightenment.org/D7353
2018-11-26 11:37:04 +01:00
Marcel Hollerbach e36dce177e efl_ui_focus_manager: introduce a new API
the new api can be used to freeze the cache. This means, when the
widgets of the focus manager are all equally moved, the cache can stay,
cause the relative positions did not change, this enables a whole new
set of available optimizations.

Differential Revision: https://phab.enlightenment.org/D7348
2018-11-26 11:37:04 +01:00
Marcel Hollerbach 97ece33134 efl_ui_focus_object: introduce a new event for focus geometry changes
before the move and resize events have been used. However, this turned
out to not work well, because not all registered items are real
efl.gfx.entity objects, there is also a custom property for getting the
focus geometry, so now this property is completed with a event that is
emitted when the focus geometry changes. With this event we can
reintroduce relation caching. Since all events are marked correctly
dirty now.

Differential Revision: https://phab.enlightenment.org/D7347
2018-11-26 11:37:04 +01:00
Marcel Hollerbach e661c4acc3 efl_ui_focus_manager_calc: reduce the amount of list operations
it appears that the calculation of the unordered elements can be done a
lot easier here, when checking in the initial for loop for the right
parent safes us two more list walk later on.

Additionally, if all elements in this chain have the right parent, and
the amount of elements is the same as the parent has, then this list can
be used as a full replacement.

Differential Revision: https://phab.enlightenment.org/D7330
2018-11-26 11:37:04 +01:00
Marcel Hollerbach 25ac6d4fcc efl_ui_focus_object: add new event
the new event indicates when the focus property of a child has changed.

Fixes T7438

Differential Revision: https://phab.enlightenment.org/D7263
2018-11-20 14:42:32 +01:00
Marcel Hollerbach c0e52526c6 efl_ui_focus_manager: make active getter work correctly
focus managers can be used via composition, in this case the normal
manager is NOT inheriting from the
EFL_UI_FOCUS_MANAGER_WINDOW_ROOT_INTERFACE class, but the composition
parent is.

fix T7390

Differential Revision: https://phab.enlightenment.org/D7230
2018-11-20 13:04:47 +01:00
Marcel Hollerbach 1c530d210d efl_ui_focus_manager: calculate new widgets undependend from dirty state
This fixes T7397

Differential Revision: https://phab.enlightenment.org/D7179
2018-11-15 13:55:37 +01:00
Marcel Hollerbach 17b57ba5ac efl_ui_focus_manager: rename a event
In eo there is a difference between legacy events and normal events.
However, when a legacy event, that is called "focused" is emitted, the
event EFL_UI_FOCUS_MANAGER_FOCUSED is emitted on those objects. This
leads to bugs and unexpected results in elm_scroller, and additionally
this problem blocks work that is done right now to add those "focused"
event calls to gengrid.

Differential Revision: https://phab.enlightenment.org/D7099
2018-11-02 02:22:13 +01:00
junsu choi 2f9c23a87e efl_ui_focus_manager: Add null check
Summary:
This commit add null check on _next and _request_subchild function.
The value 'node' is can be null.

Test Plan: N/A

Reviewers: bu5hm4n, YOhoho, Hermet

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7069
2018-09-21 16:54:23 +09:00
Alastair Poole 111f2fe89c efl_ui_focus_manager_calc: invalidate obj on delete.
Summary:
In some situations focus is being set to a deleted object.
Use EFL_EVENT_INVALIDATE on object deletion not
EFL_EVENT_DEL. This prevents the object to be again selected for restoring focus when a redirect is deleted.

This fixes SEGV with some widgets including popup tests.

Test Plan:
* elementary_test -to popup
* popup-center-text + 3 button (check add, remove buttons).
* Close popup, enter text (reopen popup and repeat).
* Crash should be avoided.

Reviewers: bu5hm4n, zmike

Reviewed By: bu5hm4n

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7026
2018-09-12 20:02:09 +01:00
Marcel Hollerbach bae53f7d72 efl_ui_focus_manager: do not adjust values on a inactive manager
The bug this fixes can be observed when opening elm_test with hoversel.

The problem here is that the focus manager gets operations called on it after it is not active anymore, which lead to the fact that focus was restored on something that was about to be deleted.
Differential Revision: https://phab.enlightenment.org/D6903
2018-09-06 18:08:35 +02:00
Marcel Hollerbach 4a808834d0 Revert "efl_ui_focus_manager: do not adjust values on a inactive manager"
Sorry this was a accident

This reverts commit a6ee2061a3.
2018-08-24 16:04:33 +02:00
Marcel Hollerbach a6ee2061a3 efl_ui_focus_manager: do not adjust values on a inactive manager
Differential Revision: https://phab.enlightenment.org/D6903
2018-08-24 15:48:38 +02:00
Marcel Hollerbach 37308192d9 efl_ui_focus_manager_calc: restore focus correctly if redirect gets NULL
Otherwise we might end up with focus beeing NULL.

Differential Revision: https://phab.enlightenment.org/D6803
2018-08-14 15:00:58 +02:00
Marcel Hollerbach f21cf89a2f efl_ui_focus_manager_calc: fix unregistering the root of a redirect
There is often a tree of elements registered in a manager that are
having all the same redirect element. Unserting the redirect property
just because the node has this redirect element is not helpfull as this
would break basically elm_tests button search. However, if it is the
container itself, then the redirect can be unset, as nothing else can
ever reach again the redirect manager.

ref D6800

Differential Revision: https://phab.enlightenment.org/D6802
2018-08-14 15:00:58 +02:00
Marcel Hollerbach 92bb03d7f5 efl_ui_focus_manager: adjust pop history pop
It now searches for a element if the focus stack is empty.

Differential Revision: https://phab.enlightenment.org/D6801
2018-08-14 15:00:58 +02:00
Marcel Hollerbach a62420ce36 efl_ui_focus_manager_calc: do not error when the configuraiton is equal
Summary:
Before this was erroring. However, this error was not reporting a bad
situation, thus there is no need to error. This patch fixes errors on
the Popup test when scrollable is set to 1.

Reviewers: devilhorns, zmike

Reviewed By: zmike

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6560
2018-07-12 16:15:59 +09:00
Marcel Hollerbach 1730d95896 efl_ui_focus_manager_calc: only perform operation if really required
Summary:
_manager_in_chain_set is not needed to be called if the focus property
is already correct. If a manager is moved out of the redirect property,
then the focus is dropped completly

Reviewers: ManMower, devilhorns, zmike, stephenmhouston

Reviewed By: zmike

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6338
2018-06-29 11:36:30 -04:00
Derek Foreman 59c2f78d79 efl_ui_focus_manager: track list presence
By keeping track of whether a node is on the dirty list or not we can
save ourself list walks trying to remove items that aren't present.

Differential Revision: https://phab.enlightenment.org/D6349

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2018-06-22 10:38:11 +02:00
Marcel Hollerbach a2df08cb20 efl_ui_focus_manager_calc: fix warnings
Summary: its a false positive...

Reviewers: zmike, ManMower, devilhorns, Hermet

Reviewed By: Hermet

Subscribers: Hermet, cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6342
2018-06-21 14:52:29 +09:00
Marcel Hollerbach 69c2e6f0e6 efl_ui_focus_manager: unset redirect instead of wrefing it
so focus is restored correctly
2018-05-08 11:50:04 +02:00
Marcel Hollerbach fa9aff8f70 efl_ui_focus_manager_calc: do not restore focus when redirect is set
When there is a redirect there is no need to adjust the focus property
based on a unregister, so just continue and cleanup the history. When
the redirect is unset the focus is restored.

fix T6908
2018-05-08 11:50:04 +02:00
Mike Blumenkrantz da13878cc2 efl_ui_focus_manager_calc: resolve shadow warning
Summary:
lib/elementary/efl_ui_focus_manager_calc.c: In function ‘node_item_free’:
lib/elementary/efl_ui_focus_manager_calc.c:208:20: warning: declaration of ‘n’ shadows a previous local [-Wshadow]
         Eina_List *n;
                    ^
lib/elementary/efl_ui_focus_manager_calc.c:197:10: note: shadowed declaration is here
    Node *n;
          ^

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6020
2018-05-03 16:13:30 -04:00
Marcel Hollerbach d1a89cfd9d efl_ui_focus_manager_calc: partly revert 3571b35a30
And document why this must be, so the same error is not done again :)

fix T6908
2018-05-01 20:27:07 +02:00
Marcel Hollerbach dc57abfafd efl_ui_focus_manager: remove partners field 2018-05-01 20:27:07 +02:00
Marcel Hollerbach 258b96be35 efl_ui_focus: move graph calculation to seperated file 2018-05-01 20:27:07 +02:00
Marcel Hollerbach 9669ca9ab9 efl_ui_focus_manager_calc: prepare the tree when we attempt to move 2018-05-01 20:27:07 +02:00
Marcel Hollerbach 27d6f3a65d efl_ui_focus_util: add new function for complementing the direction 2018-04-30 19:24:47 +02:00
Marcel Hollerbach 3571b35a30 efl_ui_focus_manager_calc: drop redirect if there is no candidate 2018-04-30 15:22:52 +02:00
Marcel Hollerbach bd9b112094 efl_ui_focus_manager_calc: make the preparation call tree style
So we make sure that all children are prepared.
2018-04-30 15:22:52 +02:00
Xavi Artigas 55bd097a3d Efl.Gfx.Entity (from Efl.Gfx)
Ref https://phab.enlightenment.org/T6847

Reviewed-by: Cedric Bail <cedric@osg.samsung.com>
2018-04-24 09:03:32 -07:00
Daniel Kolesa fcae7cab27 eolian gen: enable constness generation on property getter impls
This changes a lot of things all across the EFL. Previously,
methods tagged @const had both their external prototype and
internal impl generated with const on object, while property
getters only had const on the external API. This is now changed
and it all has const everywhere.

Ref T6859.
2018-04-17 20:31:55 +02:00
Marcel Hollerbach 803fddea5d efl_ui_focus_manager_calc: do not redirect requested calls
this is not documented and does not make sense.
2018-04-13 11:07:34 +02:00
YeongJong Lee 35e7b36411 efl_ui_focus_manager_calc: a node from focus_stack is always normal node.
Summary:
focus_stack can't store logical node. we don't need to check a node from
focus_stack is not normal.
see line 1613

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5927
2018-04-13 11:07:34 +02:00
YeongJong Lee 4841165530 efl_ui_focus_manager_calc: remove needless check for normal node
Summary:
a node in focus stack is always normal node. we don't need to check whether
node is normal.

see also, 97ec48434f

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5930
2018-04-13 11:07:34 +02:00