Commit Graph

148 Commits

Author SHA1 Message Date
Marcel Hollerbach 01272c71d0 efl_ui_focus_manager: make request_move more powerfull
it turns out that it is useful and needed (for future patches) to
request moves for nodes that are not focused currently. It is also
needed to request a move that might end up in a logical node.
2018-04-13 11:07:33 +02:00
Marcel Hollerbach 32e17ecdc2 efl_ui_focus_manager_calc: only call next when the node is unexpected
ref T6793
2018-04-13 11:07:33 +02:00
Marcel Hollerbach 253430ab76 efl_ui_focus_manager_calc: call next after requesting a subchild
requesting subchild for subchild is not a good idea, as it really only
fetches for a subchild, and never calls next and escapes the children of
the passed node.

fix T6793
2018-04-11 17:16:34 +02:00
Marcel Hollerbach 84ad5d9fe3 introduce efl_ui_focus_manager_window_root
Which is a interface that indicates that this is the root of all focus
managers.
2018-04-09 18:05:27 +02:00
Marcel Hollerbach 39739ba333 efl_ui_focus_manager_calc: node depth is 0 for a NULL object 2018-04-04 10:11:22 +02:00
Marcel Hollerbach 7fe52c55cf efl_ui_focus_manager_calc: fix infinite loop in _request_subchild
When the subchild where we request subchilds from was regular, the while
loop would have run infinitly. This is now fixed by at least calling
once _next, the check to not run outside the node is now done with
calculating the depth of the nodes.
2018-04-03 14:08:28 +02:00
Marcel Hollerbach 28201f32a6 efl_ui_focus_manager_calc: do not crash for the case of a invalid child 2018-03-28 10:48:01 +02:00
Marcel Hollerbach b23c2b34e3 efl_ui_focus_manager: NULL out fields correctly 2018-03-28 10:48:01 +02:00
Marcel Hollerbach ca2461c280 efl_ui_focus_manager: move cleanup into one place
ref T6793
2018-03-28 10:48:01 +02:00
Marcel Hollerbach c8ba7a070f efl_ui_focus_manager_calc: set redirect before setting focus
settings the redirect might result in unfocus calls, that might unset
evas_object_focus on a object that might be registered in two managers
due to border linking. This fixes mysterical disapearing focus.
2018-03-15 15:39:12 +01:00
Marcel Hollerbach 875a7eb0da efl_ui_focus_manager_calc: do not set focus on a deletion manager
otherwise objects might already be on the way out, without a elementary
parent.
2018-03-15 15:39:12 +01:00
Marcel Hollerbach 844854d3e8 efl_ui_focus_manager_calc: add onedirection to dirty 2018-03-15 15:39:12 +01:00
Marcel Hollerbach 253680f754 efl_ui_focus_manager_calc: performe refocus after the node is deleted
if node is the last element, the element will be focused again, and
later deleted, without cleaning up the history
2018-03-07 19:27:12 +09:00
Marcel Hollerbach d9ae0657e8 efl_ui_focus_manager: do not call on a NULL object 2018-02-20 16:48:42 +01:00
Marcel Hollerbach ea6a4e1a60 efl_ui_focus_manager_calc: unset manager to make touching sure
when there is only one object in a manager, and this object has a
redirect manager, then right now nothing will happen and nothing will be
called on the redirect manager.

With this patch the redirect manager will be unset when the manager
cannot give a correct candidate.
2018-02-20 16:48:42 +01:00
Yeongjong Lee e031867354 efl_ui_focus_manager_calc: fallback to use root if the focus stack is empty
Summary: this patch fixes T6664

Test Plan:
1. elementary_test -to focus
2. click Disable button
3. check whether you can move focus using key event.

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric

Maniphest Tasks: T6664

Differential Revision: https://phab.enlightenment.org/D5813
2018-02-20 16:48:42 +01:00
YeongJong Lee f6777aa4ac efl_ui_focus_manager_calc: search redirect_entry if there is no candidate
Summary:
redirect is out of the focus stack. we need to find redirect_entry after last
node of redirect manager instead of focus stack.

Test Plan:
1. elementary_test -to focus
2. move focus using tab key
3. check that there is focus cycle

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5811
2018-02-20 16:48:42 +01:00
Marcel Hollerbach 97ec48434f efl_ui_focus_manager_calc: keep the entry for the redirect seperated
logicals on the focus stack can cause there a lot of confusion.

