summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2014-08-19 06:43:53 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2014-08-19 17:48:42 -0400
commitd177714539924caf6f215ea6531aaa7e42256b12 (patch)
treed8d6605ff5f0437ee86324d0e3388a529db28b71
parent4a74d6533311ee0c3e588a90cb3af64da039f3dd (diff)
unify fading code
-rw-r--r--src/e_mod_main.c28
-rw-r--r--src/e_mod_main.h1
-rw-r--r--src/moveresize.c24
-rw-r--r--src/pip.c27
4 files changed, 37 insertions, 43 deletions
diff --git a/src/e_mod_main.c b/src/e_mod_main.c
index 6cc3006..1a7776a 100644
--- a/src/e_mod_main.c
+++ b/src/e_mod_main.c
@@ -6,6 +6,16 @@ static E_Config_DD *conf_edd = NULL;
6EINTERN Mod *mod = NULL; 6EINTERN Mod *mod = NULL;
7EINTERN Config *ds_config = NULL; 7EINTERN Config *ds_config = NULL;
8 8
9static Evas_Object *fade_obj = NULL;
10
11static void
12_ds_fade_end(Ecore_Cb cb, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *obj EINA_UNUSED)
13{
14 E_FREE_FUNC(fade_obj, evas_object_del);
15 if (cb)
16 cb(NULL);
17}
18
9static void 19static void
10_e_mod_ds_config_load(void) 20_e_mod_ds_config_load(void)
11{ 21{
@@ -105,3 +115,21 @@ e_modapi_save(E_Module *m EINA_UNUSED)
105 return 1; 115 return 1;
106} 116}
107 117
118EINTERN void
119ds_fade_setup(E_Comp *comp)
120{
121 if (fade_obj) return;
122 fade_obj = evas_object_rectangle_add(comp->evas);
123 evas_object_name_set(fade_obj, "fade_obj");
124 evas_object_geometry_set(fade_obj, 0, 0, comp->man->w, comp->man->h);
125 evas_object_layer_set(fade_obj, E_LAYER_MENU + 1);
126 evas_object_show(fade_obj);
127 efx_fade(fade_obj, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(0, 0, 0), 0, 0.0, NULL, NULL);
128 efx_fade(fade_obj, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(0, 0, 0), 192, 0.3, NULL, NULL);
129}
130
131EINTERN void
132ds_fade_end(Ecore_Cb end_cb)
133{
134 efx_fade(fade_obj, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, (Efx_End_Cb)_ds_fade_end, end_cb);
135}
diff --git a/src/e_mod_main.h b/src/e_mod_main.h
index 4bcde64..b908022 100644
--- a/src/e_mod_main.h
+++ b/src/e_mod_main.h
@@ -84,6 +84,7 @@ extern Mod *mod;
84extern Config *ds_config; 84extern Config *ds_config;
85 85
86EINTERN void ds_fade_setup(E_Comp *comp); 86EINTERN void ds_fade_setup(E_Comp *comp);
87EINTERN void ds_fade_end(Ecore_Cb cb);
87 88
88EINTERN void ds_init(void); 89EINTERN void ds_init(void);
89EINTERN void ds_shutdown(void); 90EINTERN void ds_shutdown(void);
diff --git a/src/moveresize.c b/src/moveresize.c
index 5a8e3b6..4cf88f1 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -11,7 +11,6 @@ static Evas_Object *resize_text = NULL;
11static Evas_Object *resize_rect[4] = {NULL}; 11static Evas_Object *resize_rect[4] = {NULL};
12 12
13 13
14static Evas_Object *fade_obj = NULL;
15static E_Client *client = NULL; 14static E_Client *client = NULL;
16 15
17static E_Client_Hook *ec_hooks[EC_HOOK_COUNT] = {NULL}; 16static E_Client_Hook *ec_hooks[EC_HOOK_COUNT] = {NULL};
@@ -19,7 +18,6 @@ static E_Client_Hook *ec_hooks[EC_HOOK_COUNT] = {NULL};
19static void 18static void
20clear_all(void) 19clear_all(void)
21{ 20{
22 E_FREE_FUNC(fade_obj, evas_object_del);
23 E_FREE_FUNC(mr_line_x, evas_object_del); 21 E_FREE_FUNC(mr_line_x, evas_object_del);
24 E_FREE_FUNC(mr_line_y, evas_object_del); 22 E_FREE_FUNC(mr_line_y, evas_object_del);
25 E_FREE_FUNC(move_text_x, evas_object_del); 23 E_FREE_FUNC(move_text_x, evas_object_del);
@@ -40,7 +38,7 @@ clear_all(void)
40} 38}
41 39
42static void 40static void
43fade_end(void *d EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *obj EINA_UNUSED) 41_fade_end(void *d EINA_UNUSED)
44{ 42{
45 e_comp_shape_queue_block(client->comp, 0); 43 e_comp_shape_queue_block(client->comp, 0);
46 clear_all(); 44 clear_all();
@@ -242,18 +240,6 @@ line_add(Evas *e)
242} 240}
243 241
244static void 242static void
245fade_setup(E_Client *ec)
246{
247 fade_obj = evas_object_rectangle_add(ec->comp->evas);
248 evas_object_name_set(fade_obj, "fade_obj");
249 evas_object_geometry_set(fade_obj, 0, 0, ec->comp->man->w, ec->comp->man->h);
250 evas_object_layer_set(fade_obj, E_LAYER_MENU + 1);
251 evas_object_show(fade_obj);
252 efx_fade(fade_obj, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(0, 0, 0), 0, 0.0, NULL, NULL);
253 efx_fade(fade_obj, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(0, 0, 0), 192, 0.3, NULL, NULL);
254}
255
256static void
257pulse(void *d EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *obj) 243pulse(void *d EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *obj)
258{ 244{
259 efx_queue_append(obj, EFX_EFFECT_SPEED_SINUSOIDAL, EFX_QUEUED_EFFECT(EFX_EFFECT_FADE(255, 255, 255, 255)), 0.6, NULL, NULL); 245 efx_queue_append(obj, EFX_EFFECT_SPEED_SINUSOIDAL, EFX_QUEUED_EFFECT(EFX_EFFECT_FADE(255, 255, 255, 255)), 0.6, NULL, NULL);
@@ -269,7 +255,7 @@ move_start(E_Client *ec)
269 client = ec; 255 client = ec;
270 e_comp_shape_queue_block(ec->comp, 1); 256 e_comp_shape_queue_block(ec->comp, 1);
271 257
272 fade_setup(ec); 258 ds_fade_setup(ec->comp);
273 259
274 ec->layer_block = 1; 260 ec->layer_block = 1;
275 evas_object_layer_set(ec->frame, E_LAYER_MENU + 1); 261 evas_object_layer_set(ec->frame, E_LAYER_MENU + 1);
@@ -311,7 +297,7 @@ move_end(void *d EINA_UNUSED, E_Client *ec EINA_UNUSED)
311 efx_fade(mr_line_y, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, NULL, NULL); 297 efx_fade(mr_line_y, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, NULL, NULL);
312 efx_fade(move_text_x, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, NULL, NULL); 298 efx_fade(move_text_x, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, NULL, NULL);
313 efx_fade(move_text_y, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, NULL, NULL); 299 efx_fade(move_text_y, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, NULL, NULL);
314 efx_fade(fade_obj, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, fade_end, NULL); 300 ds_fade_end(_fade_end);
315} 301}
316 302
317static void 303static void
@@ -324,7 +310,7 @@ resize_start(E_Client *ec)
324 client = ec; 310 client = ec;
325 e_comp_shape_queue_block(ec->comp, 1); 311 e_comp_shape_queue_block(ec->comp, 1);
326 312
327 fade_setup(ec); 313 ds_fade_setup(ec->comp);
328 314
329 ec->layer_block = 1; 315 ec->layer_block = 1;
330 evas_object_layer_set(ec->frame, E_LAYER_MENU + 1); 316 evas_object_layer_set(ec->frame, E_LAYER_MENU + 1);
@@ -393,7 +379,7 @@ resize_end(void *d EINA_UNUSED, E_Client *ec EINA_UNUSED)
393 efx_fade(resize_rect[x], EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, NULL, NULL); 379 efx_fade(resize_rect[x], EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, NULL, NULL);
394 efx_queue_clear(resize_rect[x]); 380 efx_queue_clear(resize_rect[x]);
395 } 381 }
396 efx_fade(fade_obj, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, fade_end, NULL); 382 ds_fade_end(_fade_end);
397} 383}
398 384
399EINTERN void 385EINTERN void
diff --git a/src/pip.c b/src/pip.c
index ac3ef5d..45d021b 100644
--- a/src/pip.c
+++ b/src/pip.c
@@ -9,8 +9,6 @@ static Ecore_Event_Handler *action_handler = NULL;
9 9
10static Eina_Bool editing = EINA_FALSE; 10static Eina_Bool editing = EINA_FALSE;
11 11
12static Evas_Object *fade_obj = NULL;
13
14typedef struct Pip 12typedef struct Pip
15{ 13{
16 Evas_Object *pip; 14 Evas_Object *pip;
@@ -21,25 +19,6 @@ typedef struct Pip
21 Eina_Bool resize : 1; 19 Eina_Bool resize : 1;
22} Pip; 20} Pip;
23 21
24
25static void
26fade_setup(E_Comp *comp)
27{
28 fade_obj = evas_object_rectangle_add(comp->evas);
29 evas_object_name_set(fade_obj, "fade_obj");
30 evas_object_geometry_set(fade_obj, 0, 0, comp->man->w, comp->man->h);
31 evas_object_layer_set(fade_obj, E_LAYER_MENU + 1);
32 evas_object_show(fade_obj);
33 efx_fade(fade_obj, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(0, 0, 0), 0, 0.0, NULL, NULL);
34 efx_fade(fade_obj, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(0, 0, 0), 192, 0.3, NULL, NULL);
35}
36
37static void
38fade_end(void *d EINA_UNUSED, Efx_Map_Data *emd EINA_UNUSED, Evas_Object *obj)
39{
40 E_FREE_FUNC(obj, evas_object_del);
41}
42
43static void 22static void
44pips_edit(void) 23pips_edit(void)
45{ 24{
@@ -50,7 +29,7 @@ pips_edit(void)
50 comp = e_comp_get(NULL); 29 comp = e_comp_get(NULL);
51 if (comp->nocomp) return; 30 if (comp->nocomp) return;
52 editing = EINA_TRUE; 31 editing = EINA_TRUE;
53 fade_setup(comp); 32 ds_fade_setup(comp);
54 it = eina_hash_iterator_data_new(pips); 33 it = eina_hash_iterator_data_new(pips);
55 EINA_ITERATOR_FOREACH(it, pip) 34 EINA_ITERATOR_FOREACH(it, pip)
56 { 35 {
@@ -68,7 +47,7 @@ pips_noedit(void)
68 Eina_Iterator *it; 47 Eina_Iterator *it;
69 48
70 editing = EINA_FALSE; 49 editing = EINA_FALSE;
71 efx_fade(fade_obj, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.3, fade_end, NULL); 50 ds_fade_end(NULL);
72 it = eina_hash_iterator_data_new(pips); 51 it = eina_hash_iterator_data_new(pips);
73 EINA_ITERATOR_FOREACH(it, pip) 52 EINA_ITERATOR_FOREACH(it, pip)
74 { 53 {
@@ -347,7 +326,7 @@ pip_shutdown(void)
347 E_FREE_FUNC(pips, eina_hash_free); 326 E_FREE_FUNC(pips, eina_hash_free);
348 E_FREE_FUNC(handlers[0], ecore_event_handler_del); 327 E_FREE_FUNC(handlers[0], ecore_event_handler_del);
349 E_FREE_FUNC(handlers[1], ecore_event_handler_del); 328 E_FREE_FUNC(handlers[1], ecore_event_handler_del);
350 E_FREE_FUNC(fade_obj, evas_object_del); 329 ds_fade_end(NULL);
351 e_action_predef_name_del(D_("Compositor"), D_("Manage Minis")); 330 e_action_predef_name_del(D_("Compositor"), D_("Manage Minis"));
352 e_action_del("pips"); 331 e_action_del("pips");
353 act = NULL; 332 act = NULL;