summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2017-10-19 14:02:11 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2017-10-19 15:20:59 +0200
commit3184e0f550ac1dc7a0a247cd38df4692bf82c82d (patch)
tree5400a07ce46c0f681ed29d2c92e63bb75ee8ddbd
parentf720115f082f32960baf6c01a517eaa398f3ef4d (diff)
elm_interface_scrollable: do not scroll to a focused element by default
this can be done in the implementing other widgets
-rw-r--r--src/lib/elementary/elm_interface_scrollable.c48
-rw-r--r--src/lib/elementary/elm_interface_scrollable.eo1
2 files changed, 1 insertions, 48 deletions
diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c
index 11984c7abb..77f480f174 100644
--- a/src/lib/elementary/elm_interface_scrollable.c
+++ b/src/lib/elementary/elm_interface_scrollable.c
@@ -4657,29 +4657,6 @@ _elm_interface_scrollable_class_constructor(Efl_Class *klass)
4657EAPI void elm_pan_gravity_set(Elm_Pan *obj EINA_UNUSED, double x EINA_UNUSED, double y EINA_UNUSED) {} 4657EAPI void elm_pan_gravity_set(Elm_Pan *obj EINA_UNUSED, double x EINA_UNUSED, double y EINA_UNUSED) {}
4658EAPI void elm_pan_gravity_get(const Elm_Pan *obj EINA_UNUSED, double *x EINA_UNUSED, double *y EINA_UNUSED) {} 4658EAPI void elm_pan_gravity_get(const Elm_Pan *obj EINA_UNUSED, double *x EINA_UNUSED, double *y EINA_UNUSED) {}
4659 4659
4660static void
4661_focused_element(void *data, const Efl_Event *event)
4662{
4663 Eina_Rect geom;
4664 Efl_Ui_Focus_Object *obj = data;
4665 Efl_Ui_Focus_Object *focus = event->info;
4666 Elm_Scrollable_Smart_Interface_Data *pd;
4667 Eina_Position2D pos;
4668 int pan_x, pan_y;
4669
4670 pd = efl_data_scope_get(obj, MY_SCROLLABLE_INTERFACE);
4671
4672 if (!focus) return;
4673
4674 geom = efl_ui_focus_object_focus_geometry_get(focus);
4675 pos = efl_gfx_position_get(obj);
4676 elm_obj_pan_pos_get(pd->pan_obj, &pan_x, &pan_y);
4677 geom.x = geom.x + pan_x - pos.x;
4678 geom.y = geom.y + pan_y - pos.y;
4679
4680 elm_interface_scrollable_region_bring_in(obj, geom.x, geom.y, geom.w, geom.h);
4681}
4682
4683EOLIAN static Efl_Ui_Focus_Manager* 4660EOLIAN static Efl_Ui_Focus_Manager*
4684_elm_interface_scrollable_elm_widget_focus_manager_create(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *root) 4661_elm_interface_scrollable_elm_widget_focus_manager_create(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *root)
4685{ 4662{
@@ -4699,7 +4676,7 @@ _elm_interface_scrollable_efl_object_constructor(Eo *obj, Elm_Scrollable_Smart_I
4699 4676
4700 efl_composite_attach(obj, pd->manager); 4677 efl_composite_attach(obj, pd->manager);
4701 4678
4702 efl_event_callback_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, _focused_element, obj); 4679 _efl_ui_focus_manager_redirect_events_add(pd->manager, obj);
4703 4680
4704 return efl_constructor(efl_super(obj, MY_SCROLLABLE_INTERFACE)); 4681 return efl_constructor(efl_super(obj, MY_SCROLLABLE_INTERFACE));
4705} 4682}
@@ -4727,29 +4704,6 @@ _elm_interface_scrollable_efl_ui_focus_manager_border_elements_get(Eo *obj, Elm_
4727} 4704}
4728 4705
4729EOLIAN static void 4706EOLIAN static void
4730_elm_interface_scrollable_efl_ui_focus_manager_focus_set(Eo *obj, Elm_Scrollable_Smart_Interface_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *focus)
4731{
4732 Eina_Rect geom;
4733 Eina_Position2D pos;
4734 int pan_x, pan_y;
4735
4736 EINA_SAFETY_ON_NULL_RETURN(focus);
4737 efl_ui_focus_manager_focus_set(efl_super(obj, MY_SCROLLABLE_INTERFACE), focus);
4738
4739 geom = efl_ui_focus_object_focus_geometry_get(focus);
4740 pos = efl_gfx_position_get(obj);
4741 elm_obj_pan_pos_get(pd->pan_obj, &pan_x, &pan_y);
4742 geom.x = geom.x + pan_x - pos.x;
4743 geom.y = geom.y + pan_y - pos.y;
4744
4745 elm_interface_scrollable_region_bring_in(obj, geom.x, geom.y, geom.w, geom.h);
4746
4747 geom = efl_gfx_geometry_get(obj);
4748 geom.x = geom.y = 0;
4749 elm_widget_show_region_set(obj, geom, EINA_TRUE);
4750}
4751
4752EOLIAN static void
4753_elm_interface_scrollable_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *pd EINA_UNUSED, Eina_Bool enable EINA_UNUSED) 4707_elm_interface_scrollable_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_Interface_Data *pd EINA_UNUSED, Eina_Bool enable EINA_UNUSED)
4754{ 4708{
4755} 4709}
diff --git a/src/lib/elementary/elm_interface_scrollable.eo b/src/lib/elementary/elm_interface_scrollable.eo
index d3381e01fb..6db254567a 100644
--- a/src/lib/elementary/elm_interface_scrollable.eo
+++ b/src/lib/elementary/elm_interface_scrollable.eo
@@ -669,7 +669,6 @@ mixin Elm.Interface_Scrollable(Efl.Ui.Scrollable, Efl.Ui.Focus.Manager.Sub, Elm.
669 class.constructor; 669 class.constructor;
670 Efl.Object.constructor; 670 Efl.Object.constructor;
671 Efl.Ui.Focus.Manager.border_elements { get; } 671 Efl.Ui.Focus.Manager.border_elements { get; }
672 Efl.Ui.Focus.Manager.focus {set; }
673 Elm.Widget.focus_manager_create; 672 Elm.Widget.focus_manager_create;
674 } 673 }
675 events { 674 events {