summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiscomfitor <michael.blumenkrantz@gmail.com>2013-10-19 15:20:28 +0100
committerdiscomfitor <michael.blumenkrantz@gmail.com>2013-10-19 15:20:28 +0100
commit131419bfbf8a1d7512af58ec3cb4e32680aad9ec (patch)
tree41ca493498a7e035009b99e7dde4496b4117f8da
parenta51b6b2c938c161cf6d52f830448b57432af9e25 (diff)
make slide split more awesome
-rw-r--r--src/desksanity.c140
1 files changed, 74 insertions, 66 deletions
diff --git a/src/desksanity.c b/src/desksanity.c
index ae181f3..d353017 100644
--- a/src/desksanity.c
+++ b/src/desksanity.c
@@ -7,20 +7,20 @@ static Evas_Object *dm_hide = NULL;
7 7
8typedef enum 8typedef enum
9{ 9{
10 DS_PAN, 10 DS_PAN, //slide desk in direction of flip
11 DS_FADE_OUT, 11 DS_FADE_OUT, //current desk fades to transparent
12 DS_FADE_IN, 12 DS_FADE_IN, //new desk fades in from transparent
13 DS_BATMAN, 13 DS_BATMAN, //adam west is calling
14 DS_ZOOM_IN, 14 DS_ZOOM_IN, //zoom in to new desk
15 DS_ZOOM_OUT, 15 DS_ZOOM_OUT, //zoom out from old desk
16 DS_GROW, 16 DS_GROW, //grow the view of the new desk based on flip direction
17 DS_ROTATE_OUT, 17 DS_ROTATE_OUT, //spiral current desk out while shrinking
18 DS_ROTATE_IN, 18 DS_ROTATE_IN, //spiral new desk in while growing
19 DS_SLIDE_SPLIT, 19 DS_SLIDE_SPLIT, //split screen in X parts and slide away based on flip direction
20 DS_QUAD_SPLIT, 20 DS_QUAD_SPLIT, //split screen into quads and move towards corners
21 DS_QUAD_MERGE, 21 DS_QUAD_MERGE, //split screen into quads and move towards center
22 DS_BLINK, 22 DS_BLINK, //like blinking your eye
23 DS_VIEWPORT, 23 DS_VIEWPORT, //current desk viewport shrinks towards 1x1 at center
24 DS_LAST, 24 DS_LAST,
25} DS_Type; 25} DS_Type;
26 26
@@ -206,64 +206,57 @@ _ds_show(E_Desk *desk, int dx, int dy)
206 break; 206 break;
207 case DS_SLIDE_SPLIT: 207 case DS_SLIDE_SPLIT:
208 { 208 {
209 Evas_Object *dm_hide2, *clip1, *clip2; 209 Evas_Object *dmh, *clip;
210 //int x, y, w, h; //clip1 210 Evas_Point exy;
211 int xx, yy, ww, hh; //clip2 211 unsigned int i, num;
212 int ex, ey, exx, eyy; //move coords
213
214 dm_hide2 = dm_add(desk_hide);
215 e_comp_object_util_del_list_append(dm_hide, dm_hide2);
216
217 clip1 = evas_object_rectangle_add(e_comp_get(desk_show)->evas);
218 x = desk_show->zone->x;
219 y = desk_show->zone->y;
220 w = desk_show->zone->w;
221 h = desk_show->zone->h;
222 if (dy)
223 w /= 2;
224 else
225 h /= 2;
226 evas_object_geometry_set(clip1, x, y, w, h);
227 e_comp_object_util_del_list_append(dm_hide, clip1);
228 evas_object_clip_set(dm_hide, clip1);
229 evas_object_show(clip1);
230
231 clip2 = evas_object_rectangle_add(e_comp_get(desk_show)->evas);
232 xx = desk_show->zone->x;
233 yy = desk_show->zone->y;
234 ww = w;
235 hh = h;
236 if (dx)
237 yy += h;
238 else
239 xx += w;
240 evas_object_geometry_set(clip2, xx, yy, ww, hh);
241 e_comp_object_util_del_list_append(dm_hide, clip2);
242 evas_object_clip_set(dm_hide2, clip2);
243 evas_object_show(clip2);
244 212
245 E_FREE_FUNC(dm_show, evas_object_del); 213 E_FREE_FUNC(dm_show, evas_object_del);
214 num = (rand() % 4) + 2;
246 215
247 if (dx) 216 dmh = dm_hide;
248 { 217 /* create other parts of split */
249 ex = desk_show->zone->x - (dx * desk_show->zone->w); 218 w = desk->zone->w;
250 exx = desk_show->zone->x + (dx * desk_show->zone->w); 219 h = desk->zone->h;
251 }
252 else
253 ex = exx = desk_show->zone->x;
254 if (dy) 220 if (dy)
221 w /= num;
222 else
223 h /= num;
224 for (i = 0; i < num; i++)
255 { 225 {
256 ey = desk_show->zone->y - (dy * desk_show->zone->h); 226 if (!dmh)
257 eyy = desk_show->zone->y + (dy * desk_show->zone->h); 227 {
228 /* create other deskmirrors where necessary */
229 dmh = dm_add(desk_hide);
230 e_comp_object_util_del_list_append(dm_hide, dmh);
231 }
232 clip = evas_object_rectangle_add(e_comp_get(desk_show)->evas);
233 e_comp_object_util_del_list_append(dm_hide, clip);
234 if (dx)
235 evas_object_geometry_set(clip, desk->zone->x, desk->zone->y + (i * h), w, h);
236 else
237 evas_object_geometry_set(clip, desk->zone->x + (i * w), desk->zone->y, w, h);
238 evas_object_clip_set(dmh, clip);
239 evas_object_show(clip);
240 exy.x = desk->zone->x;
241 exy.y = desk->zone->y;
242 if (dx)
243 {
244 if (i % 2 == 0)
245 exy.x = desk_show->zone->x - (dx * desk_show->zone->w);
246 else
247 exy.x = desk_show->zone->x + (dx * desk_show->zone->w);
248 }
249 if (dy)
250 {
251 if (i % 2 == 0)
252 exy.y = desk_show->zone->y - (dy * desk_show->zone->h);
253 else
254 exy.y = desk_show->zone->y + (dy * desk_show->zone->h);
255 }
256 efx_move(dmh, EFX_EFFECT_SPEED_ACCELERATE,
257 &exy, 0.5, (i == (num - 1)) ? _ds_end : NULL, NULL);
258 dmh = NULL;
258 } 259 }
259 else
260 ey = eyy = desk_show->zone->y;
261 efx_move(dm_hide, EFX_EFFECT_SPEED_ACCELERATE,
262 EFX_POINT(ex, ey),
263 0.5, NULL, NULL);
264 efx_move(dm_hide2, EFX_EFFECT_SPEED_ACCELERATE,
265 EFX_POINT(exx, eyy),
266 0.5, _ds_end, NULL);
267 } 260 }
268 break; 261 break;
269 case DS_QUAD_SPLIT: 262 case DS_QUAD_SPLIT:
@@ -271,11 +264,13 @@ _ds_show(E_Desk *desk, int dx, int dy)
271 int i; 264 int i;
272 Evas_Object *dmh[4] = {NULL}; 265 Evas_Object *dmh[4] = {NULL};
273 Evas_Object *clip[4]; 266 Evas_Object *clip[4];
267 /* set up quadrant position coords */
274 Evas_Point cxy[4] = {{desk->zone->x, desk->zone->y}, 268 Evas_Point cxy[4] = {{desk->zone->x, desk->zone->y},
275 {desk->zone->x + (desk->zone->w / 2), desk->zone->y}, 269 {desk->zone->x + (desk->zone->w / 2), desk->zone->y},
276 {desk->zone->x, desk->zone->y + (desk->zone->h / 2)}, 270 {desk->zone->x, desk->zone->y + (desk->zone->h / 2)},
277 {desk->zone->x + (desk->zone->w / 2), desk->zone->y + (desk->zone->h / 2)} 271 {desk->zone->x + (desk->zone->w / 2), desk->zone->y + (desk->zone->h / 2)}
278 }; 272 };
273 /* set up quadrant effect coords */
279 Evas_Point exy[4] = {{desk->zone->x - desk->zone->w, desk->zone->y - desk->zone->h}, 274 Evas_Point exy[4] = {{desk->zone->x - desk->zone->w, desk->zone->y - desk->zone->h},
280 {desk->zone->x + (desk->zone->w * 2), desk->zone->y - desk->zone->h}, 275 {desk->zone->x + (desk->zone->w * 2), desk->zone->y - desk->zone->h},
281 {desk->zone->x - desk->zone->w, desk->zone->y + (desk->zone->h / 2)}, 276 {desk->zone->x - desk->zone->w, desk->zone->y + (desk->zone->h / 2)},
@@ -288,14 +283,18 @@ _ds_show(E_Desk *desk, int dx, int dy)
288 { 283 {
289 if (!dmh[i]) 284 if (!dmh[i])
290 { 285 {
286 /* create other 3 quadrants */
291 dmh[i] = dm_add(desk_hide); 287 dmh[i] = dm_add(desk_hide);
292 e_comp_object_util_del_list_append(dm_hide, dmh[i]); 288 e_comp_object_util_del_list_append(dm_hide, dmh[i]);
293 } 289 }
290 /* clip the quad */
294 clip[i] = evas_object_rectangle_add(e_comp_get(desk)->evas); 291 clip[i] = evas_object_rectangle_add(e_comp_get(desk)->evas);
295 e_comp_object_util_del_list_append(dm_hide, clip[i]); 292 e_comp_object_util_del_list_append(dm_hide, clip[i]);
293 /* lay out 2x2 grid */
296 evas_object_geometry_set(clip[i], cxy[i].x, cxy[i].y, desk->zone->w / 2, desk->zone->h / 2); 294 evas_object_geometry_set(clip[i], cxy[i].x, cxy[i].y, desk->zone->w / 2, desk->zone->h / 2);
297 evas_object_clip_set(dmh[i], clip[i]); 295 evas_object_clip_set(dmh[i], clip[i]);
298 evas_object_show(clip[i]); 296 evas_object_show(clip[i]);
297 /* apply effect coords */
299 efx_move(clip[i], EFX_EFFECT_SPEED_ACCELERATE, 298 efx_move(clip[i], EFX_EFFECT_SPEED_ACCELERATE,
300 &exy[i], 0.8, (i == 3) ? _ds_end : NULL, NULL); 299 &exy[i], 0.8, (i == 3) ? _ds_end : NULL, NULL);
301 } 300 }
@@ -306,6 +305,7 @@ _ds_show(E_Desk *desk, int dx, int dy)
306 int i; 305 int i;
307 Evas_Object *dmh[4] = {NULL}; 306 Evas_Object *dmh[4] = {NULL};
308 Evas_Object *clip[4]; 307 Evas_Object *clip[4];
308 /* set up quadrant position coords */
309 Evas_Point cxy[4] = {{desk->zone->x, desk->zone->y}, 309 Evas_Point cxy[4] = {{desk->zone->x, desk->zone->y},
310 {desk->zone->x + (desk->zone->w / 2), desk->zone->y}, 310 {desk->zone->x + (desk->zone->w / 2), desk->zone->y},
311 {desk->zone->x, desk->zone->y + (desk->zone->h / 2)}, 311 {desk->zone->x, desk->zone->y + (desk->zone->h / 2)},
@@ -318,14 +318,18 @@ _ds_show(E_Desk *desk, int dx, int dy)
318 { 318 {
319 if (!dmh[i]) 319 if (!dmh[i])
320 { 320 {
321 /* create other 3 quadrants */
321 dmh[i] = dm_add(desk_hide); 322 dmh[i] = dm_add(desk_hide);
322 e_comp_object_util_del_list_append(dm_hide, dmh[i]); 323 e_comp_object_util_del_list_append(dm_hide, dmh[i]);
323 } 324 }
325 /* clip the quad */
324 clip[i] = evas_object_rectangle_add(e_comp_get(desk)->evas); 326 clip[i] = evas_object_rectangle_add(e_comp_get(desk)->evas);
325 e_comp_object_util_del_list_append(dm_hide, clip[i]); 327 e_comp_object_util_del_list_append(dm_hide, clip[i]);
328 /* lay out 2x2 grid */
326 evas_object_geometry_set(clip[i], cxy[i].x, cxy[i].y, desk->zone->w / 2, desk->zone->h / 2); 329 evas_object_geometry_set(clip[i], cxy[i].x, cxy[i].y, desk->zone->w / 2, desk->zone->h / 2);
327 evas_object_clip_set(dmh[i], clip[i]); 330 evas_object_clip_set(dmh[i], clip[i]);
328 evas_object_show(clip[i]); 331 evas_object_show(clip[i]);
332 /* resize all quads to 1x1 while moving towards center */
329 efx_resize(clip[i], EFX_EFFECT_SPEED_ACCELERATE, 333 efx_resize(clip[i], EFX_EFFECT_SPEED_ACCELERATE,
330 EFX_POINT(desk->zone->x + (desk->zone->w / 2), desk->zone->y + (desk->zone->h / 2)), 334 EFX_POINT(desk->zone->x + (desk->zone->w / 2), desk->zone->y + (desk->zone->h / 2)),
331 1, 1 ,0.8, (i == 3) ? _ds_end : NULL, NULL); 335 1, 1 ,0.8, (i == 3) ? _ds_end : NULL, NULL);
@@ -338,10 +342,12 @@ _ds_show(E_Desk *desk, int dx, int dy)
338 342
339 E_FREE_FUNC(dm_show, evas_object_del); 343 E_FREE_FUNC(dm_show, evas_object_del);
340 clip = evas_object_rectangle_add(e_comp_get(desk)->evas); 344 clip = evas_object_rectangle_add(e_comp_get(desk)->evas);
345 /* fit clipper to zone */
341 evas_object_geometry_set(clip, desk->zone->x, desk->zone->y, desk->zone->w, desk->zone->h); 346 evas_object_geometry_set(clip, desk->zone->x, desk->zone->y, desk->zone->w, desk->zone->h);
342 evas_object_clip_set(dm_hide, clip); 347 evas_object_clip_set(dm_hide, clip);
343 e_comp_object_util_del_list_append(dm_hide, clip); 348 e_comp_object_util_del_list_append(dm_hide, clip);
344 evas_object_show(clip); 349 evas_object_show(clip);
350 /* resize clip to 1px high while moving towards center */
345 efx_resize(clip, EFX_EFFECT_SPEED_DECELERATE, 351 efx_resize(clip, EFX_EFFECT_SPEED_DECELERATE,
346 EFX_POINT(desk->zone->x, desk->zone->y + (desk->zone->h / 2)), 352 EFX_POINT(desk->zone->x, desk->zone->y + (desk->zone->h / 2)),
347 desk->zone->w, 1, 0.45, _ds_end, NULL); 353 desk->zone->w, 1, 0.45, _ds_end, NULL);
@@ -352,10 +358,12 @@ _ds_show(E_Desk *desk, int dx, int dy)
352 358
353 E_FREE_FUNC(dm_show, evas_object_del); 359 E_FREE_FUNC(dm_show, evas_object_del);
354 clip = evas_object_rectangle_add(e_comp_get(desk)->evas); 360 clip = evas_object_rectangle_add(e_comp_get(desk)->evas);
361 /* fit clipper to zone */
355 evas_object_geometry_set(clip, desk->zone->x, desk->zone->y, desk->zone->w, desk->zone->h); 362 evas_object_geometry_set(clip, desk->zone->x, desk->zone->y, desk->zone->w, desk->zone->h);
356 evas_object_clip_set(dm_hide, clip); 363 evas_object_clip_set(dm_hide, clip);
357 e_comp_object_util_del_list_append(dm_hide, clip); 364 e_comp_object_util_del_list_append(dm_hide, clip);
358 evas_object_show(clip); 365 evas_object_show(clip);
366 /* resize clip to 1x1 while moving towards center */
359 efx_resize(clip, EFX_EFFECT_SPEED_DECELERATE, 367 efx_resize(clip, EFX_EFFECT_SPEED_DECELERATE,
360 EFX_POINT(desk->zone->x + (desk->zone->w / 2), desk->zone->y + (desk->zone->h / 2)), 368 EFX_POINT(desk->zone->x + (desk->zone->w / 2), desk->zone->y + (desk->zone->h / 2)),
361 1, 1, 0.6, _ds_end, NULL); 369 1, 1, 0.6, _ds_end, NULL);