path: root/src/lib/elementary/elm_widget.eo
diff options
authorMarcel Hollerbach <>2017-09-02 19:08:18 +0200
committerMarcel Hollerbach <>2017-09-02 21:10:56 +0200
commitc51f35d42a148b34a9cf74714ecc16609984eecb (patch)
tree9e7fa063e796c20c93ca695fa4b729a9e1843044 /src/lib/elementary/elm_widget.eo
parent3af81932b04c60f89903834057dfb652cdcd9d5c (diff)
elm_widget: move the complete regsiter/unregister logic
We had here a little problem, state focus_state_eval function handled the unregisteration and consideration of the focus flags and then only called a helper function (which was a widget function), that then did the registeration in logical or regular mode. Elm scroller for example took that function overwrote it and did onyl permit logical registrations. Then again a evaluation of the focus state and flags took place, and the function considered elm_scroller should be registered as regular object, but found it to be logical. This lead to the problem that we permantently unregistered Elm.Scroller and registered it again as logical just to unregister it again. This was on the one side a performance downside. But also a bug since all items from within the Elm_Scrollers sub manager are getting reparent onto the parent, which means not the root of the scroller (the scroller itself) is the logical entrypoint to the widget but rather this reparented widget, which led to unexpected focus warps like described in T5923. tldr: this fixes T5923
Diffstat (limited to 'src/lib/elementary/elm_widget.eo')
1 files changed, 20 insertions, 7 deletions
diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo
index ebeea3dc14..89d622f159 100644
--- a/src/lib/elementary/elm_widget.eo
+++ b/src/lib/elementary/elm_widget.eo
@@ -10,6 +10,13 @@ function Efl.Ui.Scrollable_On_Show_Region {
10 10
11struct @extern Elm.Theme; [[Elementary theme]] 11struct @extern Elm.Theme; [[Elementary theme]]
12 12
13struct Elm.Widget.Focus_State {
14 [[All relevant fields needed for the current state of focus registeration]]
15 manager : Efl.Ui.Focus.Manager; [[The manager where the widget is registered in]]
16 parent : Efl.Ui.Focus.User; [[The parent the widget is using as logical parent]]
17 logical : bool; [[$true if this is registered as logical currently]]
13abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, 20abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
14 Elm.Interface.Atspi_Component, Efl.Ui.Focus.User, 21 Elm.Interface.Atspi_Component, Efl.Ui.Focus.User,
15 Efl.Ui.Focus.Object, Efl.Ui.Base, Efl.Ui.Cursor) 22 Efl.Ui.Focus.Object, Efl.Ui.Base, Efl.Ui.Cursor)
@@ -794,15 +801,21 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
794 } 801 }
795 802
796 /* Focus Manager API */ 803 /* Focus Manager API */
797 focus_register @protected { 804 focus_state_apply @protected {
798 [[Register focus with the given focus manager.]] 805 [[Register focus with the given configuration.
807 The implementation can feel free to change the logical flag as it wants, but other than that it should strictly keep the configuration.
809 The implementation in elm.widget updates the current state into what is passed as configured state, respecting manager changes, registeration and unregistration based on if it should be registered or unregistered.
811 A manager field that is $null means that the widget should not or was not registered.
812 ]]
799 params { 813 params {
800 @in manager: Efl.Ui.Focus.Manager; [[The focus manager to register with.]] 814 @in current_state : Elm.Widget.Focus_State; [[The focus manager to register with.]]
801 @in logical: Efl.Ui.Focus.Object; [[The logical parent to use.]] 815 @inout configured_state : Elm.Widget.Focus_State; [[The evalulated Focus state that should be used]]
802 /* FIXME: The below doc needs fixing! */ 816 @in redirect : Elm.Widget; [[A redirect that will be set by the elm.widget implementation]]
803 @inout logical_flag: bool; [[reference to the flag indicating if the should be logical or not change this flag to the value you have it registered]]
804 } 817 }
805 return: bool; [[return $true or $false if the registration was successfull or not]] 818 return: bool; [[return $true or $false if the widget is registered or false if it is not]]
806 } 819 }
807 focus_manager_factory @protected { 820 focus_manager_factory @protected {
808 [[If the widget needs a focus manager, this function will be called. 821 [[If the widget needs a focus manager, this function will be called.