efl_ui/pan: add position info to pan,content_position,changed event
authorMike Blumenkrantz <zmike@samsung.com>
Fri, 30 Aug 2019 18:48:04 +0000 (14:48 -0400)
committerYeongjong Lee <yj34.lee@samsung.com>
Mon, 16 Sep 2019 01:23:00 +0000 (10:23 +0900)
Summary:
changed events should always send the related data when possible

ref T7708
Depends on D9789

Reviewers: segfaultxavi

Reviewed By: segfaultxavi

Subscribers: segfaultxavi, cedric, #reviewers, #committers

Tags: #efl_widgets

Maniphest Tasks: T7708

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

src/lib/elementary/efl_ui_collection.c
src/lib/elementary/efl_ui_image_zoomable.c
src/lib/elementary/efl_ui_list_view.c
src/lib/elementary/efl_ui_pan.c
src/lib/elementary/efl_ui_pan.eo

index 4f233f0..160bbcd 100644 (file)
@@ -198,17 +198,17 @@ _pan_viewport_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
 }
 
 static void
-_pan_position_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+_pan_position_changed_cb(void *data, const Efl_Event *ev)
 {
    MY_DATA_GET(data, pd);
-   Eina_Position2D pos = efl_ui_pan_position_get(pd->pan);
+   Eina_Position2D *pos = ev->info;
    Eina_Position2D max = efl_ui_pan_position_max_get(pd->pan);
    Eina_Vector2 rpos = {0.0, 0.0};
 
    if (max.x > 0.0)
-     rpos.x = (double)pos.x/(double)max.x;
+     rpos.x = (double)pos->x/(double)max.x;
    if (max.y > 0.0)
-     rpos.y = (double)pos.y/(double)max.y;
+     rpos.y = (double)pos->y/(double)max.y;
 
    efl_ui_position_manager_entity_scroll_position_set(pd->pos_man, rpos.x, rpos.y);
 }
index e2f5180..5452014 100644 (file)
@@ -412,7 +412,7 @@ _efl_ui_image_zoomable_pan_efl_ui_pan_pan_position_set(Eo *obj, Efl_Ui_Image_Zoo
    psd->wsd->pan_y = pos.y;
    evas_object_smart_changed(obj);
 
-   efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, NULL);
+   efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, &pos);
 }
 
 EOLIAN static Eina_Position2D
index dd5743a..de8367b 100644 (file)
@@ -59,7 +59,7 @@ _efl_ui_list_view_pan_efl_ui_pan_pan_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Li
    psd->gmt.x = pos.x;
    psd->gmt.y = pos.y;
 
-   efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, NULL);
+   efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, &pos);
    evas_object_smart_changed(psd->wobj);
 }
 
index 2221107..93a234b 100644 (file)
@@ -69,7 +69,7 @@ _efl_ui_pan_pan_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Pan_Data *psd, Eina_Pos
    psd->py = pos.y;
 
    evas_object_smart_changed(obj);
-   efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, NULL);
+   efl_event_callback_call(obj, EFL_UI_PAN_EVENT_PAN_CONTENT_POSITION_CHANGED, &pos);
 }
 
 EOLIAN static Eina_Position2D
index e9edd8f..7e8e435 100644 (file)
@@ -65,7 +65,7 @@ class @beta Efl.Ui.Pan extends Efl.Canvas.Group implements Efl.Content
    }
    events {
       pan,viewport,changed: void; [[This widget's position or size has changed.]]
-      pan,content_position,changed: void; [[The content's position has changed.]]
+      pan,content_position,changed: Eina.Position2D; [[The content's position has changed, its position in the event is the new position.]]
       pan,content_size,changed: Eina.Size2D; [[The content's size has changed, its size in the event is the new size]]
    }
 }