Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        desktops.c desktops.h ecompmgr.c ecompmgr.h fx.c 


Log Message:
Fix ripples/waves on xorg 1.4 when composite is active.

===================================================================
RCS file: /cvs/e/e16/e/src/desktops.c,v
retrieving revision 1.288
retrieving revision 1.289
diff -u -3 -r1.288 -r1.289
--- desktops.c  10 May 2008 23:22:31 -0000      1.288
+++ desktops.c  1 Jun 2008 20:53:11 -0000       1.289
@@ -473,12 +473,10 @@
    Efree(dsk);
 }
 
-Win
-DeskGetBackgroundWin(const Desk * dsk)
+EObj               *
+DeskGetBackgroundObj(const Desk * dsk)
 {
-   if (!dsk)
-      return VROOT;
-   return EobjGetWin(dsk->bg.o);
+   return (dsk) ? dsk->bg.o : NULL;
 }
 
 Pixmap
===================================================================
RCS file: /cvs/e/e16/e/src/desktops.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- desktops.h  10 May 2008 23:22:31 -0000      1.32
+++ desktops.h  1 Jun 2008 20:53:12 -0000       1.33
@@ -69,7 +69,7 @@
 void                DeskGoto(Desk * dsk);
 void                DeskGotoNum(unsigned int desk);
 void                DeskRestack(Desk * dsk);
-Win                 DeskGetBackgroundWin(const Desk * dsk);
+EObj               *DeskGetBackgroundObj(const Desk * dsk);
 Pixmap              DeskGetBackgroundPixmap(const Desk * dsk);
 
 Background         *DeskBackgroundGet(const Desk * dsk);
===================================================================
RCS file: /cvs/e/e16/e/src/ecompmgr.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -3 -r1.176 -r1.177
--- ecompmgr.c  10 May 2008 23:15:32 -0000      1.176
+++ ecompmgr.c  1 Jun 2008 20:53:12 -0000       1.177
@@ -49,6 +49,7 @@
 #include <X11/Xutil.h>
 #include <X11/extensions/Xcomposite.h>
 #include <X11/extensions/Xdamage.h>
+#include <X11/extensions/Xfixes.h>
 #include <X11/extensions/Xrender.h>
 
 #define ENABLE_SHADOWS      1
@@ -461,6 +462,19 @@
  done:
    if (pr)
       XFree(pr);
+}
+
+void
+ECompMgrWinClipToGC(EObj * eo, GC gc)
+{
+   XserverRegion       rgn = rgn_tmp2;
+
+   if (!eo || !eo->cmhook)
+      return;
+
+   ERegionCopy(rgn, Mode_compmgr.rgn_screen);
+   ERegionSubtract(rgn, eo->cmhook->clip);
+   XFixesSetGCClipRegion(disp, gc, 0, 0, rgn);
 }
 
 /*
===================================================================
RCS file: /cvs/e/e16/e/src/ecompmgr.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- ecompmgr.h  29 Mar 2008 17:18:58 -0000      1.36
+++ ecompmgr.h  1 Jun 2008 20:53:12 -0000       1.37
@@ -58,6 +58,7 @@
 void                ECompMgrWinChangeOpacity(EObj * eo, unsigned int opacity);
 void                ECompMgrWinChangeShadow(EObj * eo, int shadow);
 Pixmap              ECompMgrWinGetPixmap(const EObj * eo);
+void                ECompMgrWinClipToGC(EObj * eo, GC gc);
 
 void                ECompMgrConfigGet(cfg_composite * cfg);
 void                ECompMgrConfigSet(const cfg_composite * cfg);
===================================================================
RCS file: /cvs/e/e16/e/src/fx.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -3 -r1.88 -r1.89
--- fx.c        24 May 2008 18:13:17 -0000      1.88
+++ fx.c        1 Jun 2008 20:53:12 -0000       1.89
@@ -23,6 +23,7 @@
 #include "E.h"
 #include "desktops.h"
 #include "dialog.h"
+#include "ecompmgr.h"
 #include "eimage.h"
 #include "emodule.h"
 #include "settings.h"
@@ -53,6 +54,13 @@
    char                paused;
 } FXHandler;
 
+#if USE_COMPOSITE
+/* As of composite 0.4 we need to set the clip region */
+#define SET_GC_CLIP(eo, gc) ECompMgrWinClipToGC(eo, gc)
+#else
+#define SET_GC_CLIP(eo, gc)
+#endif
+
 /****************************** RIPPLES *************************************/
 
 #define fx_ripple_waterh 64
@@ -67,12 +75,15 @@
    static double       incv = 0, inch = 0;
    static GC           gc1 = 0, gc = 0;
    int                 y;