This fixes a missed focus out event from the entry in elementary_test
2018-01-27 13:01:20 +01:00
Marcel Hollerbach 7d0008d6e2 efl_ui_focus_manager_calc: prepare everything before border elem eval
otherwise we might miss the elements that are registered on prepare.
2018-01-26 15:11:50 +01:00
Marcel Hollerbach 1be0506b31 efl_ui_focus_manager_calc: check earlier for LOGICAL
this safes us performance
2018-01-26 15:11:50 +01:00
Marcel Hollerbach 8d1b9d4f9e efl_ui_focus_manager: listen to deletion for regular and logical
otherwise we might exit with a load of errors
2018-01-23 21:27:45 +01:00
Marcel Hollerbach 5b64079ee9 efl_ui_focus_manager: fix infinit loop in enlightenment wizard
we unsetted and setted focus_manager once too often, so we ended up in a
infinite loop. This should be fixed now. Sorry Derek!
2018-01-16 23:22:01 +01:00
Yeongjong Lee 210db8fc5d efl_ui_focus: merge efl_ui_focus_user and efl_ui_focus_object into one mixin
Summary:
focus_user and focus_object are similar classes. by merging them into
one mixin, we can maintain consistency.

Test Plan: make check

Reviewers: bu5hm4n

Subscribers: cedric, Jaehyun_Cho, woohyun, jpeg

Differential Revision: https://phab.enlightenment.org/D5734
2018-01-16 22:39:13 +01:00
Jean-Philippe Andre a92186be6a ecore/edje/elm: Fix a few WRN from calls to NULL
This fixes some of the warnings generated by calling functions on NULL
objects. One of the main remaining points is to avoid unwanted warnings
on non-existing parts.

Ref T6326
2018-01-16 18:37:05 +09:00
YeongJong Lee 1b4f330c9c efl_ui_focus_manager_calc: store node data before the node is freed
Summary:
we can consider that the node is freed during focus_manager routine.
for example, efl_ui_focus_manager_redirect_set call edje event callbacks,
and a application can delete a object in the edje callback. if the object is
the focusable object of a node, focus_manager make the node freed.
the focus_manager is able to use freed node. (a good example is test_popup.c)

this prevent reusing freed pointers.

Test Plan:
1. elementary_test -to popup
2. popup-center-text + 1 button
3. Click the Close button
4. check that there is no erroe message

Reviewers: bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric, woohyun, jpeg, Jaehyun_Cho

Differential Revision: https://phab.enlightenment.org/D5729
2018-01-11 09:51:59 +01:00
Cedric BAIL 526415d903 eo: make efl_provider_find a @const function. 2018-01-04 11:45:10 -08:00
Marcel Hollerbach f05249f30b efl_ui_focus_manager_calc: dont use sqrt
We only need the order, not the exact value
2017-12-15 11:31:25 +01:00
Marcel Hollerbach f1a2e0f439 efl_ui_focus_manager_calc: use pow instead of powerof2 2017-12-15 11:31:25 +01:00
Marcel Hollerbach 685fb33d86 efl_ui_focus_manager_calc: move the second stage result to another list
holding them in the same list is a problem due to the fact that a member
B in partners of A means that there also needs to be A in the partners
of A. Due to this fact the cleanup logic before missed a few nodes and
crashed in some cases. This is now fixed.
2017-12-12 12:51:03 +01:00
Marcel Hollerbach b4e21d7f4f efl_ui_focus_manager: this thing is not used anymore 2017-12-11 10:46:52 +01:00
Marcel Hollerbach c3a4fc7d64 efl_ui_focus_manager_calc: performe the second stage later
the second stage is not meant to be a transition in both ways, only
because the one item is closer does not mean a other one is closer.
2017-12-11 10:46:52 +01:00
Marcel Hollerbach 87cc19b94d efl_ui_focus_manager_calc: implement better relation calculation
The new calculation mechanism does not only look into the exact
directions up,right,down,left of a node, it also now checks the sectors,
bound by: x < node.x, x > node.max_x, y < node.y, y > node.max_y.

