diff -Naur xfwm4-4.2.1/src/client.h xfwm4-4.2.1-gradient/src/client.h --- xfwm4-4.2.1/src/client.h 2004-12-30 17:08:37.000000000 -0500 +++ xfwm4-4.2.1-gradient/src/client.h 2005-03-26 03:24:07.049609504 -0500 @@ -252,6 +252,8 @@ ClientPixmapCache pm_cache; /* Opacity for the compositor */ guint opacity; + /* Translucent State Info */ + int translucentState; #ifdef HAVE_LIBSTARTUP_NOTIFICATION /* Startup notification */ diff -Naur xfwm4-4.2.1/src/compositor.c xfwm4-4.2.1-gradient/src/compositor.c --- xfwm4-4.2.1/src/compositor.c 2005-01-30 08:24:07.000000000 -0500 +++ xfwm4-4.2.1-gradient/src/compositor.c 2005-03-26 03:57:58.847729240 -0500 @@ -2424,3 +2424,64 @@ } #endif /* HAVE_COMPOSITOR */ } + +gint timedFadeOut(gpointer info) { + wndInfo *our_info = (wndInfo*)info; + + if(our_info->c->translucentState != 2) { + free(info); + return 0; + } + if((our_info->c->opacity - (1<<24)) < our_info->m) { + our_info->c->opacity = our_info->m; + our_info->c->translucentState = 0; + compositorWindowSetOpacity(our_info->ds, our_info->c->frame, our_info->c->opacity); + free(info); + return 0; + } + our_info->c->opacity -= 1<<24; + compositorWindowSetOpacity(our_info->ds, our_info->c->frame, our_info->c->opacity); + return 1; +} + +gint timedFadeIn(gpointer info) { + wndInfo *our_info = (wndInfo*)info; + + if(our_info->c->translucentState != 1) { + free(info); + return 0; + } + if(((guint64)our_info->c->opacity + (1<<24)) > our_info->m) { + our_info->c->opacity = our_info->m; + our_info->c->translucentState = 0; + compositorWindowSetOpacity(our_info->ds, our_info->c->frame, our_info->c->opacity); + free(info); + return 0; // check for overflow + } + our_info->c->opacity += 1<<24; + compositorWindowSetOpacity(our_info->ds, our_info->c->frame, our_info->c->opacity); + return 1; +} + +void compositorFadeOut(DisplayInfo *ds, Client *c, guint m) { + wndInfo *wnd_info = (wndInfo*)malloc(sizeof(wndInfo)); + + wnd_info->ds = ds; + wnd_info->c = c; + wnd_info->m = m; + + c->translucentState = 2; + g_timeout_add(2, &timedFadeOut, wnd_info); +} + +void compositorFadeIn(DisplayInfo *ds, Client *c, guint m) { + wndInfo *wnd_info = (wndInfo*)malloc(sizeof(wndInfo)); + + wnd_info->ds = ds; + wnd_info->c = c; + wnd_info->m = m; + + c->translucentState = 1; + g_timeout_add(2, &timedFadeIn, wnd_info); +} + diff -Naur xfwm4-4.2.1/src/compositor.h xfwm4-4.2.1-gradient/src/compositor.h --- xfwm4-4.2.1/src/compositor.h 2004-12-13 16:27:18.000000000 -0500 +++ xfwm4-4.2.1-gradient/src/compositor.h 2005-03-24 21:59:31.000000000 -0500 @@ -50,4 +50,13 @@ void compositorDamageWindow (DisplayInfo *, Window); void compositorUpdateWindow (DisplayInfo *, Window, gint, gint, gboolean); +void compositorFadeOut (DisplayInfo *, Client *, guint); +void compositorFadeIn (DisplayInfo *, Client *, guint); + +typedef struct { + DisplayInfo *ds; + Client *c; + guint m; +} wndInfo; + #endif /* INC_COMPOSITOR_H */ diff -Naur xfwm4-4.2.1/src/events.c xfwm4-4.2.1-gradient/src/events.c --- xfwm4-4.2.1/src/events.c 2005-02-12 16:29:37.000000000 -0500 +++ xfwm4-4.2.1-gradient/src/events.c 2005-03-26 02:00:37.692147592 -0500 @@ -1529,7 +1529,9 @@ if (c) { TRACE ("focus set to \"%s\" (0x%lx)", c->name, c->window); - screen_info = c->screen_info; + compositorFadeIn(display_info, c, NET_WM_OPAQUE); + + screen_info = c->screen_info; clientUpdateFocus (screen_info, c, FOCUS_SORT); last_raised = clientGetLastRaise (screen_info); if ((screen_info->params->click_to_focus) && @@ -1586,6 +1588,7 @@ if ((c) && (c == clientGetFocus ())) { TRACE ("focus lost from \"%s\" (0x%lx)", c->name, c->window); + compositorFadeOut(display_info, c, 0xaa000000); clientUpdateFocus (c->screen_info, NULL, NO_FOCUS_FLAG); /* Clear timeout */ clear_timeout (); @@ -2365,3 +2368,4 @@ G_CALLBACK (dbl_click_time_cb), (gpointer) (screen_info->display_info)); } } +