+   EObj               *bgeo;
+
+   bgeo = DeskGetBackgroundObj(DesksGetCurrent());
 
    if (fx_ripple_above == None)
      {
        XGCValues           gcv;
 
-       fx_ripple_win = DeskGetBackgroundWin(DesksGetCurrent());
+       fx_ripple_win = EobjGetWin(bgeo);
 
        fx_ripple_above =
           ECreatePixmap(fx_ripple_win, WinGetW(VROOT),
@@ -87,23 +98,23 @@
      }
 
    if (fx_ripple_count == 0)
-      XCopyArea(disp, EoGetXwin(DesksGetCurrent()), fx_ripple_above, gc, 0,
+      XCopyArea(disp, WinGetXwin(fx_ripple_win), fx_ripple_above, gc, 0,
                WinGetH(VROOT) - (fx_ripple_waterh * 3), WinGetW(VROOT),
                fx_ripple_waterh * 2, 0, 0);
 
    fx_ripple_count++;
    if (fx_ripple_count > 32)
       fx_ripple_count = 0;
+
    incv += 0.40;
    if (incv > (M_PI_2 * 4))
-     {
-       incv = 0;
-     }
+      incv = 0;
    inch += 0.32;
    if (inch > (M_PI_2 * 4))
-     {
-       inch = 0;
-     }
+      inch = 0;
+
+   SET_GC_CLIP(bgeo, gc1);
+
    for (y = 0; y < fx_ripple_waterh; y++)
      {
        double              aa, a, p;
@@ -196,6 +207,9 @@
    static char         first = 1;
    static char         sintab[256];
    static unsigned char disttab[fx_raindrop_size][fx_raindrop_size];
+   EObj               *bgeo;
+
+   bgeo = DeskGetBackgroundObj(DesksGetCurrent());
 
    if (fx_raindrops_win == None)
      {
@@ -221,7 +235,7 @@
               }
          }
 
-       fx_raindrops_win = DeskGetBackgroundWin(DesksGetCurrent());
+       fx_raindrops_win = EobjGetWin(bgeo);
 
        if (gc)
           EXFreeGC(gc);
@@ -252,6 +266,8 @@
          }
      }
 
+   SET_GC_CLIP(bgeo, gc1);
+
    for (i = 0; i < fx_raindrops_number; i++)
      {
        fx_raindrops[i].count++;
@@ -469,13 +485,16 @@
    double              incx2;
    static GC           gc1 = 0, gc = 0;
    int                 y;
+   EObj               *bgeo;
+
+   bgeo = DeskGetBackgroundObj(DesksGetCurrent());
 
    /* Check to see if we need to create stuff */
    if (!fx_wave_above)
      {
        XGCValues           gcv;
 
-       fx_wave_win = DeskGetBackgroundWin(DesksGetCurrent());
+       fx_wave_win = EobjGetWin(bgeo);
 
        fx_wave_above =
           ECreatePixmap(fx_wave_win, WinGetW(VROOT), FX_WAVE_WATERH * 2, 0);
@@ -491,7 +510,7 @@
    /* On the zero, grab the desktop again. */
    if (fx_wave_count == 0)
      {
-       XCopyArea(disp, EoGetXwin(DesksGetCurrent()), fx_wave_above, gc, 0,
+       XCopyArea(disp, WinGetXwin(fx_wave_win), fx_wave_above, gc, 0,
                  WinGetH(VROOT) - (FX_WAVE_WATERH * 3), WinGetW(VROOT),
                  FX_WAVE_WATERH * 2, 0, 0);
      }
@@ -514,6 +533,8 @@
    if (incx > (M_PI_2 * 4))
       incx = 0;
 
+   SET_GC_CLIP(bgeo, gc1);
+
    /* Copy the area to correct bugs */
    if (fx_wave_count == 0)
      {
@@ -620,10 +641,12 @@
 FX_imagespinner_timeout(void *data __UNUSED__)
 {
    char               *string = NULL;
+   EObj               *bgeo;
 
    if (fx_imagespinner_win == None)
      {
-       fx_imagespinner_win = DeskGetBackgroundWin(DesksGetCurrent());
+       bgeo = DeskGetBackgroundObj(DesksGetCurrent());
+       fx_imagespinner_win = EobjGetWin(bgeo);
      }
 
 #if 0                          /* Don't use getword */
@@ -671,7 +694,10 @@
 static void
 FX_ImageSpinner_Desk(void)
 {
-   fx_imagespinner_win = DeskGetBackgroundWin(DesksGetCurrent());
+   EObj               *bgeo;
+
+   bgeo = DeskGetBackgroundObj(DesksGetCurrent());
+   fx_imagespinner_win = EobjGetWin(bgeo);
 }
 
 static void



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to