Enlightenment CVS committal
Author : xcomputerman
Project : e_modules
Module : bling
Dir : e_modules/bling
Modified Files:
compmgr.c compmgr.h e_mod_main.c
Log Message:
Fades work now. There may be a very small memory leak here while I try
to avoid a double free situation. Also avoids fading desktop windows.
Fading is based on elapsed time to avoid performance problems on slow
PCs.
===================================================================
RCS file: /cvs/e/e_modules/bling/compmgr.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- compmgr.c 24 Jun 2006 22:28:47 -0000 1.3
+++ compmgr.c 25 Jun 2006 02:03:07 -0000 1.4
@@ -127,6 +127,7 @@
static double get_opacity_percent(Win *w, double def);
static Ecore_X_Region composite_win_extents (Win *w);
static int _composite_run_fades_cb(void *data);
+static int composite_update(void *data);
static int
composite_x_error(Display *dpy, XErrorEvent *xerror)
@@ -163,7 +164,7 @@
fades = evas_list_remove(fades, f);
if (f->anim)
ecore_animator_del(f->anim);
- E_FREE(f);
+ /* E_FREE(f); */
}
static void
@@ -174,52 +175,71 @@
}
static void
-composite_fade_set(Win * w, double start, double finish, double step,
- void (*callback) (Win * w, Bool gone), Bool gone, Bool exec_callback,
- Bool override)
+composite_fade_set(Win *w, double start, double finish, double step,
+ void (*callback) (Win *w, Bool gone), Bool gone,
+ Bool exec_callback, Bool override)
{
Fade *f;
+ E_Manager *man;
+ Evas_List *l;
+ char *name = NULL, *class = NULL;
+
+ /* Don't fade desktop/root windows */
+ if (!w->id || w->id == root) return;
+ ecore_x_icccm_name_class_get(w->id, &name, &class);
+ if (class && !strcmp(class, "Background_Window"))
+ {
+ E_FREE(name);
+ E_FREE(class);
+ return;
+ }
+ E_FREE(name);
+ E_FREE(class);
+ man = e_manager_current_get();
+ if (w->id == man->win) return;
+ for (l = man->containers; l; l = l->next)
+ {
+ E_Container *con = l->data;
+ if (w->id == con->win) return;
+ }
f = composite_fade_find(w);
if (!f)
{
f = E_NEW(Fade, 1);
f->w = w;
- f->cur = start;
+ f->start = f->cur = start;
+ w->isInFade = True;
fades = evas_list_prepend(fades, f);
+ f->anim = ecore_animator_add(_composite_run_fades_cb, f);
}
else if (!override)
return;
else
{
- if (exec_callback)
- if (f->callback)
- (*f->callback) (f->w, f->gone);
+ if (exec_callback && f->callback)
+ (*f->callback)(f->w, f->gone);
}
- if (finish < 0)
- finish = 0;
- if (finish > 1)
- finish = 1;
+ if (finish < 0) finish = 0;
+ if (finish > 1) finish = 1;
f->finish = finish;
+ f->step = (f->cur < finish) ? step : -step;
+ f->start_time = ecore_time_get();
if (f->cur < finish)
- f->step = step;
- else if (f->cur > finish)
- f->step = -step;
+ f->interval = (1/config->fx_fade_in_speed *
ecore_animator_frametime_get());
+ else
+ f->interval = (1/config->fx_fade_out_speed *
ecore_animator_frametime_get());
f->callback = callback;
f->gone = gone;
w->opacity = f->cur * OPAQUE;
-#if 0
- printf("set_fade start %g step %g\n", f->cur, f->step);
-#endif
composite_win_mode_determine(w);
if (w->shadow)
{
XRenderFreePicture(dpy, w->shadow);
- w->shadow = None;
+ w->shadow= None;
w->extents = composite_win_extents(w);
}
- f->anim = ecore_animator_add(_composite_run_fades_cb, f);
}
static int
@@ -227,24 +247,23 @@
{
Fade *f;
Win *w;
+ int f_continue = 1;
+ double current_time, delta_time, fade_interval;
-#if 0
- /* Prioritize pending X events */
- if (QLength(dpy))
- {
- fade_steps++;
- return 1;
- }
-#endif
f = data;
if (!f) return 0;
w = f->w;
- f->cur += f->step;
+ current_time = ecore_time_get();
+ delta_time = current_time - f->start_time;
+ if (delta_time >= f->interval)
+ f->cur = f->finish;
+ else
+ f->cur = f->start + (delta_time/f->interval * (f->finish - f->start));
if (f->cur >= 1)
f->cur = 1;
else if (f->cur < 0)
- f->cur = 0;
+ f->cur = 0;
w->opacity = f->cur * OPAQUE;
if (f->step > 0)
{
@@ -252,6 +271,8 @@
{
w->opacity = f->finish * OPAQUE;
composite_fade_dequeue(f);
+ f = NULL;
+ f_continue = 0;
}
}
else
@@ -260,6 +281,8 @@
{
w->opacity = f->finish * OPAQUE;
composite_fade_dequeue(f);
+ f = NULL;
+ f_continue = 0;
}
}
composite_win_mode_determine(w);
@@ -269,14 +292,11 @@
w->shadow = None;
w->extents = composite_win_extents(w);
}
- /* FIXME: Update fade picture??? */
- return 1;
+ return f_continue;
}
#define SHADOW_OFFSET_X ((-config->shadow_active_size * 7 / 5) -
config->shadow_horz_offset * config->shadow_active_size / 100) * w->shadowSize
#define SHADOW_OFFSET_Y ((-config->shadow_active_size * 7 / 5) -
config->shadow_vert_offset * config->shadow_active_size / 100) * w->shadowSize
-//#define SHADOW_OFFSET_X
(w->shadowSize * -config->shadow_active_size * 7 / 500) -
w->shadowSize * config->shadow_horz_offset * config->shadow_active_size / 10000
-//#define SHADOW_OFFSET_Y
(w->shadowSize * -config->shadow_active_size * 7 / 500) -
w->shadowSize * config->shadow_vert_offset * config->shadow_active_size / 10000
static double
gaussian(double r, double x, double y)
@@ -828,7 +848,7 @@
if (!w->damaged)
continue;
- // skip invisible windows
+ /* skip invisible windows */
if (w->a.x + w->a.w < 1 || w->a.y + w->a.h < 1
|| w->a.x >= root_width || w->a.y >= root_height)
continue;
@@ -1077,9 +1097,6 @@
w->a.visible = 1;
w->a.viewable = 1;
- /* This needs to be here or else we lose transparency messages */
- //XSelectInput(dpy, id, PropertyChangeMask);
-
#if CAN_DO_USABLE
w->damage_bounds.x = w->damage_bounds.y = 0;
w->damage_bounds.width = w->damage_bounds.height = 0;
@@ -1118,9 +1135,6 @@
w->picture = None;
}
- /* don't care about properties anymore */
- //XSelectInput(dpy, w->id, 0);
-
if (w->borderSize)
{
ecore_x_region_del(w->borderSize);
@@ -1505,7 +1519,7 @@
void
composite_shadow_color_set(char *value)
-{ // format nach #xxxxxx (html) ändern?
+{
unsigned int tmp;
char **res = NULL;
===================================================================
RCS file: /cvs/e/e_modules/bling/compmgr.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- compmgr.h 5 Jun 2006 04:42:18 -0000 1.1.1.1
+++ compmgr.h 25 Jun 2006 02:03:07 -0000 1.2
@@ -54,9 +54,12 @@
typedef struct _Fade {
Win *w;
Ecore_Animator *anim;
+ double start;
double cur;
double finish;
double step;
+ double start_time;
+ double interval;
void (*callback) (Win *w, Bool gone);
Display *dpy;
Bool gone;
===================================================================
RCS file: /cvs/e/e_modules/bling/e_mod_main.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_mod_main.c 24 Jun 2006 22:28:47 -0000 1.2
+++ e_mod_main.c 25 Jun 2006 02:03:07 -0000 1.3
@@ -190,8 +190,8 @@
b->config->shadow_horz_offset = 3;
b->config->shadow_hide_on_move = 0;
- b->config->fx_fade_enable = 0;
- b->config->fx_fade_opacity_enable = 0;
+ b->config->fx_fade_enable = 1;
+ b->config->fx_fade_opacity_enable = 1;
b->config->fx_fade_delta = 1.0/30.0;
b->config->fx_fade_in_speed = 0.075;
b->config->fx_fade_out_speed = 0.100;
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs