summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-11 16:40:40 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-17 09:12:22 +0100
commit6922761f3fd0351403e0c2c6d10d1fd0c4fe9bdd (patch)
tree414b7706e51f3185d96422b4b9cc66da2fef5537 /src
parentef874d5b5940e9f16f783f4d54aec0da9655e976 (diff)
elm_gen****: fix focus restoring on window focus changes
this ensures that if there is no focused item, that at least the container is focused. This leads to the fact that the elm_genlist /elm_gengrid is refocused when a window is unfocused and focused again. Reviewed-by: YeongJong Lee <yj34.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7451
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/elm_gengrid.c15
-rw-r--r--src/lib/elementary/elm_gengrid.eo1
-rw-r--r--src/lib/elementary/elm_genlist.c14
-rw-r--r--src/lib/elementary/elm_genlist.eo1
4 files changed, 28 insertions, 3 deletions
diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index 14ed8009f9..ef3da833fb 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -4255,12 +4255,23 @@ _elm_gengrid_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Gengrid_Data
4255 } 4255 }
4256 else 4256 else
4257 { 4257 {
4258 //Just set evas focus on the gengrid itself, events will pass on and some element will be taken 4258 efl_ui_focus_object_focus_set(obj, EINA_TRUE);
4259 evas_object_focus_set(obj, EINA_TRUE);
4260 } 4259 }
4261 } 4260 }
4262} 4261}
4263 4262
4263EOLIAN static Efl_Ui_Focus_Object*
4264_elm_gengrid_efl_ui_focus_manager_manager_focus_get(const Eo *obj, Elm_Gengrid_Data *pd)
4265{
4266 Eo *focused_obj = efl_ui_focus_manager_focus_get(efl_super(obj, MY_CLASS));
4267 Eo *registered_manager = efl_ui_focus_object_focus_manager_get(obj);
4268
4269 if (!focused_obj && efl_ui_focus_manager_redirect_get(registered_manager))
4270 return (Efl_Ui_Focus_Object*) obj;
4271
4272 return focused_obj;
4273}
4274
4264static void 4275static void
4265_gengrid_element_focused(void *data, const Efl_Event *ev) 4276_gengrid_element_focused(void *data, const Efl_Event *ev)
4266{ 4277{
diff --git a/src/lib/elementary/elm_gengrid.eo b/src/lib/elementary/elm_gengrid.eo
index 33d260f8e3..55f7f5420c 100644
--- a/src/lib/elementary/elm_gengrid.eo
+++ b/src/lib/elementary/elm_gengrid.eo
@@ -528,6 +528,7 @@ class Elm.Gengrid (Efl.Ui.Layout, Efl.Ui.Focus.Composition, Elm.Interface_Scroll
528 Efl.Ui.Focus.Composition.prepare; 528 Efl.Ui.Focus.Composition.prepare;
529 Efl.Ui.Widget.focus_state_apply; 529 Efl.Ui.Widget.focus_state_apply;
530 Efl.Ui.Focus.Manager.setup_on_first_touch; 530 Efl.Ui.Focus.Manager.setup_on_first_touch;
531 Efl.Ui.Focus.Manager.manager_focus { get; }
531 } 532 }
532 events { 533 events {
533 realized: Efl.Object; [[Called when gengrid realized]] 534 realized: Efl.Object; [[Called when gengrid realized]]
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 09de6ad309..728d33376b 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -3438,11 +3438,23 @@ _elm_genlist_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Genlist_Data
3438 else 3438 else
3439 { 3439 {
3440 //Just set evas focus on the genlist itself, events will pass on and a other element will be taken 3440 //Just set evas focus on the genlist itself, events will pass on and a other element will be taken
3441 evas_object_focus_set(obj, EINA_TRUE); 3441 efl_ui_focus_object_focus_set(obj, EINA_TRUE);
3442 } 3442 }
3443 } 3443 }
3444} 3444}
3445 3445
3446EOLIAN static Efl_Ui_Focus_Object*
3447_elm_genlist_efl_ui_focus_manager_manager_focus_get(const Eo *obj, Elm_Genlist_Data *pd)
3448{
3449 Eo *focused_obj = efl_ui_focus_manager_focus_get(efl_super(obj, MY_CLASS));
3450 Eo *registered_manager = efl_ui_focus_object_focus_manager_get(obj);
3451
3452 if (!focused_obj && efl_ui_focus_manager_redirect_get(registered_manager))
3453 return (Efl_Ui_Focus_Object*) obj;
3454
3455 return focused_obj;
3456}
3457
3446EOLIAN static Eina_Bool 3458EOLIAN static Eina_Bool
3447_elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd) 3459_elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
3448{ 3460{
diff --git a/src/lib/elementary/elm_genlist.eo b/src/lib/elementary/elm_genlist.eo
index 3e8835d81e..1d7e562616 100644
--- a/src/lib/elementary/elm_genlist.eo
+++ b/src/lib/elementary/elm_genlist.eo
@@ -555,6 +555,7 @@ class Elm.Genlist (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
555 Efl.Access.Selection.access_selection_clear; 555 Efl.Access.Selection.access_selection_clear;
556 Efl.Ui.Widget.focus_state_apply; 556 Efl.Ui.Widget.focus_state_apply;
557 Efl.Ui.Focus.Manager.setup_on_first_touch; 557 Efl.Ui.Focus.Manager.setup_on_first_touch;
558 Efl.Ui.Focus.Manager.manager_focus { get; }
558 } 559 }
559 events { 560 events {
560 item,focused: Efl.Object; [[Called when genlist item got focus]] 561 item,focused: Efl.Object; [[Called when genlist item got focus]]