summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-03-11 18:17:06 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-03-11 18:20:59 -0500
commit7fcf66ce566490250c7c06cba4ee95994b229637 (patch)
tree4f962e4473cb87e514fa6d038259303d86f746b3
parent17dc3719326c1100a746e21270e34bc4cd57807d (diff)
be less pedantic during efx move/resize operations about object geometry
assume that an object is where it's supposed to be in order to avoid failing to correctly animate objects which modify set geometries, such as e clients
-rw-r--r--src/lib/efx_move.c28
-rw-r--r--src/lib/efx_private.h1
-rw-r--r--src/lib/efx_resize.c17
3 files changed, 32 insertions, 14 deletions
diff --git a/src/lib/efx_move.c b/src/lib/efx_move.c
index 650ac2b..76c7086 100644
--- a/src/lib/efx_move.c
+++ b/src/lib/efx_move.c
@@ -23,13 +23,11 @@ _obj_del(Efx_Move_Data *emd, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, vo
23} 23}
24 24
25static void 25static void
26_move(Evas_Object *obj, int x, int y) 26_move(EFX *e, int x, int y)
27{ 27{
28 Evas_Coord ox, oy; 28 e->x += x, e->y += y;
29 29 evas_object_move(e->obj, e->x + x, e->y + y);
30 evas_object_geometry_get(obj, &ox, &oy, NULL, NULL); 30 //DBG("%p to (%d,%d)", e->obj, e->x + x, e->y + y);
31 evas_object_move(obj, ox + x, oy + y);
32 //DBG("%p to (%d,%d)", obj, ox + x, oy + y);
33} 31}
34 32
35static Eina_Bool 33static Eina_Bool
@@ -44,7 +42,11 @@ _move_circle_cb(Efx_Move_Data *emd, double pos)
44 42
45 pct = ecore_animator_pos_map(pos, emd->speed, 0, 0); 43 pct = ecore_animator_pos_map(pos, emd->speed, 0, 0);
46 degrees = pct * emd->degrees; 44 degrees = pct * emd->degrees;
47 evas_object_geometry_get(emd->e->obj, &ox, &oy, &w, &h); 45 ox = emd->e->x, oy = emd->e->y;
46 if (emd->e->resize_data)
47 w = emd->e->w, h = emd->e->h;
48 else
49 evas_object_geometry_get(emd->e->obj, NULL, NULL, &w, &h);
48 r = (degrees * M_PI) / 180.0; 50 r = (degrees * M_PI) / 180.0;
49 rad = sqrt((emd->current.x + w/2.0 - emd->e->map_data.move_center->x) * (emd->current.x + w/2.0 - emd->e->map_data.move_center->x) + 51 rad = sqrt((emd->current.x + w/2.0 - emd->e->map_data.move_center->x) * (emd->current.x + w/2.0 - emd->e->map_data.move_center->x) +
50 (emd->current.y + h/2.0 - emd->e->map_data.move_center->y) * (emd->current.y + h/2.0 - emd->e->map_data.move_center->y)); 52 (emd->current.y + h/2.0 - emd->e->map_data.move_center->y) * (emd->current.y + h/2.0 - emd->e->map_data.move_center->y));
@@ -55,11 +57,12 @@ _move_circle_cb(Efx_Move_Data *emd, double pos)
55 xx = lround(x); 57 xx = lround(x);
56 yy = lround(y); 58 yy = lround(y);
57 //DBG("move: %g || %g,%g", degrees, x, y); 59 //DBG("move: %g || %g,%g", degrees, x, y);
60 emd->e->x = xx, emd->e->y = yy;
58 evas_object_move(emd->e->obj, xx, yy); 61 evas_object_move(emd->e->obj, xx, yy);
59 efx_maps_apply(emd->e, emd->e->obj, NULL, EFX_MAPS_APPLY_ALL); 62 efx_maps_apply(emd->e, emd->e->obj, NULL, EFX_MAPS_APPLY_ALL);
60 EINA_LIST_FOREACH(emd->e->followers, l, e) 63 EINA_LIST_FOREACH(emd->e->followers, l, e)
61 { 64 {
62 _move(e->obj, xx - ox, yy - oy); 65 _move(e, xx - ox, yy - oy);
63 efx_maps_apply(e, e->obj, NULL, EFX_MAPS_APPLY_ALL); 66 efx_maps_apply(e, e->obj, NULL, EFX_MAPS_APPLY_ALL);
64 } 67 }
65 68
@@ -81,11 +84,11 @@ _move_cb(Efx_Move_Data *emd, double pos)
81 x = lround(pct * (double)emd->change.x) - emd->current.x; 84 x = lround(pct * (double)emd->change.x) - emd->current.x;
82 y = lround(pct * (double)emd->change.y) - emd->current.y; 85 y = lround(pct * (double)emd->change.y) - emd->current.y;
83 _efx_resize_adjust(emd->e, &x, &y); 86 _efx_resize_adjust(emd->e, &x, &y);
84 _move(emd->e->obj, x, y); 87 _move(emd->e, x, y);
85 efx_maps_apply(emd->e, emd->e->obj, NULL, EFX_MAPS_APPLY_ALL); 88 efx_maps_apply(emd->e, emd->e->obj, NULL, EFX_MAPS_APPLY_ALL);
86 EINA_LIST_FOREACH(emd->e->followers, l, e) 89 EINA_LIST_FOREACH(emd->e->followers, l, e)
87 { 90 {
88 _move(e->obj, x, y); 91 _move(e, x, y);
89 efx_maps_apply(e, e->obj, NULL, EFX_MAPS_APPLY_ALL); 92 efx_maps_apply(e, e->obj, NULL, EFX_MAPS_APPLY_ALL);
90 } 93 }
91 94
@@ -157,6 +160,7 @@ efx_move(Evas_Object *obj, Efx_Effect_Speed speed, const Evas_Point *end_point,
157 emd = e->move_data; 160 emd = e->move_data;
158 emd->e = e; 161 emd->e = e;
159 emd->speed = speed; 162 emd->speed = speed;
163 e->x = x, e->y = y;
160 emd->change.x = end_point->x - x; 164 emd->change.x = end_point->x - x;
161 emd->change.y = end_point->y - y; 165 emd->change.y = end_point->y - y;
162 emd->current.x = emd->current.y = 0; 166 emd->current.x = emd->current.y = 0;
@@ -202,8 +206,8 @@ efx_move_circle(Evas_Object *obj, Efx_Effect_Speed speed, const Evas_Point *cent
202 emd = e->move_data; 206 emd = e->move_data;
203 emd->e = e; 207 emd->e = e;
204 emd->speed = speed; 208 emd->speed = speed;
205 emd->start.x = emd->current.x = x; 209 e->x = emd->start.x = emd->current.x = x;
206 emd->start.y = emd->current.y = y; 210 e->y = emd->start.y = emd->current.y = y;
207 emd->degrees = degrees; 211 emd->degrees = degrees;
208 emd->cb = cb; 212 emd->cb = cb;
209 emd->data = (void*)data; 213 emd->data = (void*)data;
diff --git a/src/lib/efx_private.h b/src/lib/efx_private.h
index 0c89a6f..6f6c124 100644
--- a/src/lib/efx_private.h
+++ b/src/lib/efx_private.h
@@ -71,6 +71,7 @@ struct EFX
71 Efx_Map_Data map_data; 71 Efx_Map_Data map_data;
72 Eina_List *followers; 72 Eina_List *followers;
73 Eina_List *queue; 73 Eina_List *queue;
74 int x, y, w, h;
74}; 75};
75 76
76void _efx_zoom_calc(void *, void *, Evas_Object *obj, Evas_Map *map); 77void _efx_zoom_calc(void *, void *, Evas_Object *obj, Evas_Map *map);
diff --git a/src/lib/efx_resize.c b/src/lib/efx_resize.c
index 1f92489..d489901 100644
--- a/src/lib/efx_resize.c
+++ b/src/lib/efx_resize.c
@@ -44,7 +44,10 @@ _resize_anchor(Efx_Resize_Data *erd)
44 _efx_resize_adjust(erd->e, &x, &y); 44 _efx_resize_adjust(erd->e, &x, &y);
45 if ((!x) && (!y)) return; 45 if ((!x) && (!y)) return;
46 46
47 evas_object_geometry_get(erd->e->obj, &cx, &cy, NULL, NULL); 47 if (erd->e->move_data)
48 cx = erd->e->x, cy = erd->e->y;
49 else
50 evas_object_geometry_get(erd->e->obj, &cx, &cy, NULL, NULL);
48 x += cx, y += cy; 51 x += cx, y += cy;
49 evas_object_move(erd->e->obj, x, y); 52 evas_object_move(erd->e->obj, x, y);
50} 53}
@@ -61,11 +64,14 @@ _resize_cb(Efx_Resize_Data *erd, double pos)
61 factor = ecore_animator_pos_map(pos, erd->speed, 0, 0); 64 factor = ecore_animator_pos_map(pos, erd->speed, 0, 0);
62 w = lround(factor * (erd->w - erd->start_w)) + erd->start_w; 65 w = lround(factor * (erd->w - erd->start_w)) + erd->start_w;
63 h = lround(factor * (erd->h - erd->start_h)) + erd->start_h; 66 h = lround(factor * (erd->h - erd->start_h)) + erd->start_h;
67 //DBG("%p to (%dx%d)", erd->e->obj, w, h);
68 erd->e->w = w, erd->e->h = h;
64 evas_object_resize(erd->e->obj, w, h); 69 evas_object_resize(erd->e->obj, w, h);
65 _resize_anchor(erd); 70 _resize_anchor(erd);
66 return EINA_TRUE; 71 return EINA_TRUE;
67 } 72 }
68 /* lround will usually be off by 1 at the end, so we manually set this here */ 73 /* lround will usually be off by 1 at the end, so we manually set this here */
74 erd->e->w = erd->w, erd->e->h = erd->h;
69 evas_object_resize(erd->e->obj, erd->w, erd->h); 75 evas_object_resize(erd->e->obj, erd->w, erd->h);
70 _resize_anchor(erd); 76 _resize_anchor(erd);
71 77
@@ -85,6 +91,7 @@ _resize_stop(Evas_Object *obj, Eina_Bool reset)
85 erd = e->resize_data; 91 erd = e->resize_data;
86 if (reset) 92 if (reset)
87 { 93 {
94 erd->e->w = erd->start_w, erd->e->h = erd->start_h;
88 evas_object_resize(obj, erd->start_w, erd->start_h); 95 evas_object_resize(obj, erd->start_w, erd->start_h);
89 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_FREE, (Evas_Object_Event_Cb)_obj_del, erd); 96 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_FREE, (Evas_Object_Event_Cb)_obj_del, erd);
90 if (erd->moving) 97 if (erd->moving)
@@ -118,7 +125,9 @@ _efx_resize_adjust(EFX *e, int *ax, int *ay)
118 int x, y, w, h; 125 int x, y, w, h;
119 126
120 if (!erd) return; 127 if (!erd) return;
121 evas_object_geometry_get(e->obj, &x, &y, &w, &h); 128 if (e->move_data)
129 x = e->x, y = e->y;
130 w = e->w, h = e->h;
122 switch (erd->anchor_type) 131 switch (erd->anchor_type)
123 { 132 {
124 case TOP_RIGHT: 133 case TOP_RIGHT:
@@ -165,6 +174,10 @@ efx_resize(Evas_Object *obj, Efx_Effect_Speed speed, const Evas_Point *position,
165 erd->cb = cb; 174 erd->cb = cb;
166 erd->data = (void*)data; 175 erd->data = (void*)data;
167 evas_object_geometry_get(obj, &x, &y, &erd->start_w, &erd->start_h); 176 evas_object_geometry_get(obj, &x, &y, &erd->start_w, &erd->start_h);
177 e->w = erd->start_w;
178 e->h = erd->start_h;
179 if (e->move_data)
180 x = e->x, y = e->y;
168 INF("resize: %p || %dx%d => %dx%d %s over %gs", obj, erd->start_w, erd->start_h, w, h, efx_speed_str[speed], total_time); 181 INF("resize: %p || %dx%d => %dx%d %s over %gs", obj, erd->start_w, erd->start_h, w, h, efx_speed_str[speed], total_time);
169 if (position && ((position->x != x) || (position->y != y))) 182 if (position && ((position->x != x) || (position->y != y)))
170 { 183 {