From 472f87ff96748bd2c5d21386d80b1f74c68e7875 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 30 Jun 2005 14:07:28 +0000 Subject: [PATCH] ok - desktop changes are done by edje transitions now i hereby invoke the power of edje on ye desktop wallpapers. SVN revision: 15585 --- data/themes/Makefile.am | 3 +- data/themes/default.edc | 1 + data/themes/default_transitions.edc | 189 ++++++++++++++++++ data/themes/images/Makefile.am | 4 +- .../images/e17_transition_vswipe_gap.png | Bin 0 -> 230 bytes src/bin/e_bg.c | 116 ++++------- src/bin/e_bg.h | 7 - src/bin/e_config.c | 24 +-- src/bin/e_config.h | 11 +- src/bin/e_zone.c | 3 +- src/bin/e_zone.h | 5 +- 11 files changed, 252 insertions(+), 111 deletions(-) create mode 100644 data/themes/default_transitions.edc create mode 100644 data/themes/images/e17_transition_vswipe_gap.png diff --git a/data/themes/Makefile.am b/data/themes/Makefile.am index 1b284823f..291aa6b5c 100644 --- a/data/themes/Makefile.am +++ b/data/themes/Makefile.am @@ -29,7 +29,8 @@ default_error.edc \ default_cpufreq.edc \ default_ibox.edc \ default_start.edc \ -default_winlist.edc +default_winlist.edc \ +default_transitions.edc default.edj: Makefile $(EXTRA_DIST) $(EDJE_CC) $(EDJE_FLAGS) \ diff --git a/data/themes/default.edc b/data/themes/default.edc index c7904b76a..82d849cb3 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -38,5 +38,6 @@ collections { #include "default_ibox.edc" #include "default_start.edc" #include "default_winlist.edc" +#include "default_transitions.edc" } diff --git a/data/themes/default_transitions.edc b/data/themes/default_transitions.edc new file mode 100644 index 000000000..45e79db33 --- /dev/null +++ b/data/themes/default_transitions.edc @@ -0,0 +1,189 @@ +images { + image: "e17_transition_vswipe_gap.png" COMP; +} + +group { + name: "transitions/crossfade"; + parts { + part { + name: "bg_prev"; + type: SWALLOW; + mouse_events: 0; + description { + state: "default" 0.0; + } + } + part { + name: "bg_new"; + type: SWALLOW; + clip_to: "bg_new_clip"; + mouse_events: 0; + description { + state: "default" 0.0; + } + } + part { + name: "bg_new_clip"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "done" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + } + } + programs { + program { + name: "go"; + signal: "go"; + source: ""; + action: STATE_SET "done" 0.0; + transition: SINUSOIDAL 1.0; + target: "bg_new_clip"; + after: "go2"; + } + program { + name: "go2"; + action: SIGNAL_EMIT "done" ""; + } + } +} + +group { + name: "transitions/vswipe"; + parts { + part { + name: "bg_prev"; + type: SWALLOW; + clip_to: "bg_prev_clip"; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + } + } + } + part { + name: "bg_new"; + type: SWALLOW; + clip_to: "bg_new_clip"; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + } + } + } + part { + name: "bg_prev_clip"; + type: RECT; + mouse_events: 0; + description { + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + } + state: "default" 0.0; + } + description { + state: "done" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 1.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + } + } + } + part { + name: "swipe_gap"; + mouse_events: 0; + description { + state: "default" 0.0; + min: 0 64; + max: 99999 64; + rel1 { + to: "bg_prev_clip"; + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + to: "bg_prev_clip"; + relative: 1.0 0.0; + offset: -1 0; + } + image { + normal: "e17_transition_vswipe_gap.png"; + } + } + } + part { + name: "bg_new_clip"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + relative: 1.0 0.0; + offset: -1 -1; + } + } + description { + state: "done" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + } + } + } + } + programs { + program { + name: "go"; + signal: "go"; + source: ""; + action: STATE_SET "done" 0.0; + transition: SINUSOIDAL 1.0; + target: "bg_new_clip"; + target: "bg_prev_clip"; + after: "go2"; + } + program { + name: "go2"; + action: SIGNAL_EMIT "done" ""; + } + } +} diff --git a/data/themes/images/Makefile.am b/data/themes/images/Makefile.am index 446ae7c87..b4f81b782 100644 --- a/data/themes/images/Makefile.am +++ b/data/themes/images/Makefile.am @@ -276,4 +276,6 @@ e17_cpufreq_cpu1.png \ e17_cpufreq_cpu2.png \ e17_winlist_top.png \ e17_winlist_bottom.png \ -e17_pager_window_shaded.png +e17_pager_window_shaded.png \ +e17_transition_vswipe_gap.png + diff --git a/data/themes/images/e17_transition_vswipe_gap.png b/data/themes/images/e17_transition_vswipe_gap.png new file mode 100644 index 0000000000000000000000000000000000000000..cdb0df816629bbbb6ec40e7c8b15a4066d4e1ec1 GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^j6m$b!3HF63(7hGDYhhUcNd2LAh=-f^2tCE&H|6f zVg?3oVGw3ym^DWND9B#o>FdgVl}(P8_`iF1B#Zfaf$gL6@8Vo7R> zLV0FMhC)b2s)Ds6tCsv*sDSGP(<$HM;%mDS&Bgumk9~9dEhQ?mR;zUP T%eRg|QyDy6{an^LB{Ts5`_xES literal 0 HcmV?d00001 diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c index c849a59ed..5ed8c9ea8 100644 --- a/src/bin/e_bg.c +++ b/src/bin/e_bg.c @@ -4,7 +4,7 @@ #include "e.h" /* local subsystem functions */ -static int _e_bg_animator(void *data); +static void _e_bg_signal(void *data, Evas_Object *obj, const char *emission, const char *source); /* local subsystem globals */ @@ -15,35 +15,13 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition) Evas_Object *o; Evas_List *l; int ok; - - if (transition == E_BG_TRANSITION_START) - { - zone->bg_transition_mode = e_config->desktop_bg_start_transition; - zone->bg_transition_time = e_config->desktop_bg_start_transition_time; - } - else if (transition == E_BG_TRANSITION_DESK) - { - zone->bg_transition_mode = e_config->desktop_bg_desk_transition; - zone->bg_transition_time = e_config->desktop_bg_desk_transition_time; - } - else if (transition == E_BG_TRANSITION_CHANGE) - { - zone->bg_transition_mode = e_config->desktop_bg_change_transition; - zone->bg_transition_time = e_config->desktop_bg_change_transition_time; - } - if ((zone->bg_transition_mode == E_BG_TRANSITION_MODE_NONE) || - (zone->bg_transition_time == 0.0)) - transition = E_BG_TRANSITION_NONE; - if (zone->bg_transition_mode == E_BG_TRANSITION_MODE_RANDOM) - { - zone->bg_transition_mode = - (rand() % (E_BG_TRANSITION_MODE_LAST - E_BG_TRANSITION_MODE_RANDOM)) - + E_BG_TRANSITION_MODE_RANDOM + 1; - if (zone->bg_transition_mode <= E_BG_TRANSITION_MODE_RANDOM) - zone->bg_transition_mode = E_BG_TRANSITION_MODE_RANDOM + 1; - else if (zone->bg_transition_mode >= E_BG_TRANSITION_MODE_LAST) - zone->bg_transition_mode = E_BG_TRANSITION_MODE_LAST - 1; - } + char *trans = ""; + + if (transition == E_BG_TRANSITION_START) trans = e_config->transition_start; + else if (transition == E_BG_TRANSITION_DESK) trans = e_config->transition_desk; + else if (transition == E_BG_TRANSITION_CHANGE) trans = e_config->transition_change; + if (strlen(trans) < 1) transition = E_BG_TRANSITION_NONE; + if (transition == E_BG_TRANSITION_NONE) { if (zone->bg_object) @@ -52,15 +30,31 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition) zone->bg_object = NULL; } } - if (transition != E_BG_TRANSITION_NONE) + else { + char buf[4096]; + if (zone->bg_object) { if (zone->prev_bg_object) evas_object_del(zone->prev_bg_object); zone->prev_bg_object = zone->bg_object; + if (zone->transition_object) + evas_object_del(zone->transition_object); + zone->transition_object = NULL; zone->bg_object = NULL; } + o = edje_object_add(zone->container->bg_evas); + zone->transition_object = o; + evas_object_data_set(o, "e_zone", zone); + snprintf(buf, sizeof(buf), "transitions/%s", trans); + e_theme_edje_object_set(o, "base/theme/transitions", buf); + edje_object_signal_callback_add(o, "done", "*", _e_bg_signal, zone); + evas_object_move(o, zone->x, zone->y); + evas_object_resize(o, zone->w, zone->h); + evas_object_layer_set(o, -1); + evas_object_clip_set(o, zone->bg_clip_object); + evas_object_show(o); } o = edje_object_add(zone->container->bg_evas); zone->bg_object = o; @@ -94,9 +88,8 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition) e_theme_edje_object_set(o, "base/theme/background", "desktop/background"); } - evas_object_layer_set(o, -1); - evas_object_lower(o); + evas_object_layer_set(o, -1); evas_object_clip_set(o, zone->bg_clip_object); evas_object_show(o); @@ -117,9 +110,11 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition) if (transition != E_BG_TRANSITION_NONE) { - if (!zone->bg_animator) - zone->bg_animator= ecore_animator_add(_e_bg_animator, zone); - zone->bg_set_time = ecore_time_get(); + edje_object_part_swallow(zone->transition_object, "bg_prev", + zone->prev_bg_object); + edje_object_part_swallow(zone->transition_object, "bg_new", + zone->bg_object); + edje_object_signal_emit(zone->transition_object, "go", ""); } } @@ -181,49 +176,26 @@ e_bg_update(void) /* local subsystem functions */ -static int -_e_bg_animator(void *data) +static void +_e_bg_signal(void *data, Evas_Object *obj, const char *emission, const char *source) { E_Zone *zone; - double t; - int a; zone = data; - /* t is an animating INDEX 0.0 - 1.0, it is used as a lookup into - * the effect. 1.0 == finished */ - t = (ecore_time_get() - zone->bg_set_time) / zone->bg_transition_time; - if (t < 0.0) t = 0.0; - else if (t > 1.0) t = 1.0; - - if (zone->bg_transition_mode == E_BG_TRANSITION_MODE_FADE) - { - a = (1.0 - t) * 255.0; - if (a < 0) a = 0; - else if (a > 255) a = 255; - evas_object_color_set(zone->prev_bg_object, - 255, 255, 255, a); - } - else if (zone->bg_transition_mode == E_BG_TRANSITION_MODE_SINUSOUDAL_FADE) - { - double t2; - - t2 = (1.0 - cos(t * M_PI)) / 2.0; - - a = (1.0 - t2) * 255.0; - if (a < 0) a = 0; - else if (a > 255) a = 255; - evas_object_color_set(zone->prev_bg_object, - 255, 255, 255, a); - } - - /* if we still animate.. */ - if (t < 1.0) return 1; - + if (zone->prev_bg_object) { evas_object_del(zone->prev_bg_object); zone->prev_bg_object = NULL; } - zone->bg_animator = NULL; - return 0; + if (zone->transition_object) + { + evas_object_del(zone->transition_object); + zone->transition_object = NULL; + } + evas_object_move(zone->bg_object, zone->x, zone->y); + evas_object_resize(zone->bg_object, zone->w, zone->h); + evas_object_layer_set(zone->bg_object, -1); + evas_object_clip_set(zone->bg_object, zone->bg_clip_object); + evas_object_show(zone->bg_object); } diff --git a/src/bin/e_bg.h b/src/bin/e_bg.h index 0db7c0cf2..32b3ad7cb 100644 --- a/src/bin/e_bg.h +++ b/src/bin/e_bg.h @@ -10,13 +10,6 @@ typedef enum { E_BG_TRANSITION_CHANGE } E_Bg_Transition; -typedef enum { - E_BG_TRANSITION_MODE_NONE, - E_BG_TRANSITION_MODE_RANDOM, - E_BG_TRANSITION_MODE_FADE, - E_BG_TRANSITION_MODE_SINUSOUDAL_FADE, - E_BG_TRANSITION_MODE_LAST -} E_Bg_Transition_Mode; #else #ifndef E_BG_H #define E_BG_H diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 5bc49a6e5..30c8340ae 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -187,12 +187,9 @@ e_config_init(void) E_CONFIG_VAL(D, T, kill_timer_wait, DOUBLE); E_CONFIG_VAL(D, T, ping_clients, INT); E_CONFIG_VAL(D, T, ping_clients_wait, DOUBLE); - E_CONFIG_VAL(D, T, desktop_bg_start_transition, INT); - E_CONFIG_VAL(D, T, desktop_bg_start_transition_time, DOUBLE); - E_CONFIG_VAL(D, T, desktop_bg_desk_transition, INT); - E_CONFIG_VAL(D, T, desktop_bg_desk_transition_time, DOUBLE); - E_CONFIG_VAL(D, T, desktop_bg_change_transition, INT); - E_CONFIG_VAL(D, T, desktop_bg_change_transition_time, DOUBLE); + E_CONFIG_VAL(D, T, transition_start, STR); + E_CONFIG_VAL(D, T, transition_desk, STR); + E_CONFIG_VAL(D, T, transition_change, STR); e_config = e_config_domain_load("e", _e_config_edd); if (e_config) @@ -290,12 +287,9 @@ e_config_init(void) e_config->kill_timer_wait = 10.0; e_config->ping_clients = 1; e_config->ping_clients_wait = 10.0; - e_config->desktop_bg_start_transition = E_BG_TRANSITION_MODE_NONE; - e_config->desktop_bg_start_transition_time = 1.0; - e_config->desktop_bg_desk_transition = E_BG_TRANSITION_MODE_SINUSOUDAL_FADE; - e_config->desktop_bg_desk_transition_time = 0.5; - e_config->desktop_bg_change_transition = E_BG_TRANSITION_MODE_SINUSOUDAL_FADE; - e_config->desktop_bg_change_transition_time = 1.0; + e_config->transition_start = strdup(""); + e_config->transition_desk = strdup("vswipe"); + e_config->transition_change = strdup("crossfade"); { E_Config_Module *em; @@ -826,12 +820,6 @@ e_config_init(void) E_CONFIG_LIMIT(e_config->kill_timer_wait, 0.0, 120.0); E_CONFIG_LIMIT(e_config->ping_clients, 0, 1); E_CONFIG_LIMIT(e_config->ping_clients_wait, 0.0, 120.0); - E_CONFIG_LIMIT(e_config->desktop_bg_start_transition, E_BG_TRANSITION_MODE_NONE, E_BG_TRANSITION_MODE_LAST); - E_CONFIG_LIMIT(e_config->desktop_bg_start_transition_time, 0.01, 60.0); - E_CONFIG_LIMIT(e_config->desktop_bg_desk_transition, E_BG_TRANSITION_MODE_NONE, E_BG_TRANSITION_MODE_LAST); - E_CONFIG_LIMIT(e_config->desktop_bg_desk_transition_time, 0.01, 60.0); - E_CONFIG_LIMIT(e_config->desktop_bg_change_transition, E_BG_TRANSITION_MODE_NONE, E_BG_TRANSITION_MODE_LAST); - E_CONFIG_LIMIT(e_config->desktop_bg_change_transition_time, 0.01, 60.0); /* apply lang config - exception because config is loaded after intl setup */ diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 18e75aad1..07fcb418b 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -47,7 +47,7 @@ typedef Eet_Data_Descriptor E_Config_DD; * defaults for e to work - started at 100 when we introduced this config * versioning feature */ -#define E_CONFIG_FILE_VERSION 116 +#define E_CONFIG_FILE_VERSION 117 #define E_EVAS_ENGINE_DEFAULT 0 #define E_EVAS_ENGINE_SOFTWARE_X11 1 @@ -131,12 +131,9 @@ struct _E_Config double kill_timer_wait; int ping_clients; double ping_clients_wait; - int desktop_bg_start_transition; - double desktop_bg_start_transition_time; - int desktop_bg_desk_transition; - double desktop_bg_desk_transition_time; - int desktop_bg_change_transition; - double desktop_bg_change_transition_time; + char *transition_start; + char *transition_desk; + char *transition_change; }; struct _E_Config_Module diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c index e45570915..74e3b5803 100644 --- a/src/bin/e_zone.c +++ b/src/bin/e_zone.c @@ -543,7 +543,8 @@ _e_zone_free(E_Zone *zone) evas_object_del(zone->bg_clip_object); evas_object_del(zone->bg_object); if (zone->prev_bg_object) evas_object_del(zone->prev_bg_object); - if (zone->bg_animator) ecore_animator_del(zone->bg_animator); + if (zone->transition_object) evas_object_del(zone->transition_object); + /* free desks */ for (x = 0; x < zone->desk_x_count; x++) { diff --git a/src/bin/e_zone.h b/src/bin/e_zone.h index 509b4aea7..826161ad1 100644 --- a/src/bin/e_zone.h +++ b/src/bin/e_zone.h @@ -29,10 +29,7 @@ struct _E_Zone Evas_Object *bg_event_object; Evas_Object *bg_clip_object; Evas_Object *prev_bg_object; - Ecore_Animator *bg_animator; - double bg_set_time; - double bg_transition_time; - E_Bg_Transition_Mode bg_transition_mode; + Evas_Object *transition_object; int desk_x_count, desk_y_count; int desk_x_current, desk_y_current;