ref T6453
2017-12-11 10:46:52 +01:00
Marcel Hollerbach 22c7fb86d9 efl_ui_focus_manager_calc: refactor into its own stage 2017-12-11 10:46:52 +01:00
Marcel Hollerbach 44d7ff1fb3 efl_ui_focus_manager_calc: refactor calculation logic 2017-12-11 10:46:52 +01:00
Marcel Hollerbach eee6fbad78 focus: more testcases! 2017-12-06 16:10:18 +01:00
Marcel Hollerbach c1c58cfb69 efl_ui_focus_manager_calc: fix first touch setup for none regular tests
we had the issue that we stopped looping if we are a regular end. but we
need to continue until we have no rec_manager anymore.
2017-12-06 16:10:18 +01:00
Marcel Hollerbach 78afa2fb84 efl_ui_focus_user/object: fix api duplication
just like the commit before, this fixes duplicated api names
2017-12-05 17:19:28 +01:00
Marcel Hollerbach baf624680d efl_ui_focus_manager: fix api duplication 2017-12-05 17:19:28 +01:00
Chris Michael edc6ee8680 elementary: Remove set but unused variables
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-11-28 11:42:01 -05:00
Al Poole 75a450f2ba efl_ui_focus_manager: remove unnecessary debugging printf. 2017-11-22 16:11:12 +00:00
Marcel Hollerbach 9fc0cafde4 efl_ui_focus_manager: fixup previous commit
i forgot to git commit --amend ... i am sorry :[
2017-11-22 14:57:57 +01:00
Marcel Hollerbach 0f8e0e2324 efl_ui_focus_manager: try to error out instead of a infinit recusrion 2017-11-22 14:45:47 +01:00
Marcel Hollerbach 0d50783077 efl_ui_focus_manager: move preparing of the manager to its own api
with this some imlpementations can decide if they want to fallback to
some older focused item once they need to prepare themself for this
call.
2017-11-22 13:24:52 +01:00
Marcel Hollerbach e8cfdb5dcd efl_ui_focus_manager_calc: keep focus history arround
this now keeps items arround even if a explicit other widget was
focused. This is usefull if we have a few logical items on the focus
stack and you remove them.
2017-11-21 16:32:27 +01:00
Marcel Hollerbach 688e7001c1 efl_ui_focus_manager_calc: remove a logical item that caused a redirect
so we dont try to focus a logical item.
2017-11-21 16:32:27 +01:00
Marcel Hollerbach 67188ba22b efl_ui_focus_manager: emit callbacks after stack change
fix T6389
2017-11-20 09:13:08 +01:00
Pawel Aksiutowicz cb2ba05675 elementary: fix typos
Reviewers: stanluk, lukasz.stanislawski

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5494
2017-11-20 11:54:52 +09:00
Marcel Hollerbach 19cb57d914 efl_ui_focus_manager_calc: efl_wref_del deletes the wref
A happy thank you goes to the doc for leaving this trivial peace of
information undiscovered!

Followup commit will fix this
2017-11-17 16:08:14 +01:00
Marcel Hollerbach ffca5284ae efl_ui_focus_manager:do not followup if we have not changed candidate
_followup_previous_direction should only be called if there was a real
change to the redirect. In was happening that we have not changed the
focus but called _followup_previous_direction, which lead to weird focus
changes.
2017-11-17 16:08:14 +01:00
Marcel Hollerbach 4086f18ebf efl_ui_focus_manager_calc: error if a element is not registered yet 2017-11-17 16:08:14 +01:00
Marcel Hollerbach de084292e0 efl_ui_focus_manager: unset the redirect chain once a redirect is set
this prevents the manager from having a redirect chain while not even
beeing used by the root manager
2017-11-15 13:21:22 +01:00
Marcel Hollerbach 7e227161b9 efl_ui_focus_manager_calc: correct handle focus when redirects are set
so we dont have two focused elements
2017-11-15 13:21:22 +01:00
Marcel Hollerbach df81e2f492 efl_ui_focus_manager: ensure the manager is in focus when focus is set
this makes handling of focus easier in elementary
2017-11-15 13:21:22 +01:00
Marcel Hollerbach 07cb2d2dcd efl_ui_focus_object: document the bahaviour of the manager property 2017-11-15 13:21:22 +01:00
Pawel Aksiutowicz e2ad1469a5 focus: Some typos for efl_ui_focus_manager fixed
Reviewers: stanluk, lukasz.stanislawski

Subscribers: lukasz.stanislawski, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5433
2017-11-08 15:16:04 +09:00
Jean-Philippe Andre 6cea4993e0 elm: Don't do anything before construction
Obviously ui.win is still the ugly exception.
2017-11-07 14:43:22 +09:00
Chris Michael 5332f3355b efl-ui-focus-manager: Remove set but not used variable
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-11-02 10:05:56 -04:00
Marcel Hollerbach f2da8a7f54 efl_ui_focus_manager: remove strange naming of a function
this is just normal next or prev, the prepare is done on the caller side
now
2017-11-01 15:26:52 +01:00
Marcel Hollerbach 08d104498c efl_ui_focus_manager: improve debug informations 2017-11-01 15:26:52 +01:00
Marcel Hollerbach 1fcb357a66 efl_ui_focus_manager_calc: remove unused struct 2017-10-27 17:33:47 +02:00
Marcel Hollerbach 1c43f56fb9 efl_ui_focus_manager_calc: fix warnings 2017-10-27 17:33:04 +02:00
Marcel Hollerbach 5b8fbb7c69 efl_ui_focus_manager_calc: return last object when unfocusing last
this makes code easier, and fixes a bug where the wrong last element is
taken.
2017-10-27 17:08:08 +02:00
Marcel Hollerbach 1252b5ac29 efl_ui_focus_manager: correctly handle subitem directions in a redirect
in default focus just sets the focus to the first item in the redirect
manager, we now reset that back and move the focus to the last element
of a item.
2017-10-27 15:29:58 +02:00
Marcel Hollerbach acb469439f efl_ui_focus_manager: the FOCUSED event now carries the last focused
object

This is usefull to react on focused events
2017-10-27 12:06:40 +02:00
Marcel Hollerbach 3139b0f7f5 efl_ui_focus_manager: do not enter Nodes with redirects
we always want the redirect on the lowest level.
2017-10-27 12:06:40 +02:00
Marcel Hollerbach 3e726c364b efl_ui_focus_manager: reset when a redirect is unset
this keeps the history clear
2017-10-24 17:37:31 +02:00
Marcel Hollerbach f79b1b9826 efl_ui_focus_manager: new api
Can be used to fetch a focusable widget that has child as parent.
2017-10-20 17:21:57 +02:00
Marcel Hollerbach 8a0cf1418c efl_ui_focus_manager: unfocus even logical elements
entry for example is here a specialcase since it registeres itself as
logical with a redirect manager that is then empty and only has a root
element, which is again itself.
2017-10-20 11:54:08 +02:00
Marcel Hollerbach 5e96d6e378 efl_ui_focus_manager_calc: really free all direction
i must have been have asleep when i wrote this, we need to iterate all
directions not only to the max id of 4
2017-10-19 15:20:59 +02:00
Marcel Hollerbach 2e26d7a6cf efl_ui_focus_manager_calc: move the debug output in there
reduces the load of debug messages, and the debug messages are now only
emitted from the manager that is not the redirect. And the real elements
that are focused are printed
2017-10-19 15:20:59 +02:00
Marcel Hollerbach 67234dcde1 efl_ui_focus_manager_calc: reimplement move to be more compact & small
this fixes a bug when a redirect was unset while going the prev
direction.
2017-10-19 10:04:59 +02:00
Marcel Hollerbach 6956dfc7a6 efl_ui_focus_manager_calc: put every element on the focus stack
move the addition to the focus stack to the general path. This means
every element is now on the focus stack.
2017-10-19 10:04:59 +02:00
Marcel Hollerbach d701597eb9 efl_ui_focus_manager_calc: move unfocusing the last element into its own
function
2017-10-19 10:04:59 +02:00
Marcel Hollerbach 0220418b84 efl_ui_focus_manager_calc: check if we are already focused earlier
if we dont do that we may unset a redirect just to set the same redirect
again.
2017-10-19 10:04:59 +02:00
Marcel Hollerbach 45b4cdee19 efl_ui_focus_manager_calc: maintain focus when focused element is
unregistered

this should fix T6216.
2017-10-16 11:02:13 +02:00
Cedric Bail 6770f9b8a3 elementary: we actually do not use that object. 2017-10-13 12:58:01 -07:00
Marcel Hollerbach 6acaf6350c efl_ui_focus_object: introduce prepare_logical
with this call a registered logical item could prepare itself for a
deeper traversal
2017-10-13 12:31:48 +02:00
Marcel Hollerbach 441776f7cf efl_ui_focus_manager_calc: make sure to not access out of bounds mem 2017-10-13 11:52:58 +02:00
Marcel Hollerbach 247d203c68 elm_main: port to new focus api 2017-10-10 19:28:48 +02:00
Marcel Hollerbach 8453ebfe4e elm: move the focus direction definition to general
and remove the old definition
2017-10-10 19:28:48 +02:00
Marcel Hollerbach 991b7696b6 efl_ui_focus_manager_calc: delete items if they are deleted 2017-10-10 19:28:47 +02:00
Marcel Hollerbach 837f83114a efl_ui_focus_manager_calc: we dont need the explicit root handling,
that is done later in line 1205
2017-10-09 16:29:28 +02:00
Marcel Hollerbach 282883ff9c efl_ui_focus_manager_calc: focus a child if a logical is focused
If you call focus_set(m, o) where o is a logical child, then the focus
will go to any none logical child of o, or if there is nothing in the
children of o, then the focus will remain on the now focused element.
2017-10-09 13:10:51 +02:00
Marcel Hollerbach e5d1c1f195 Revert "elm focus manager - dont leak child lists when updating focus order"
This reverts commit bd6dcbb044.

This was not fixing the issue, just ducktaping over a bug in eolian, the
bug is now probebly fixed in eo / eolian.
2017-09-29 11:28:15 +02:00
Carsten Haitzler 2ac1323fac efl ui focusable - remove pointless check of ptr already checked
coverity fix CID 1381492
2017-09-29 09:00:43 +09:00
Carsten Haitzler 1dcac1853d efl ui focus - fix coverity complaints about derfer before null check
indeed there was a child cnull check after dereferencing the child...
so check completely. fix CID 1379925
2017-09-28 15:28:00 +09:00
Jean-Philippe Andre f3eff6eb3e efl: Introduce Eina.Rect and switch EO APIs to it
It's a complex struct but defined in EO as a simple struct. ABI-wise
it's equivalent to Eina_Rectangle. Some macros that use Eina_Rectangle
also work on Eina_Rect out of the box, most of the code dealing with
x,y,w,h will require no modifications either.

But Eina_Rect provides direct access to a size or position 2d component,
as well as the usual x,y,w,h. The field "rect" is provided as a
convenience for code dealing with both Eina_Rectangle and Eina_Rect. We
may or may not require it.

Note: Size2D could use unsigned values but I have spotted a few places
in the code that actually use -1 to indicate invalid size (as opposed to
0x0).

@feature
2017-09-18 13:22:52 +09:00
Marcel Hollerbach 3af81932b0 efl_ui_focus_manager: present a slightly better error message
with this and the backtrace you can probebly figure out if you just
registered the same widget twice for different types
2017-09-02 20:06:15 +02:00
Marcel Hollerbach ab2b9d9a3c efl_ui_focus_manager_calc: do not swallow a focus event
if we have been redirecting before, we would have lost that event due to
  the element here beeing at the top of that focus stack
2017-09-02 20:06:15 +02:00
Jean-Philippe Andre 9633023511 focus: Fix shadow warning 2017-09-01 10:09:37 +09:00
Carsten Haitzler bd6dcbb044 elm focus manager - dont leak child lists when updating focus order
REALLY fix T5800 by duplicating lists rather than taking ownership

@fix
2017-08-31 17:34:30 +09:00
Carsten Haitzler d0aefa87bf focus manager - fix spelling of variable
saved_order not safed_order
2017-08-31 16:45:49 +09:00
Marcel Hollerbach 0b3a14a387 efl_ui_focus_manager_calc: only focus none NULL candidates 2017-08-30 22:39:52 +02:00
Marcel Hollerbach ea5b0bdfde efl_ui_focus_manager: make logical_end work better
it turns out that we should also repsect logical elements that are
having a redirect_manager, since they are more at the "end" then a
potential regular node.

The user now needs to handle the logical_end call on this manager, or
handle at all what he wants to do with this information.

efl_ui_win now handles it in the way that it just focuses that logical
node, (which results in the redirect manager beeing set, then calling
again logical_end on that manager. Repeating this until we have finally
found a regular node that does fit out needs.
2017-08-30 22:39:52 +02:00
Marcel Hollerbach 245a04cc44 efl_ui_focus_manager: reset focus stack once we are changing redirect
ref T5923
2017-08-30 17:55:51 +02:00
Marcel Hollerbach 190cce71f5 efl_ui_focus_manager_calc: fix the class check of the redirect
this came up with a huge load of errors, i havent noticed them last
night. Sorry.
2017-08-11 10:32:59 +02:00
Marcel Hollerbach df3d0e3d7b efl_ui_focus_manager: make focus a property 2017-08-10 20:56:04 +02:00
Marcel Hollerbach d4cd85aa55 efl_ui_focus_manager: split this of tinto a class and a interface
it turns out to be very handy to have a interface for the moving and
border elements, that is unconnected to the way of how widgets are
registering themself.

This for example enables us to get a simple focus manager that just
redirects the call into a internal 2 dimensional data struct
2017-08-10 20:55:50 +02:00