All pastes #478976 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-09 13:52 UTC
rendered paste body
diff --git a/src/display.c b/src/display.c
index dfff63f..e9cf859 100644
--- a/src/display.c
+++ b/src/display.c
@@ -2424,7 +2424,7 @@ addDisplay (char *name)
 		      ButtonPressMask	       |
 		      ButtonReleaseMask	       |
 		      FocusChangeMask	       |
-		      ExposureMask);
+		      ExposureMask );
 
 	if (compCheckForError (dpy))
 	{
diff --git a/src/paint.c b/src/paint.c
index 39bcacc..17bc34a 100644
--- a/src/paint.c
+++ b/src/paint.c
@@ -28,6 +28,7 @@
 #include <math.h>
 
 #include <compiz.h>
+#include <GL/glu.h>
 
 #define DEG2RAD (M_PI / 180.0f)
 
@@ -149,6 +150,9 @@ paintCursor (CompCursor		 *c,
    difference with most hardware but occlusion detection in the
    transformed screen case should be made optional for those who do
    see a difference. */
+
+CompTransform sTrans;
+
 static void
 paintScreenRegion (CompScreen	       *screen,
 		   const CompTransform *transform,
@@ -284,6 +288,7 @@ paintTransformedScreen (CompScreen		*screen,
 
 	glPushMatrix ();
 	glLoadMatrixf (sTransform.m);
+	sTrans = sTransform;
 
 	glClipPlane (GL_CLIP_PLANE0, top);
 	glClipPlane (GL_CLIP_PLANE1, bottom);
@@ -370,6 +375,7 @@ paintScreen (CompScreen		     *screen,
 
     glPushMatrix ();
     glLoadMatrixf (sTransform.m);
+	sTrans = sTransform;
 
     paintScreenRegion (screen, &sTransform, region, output, mask);
 
@@ -477,6 +483,8 @@ moreWindowIndices (CompWindow *w,
     return TRUE;
 }
 
+CompTransform testfoo;
+
 static void
 drawWindowGeometry (CompWindow *w)
 {
@@ -515,6 +523,149 @@ drawWindowGeometry (CompWindow *w)
 
 	(*w->screen->clientActiveTexture) (GL_TEXTURE0_ARB);
     }
+
+	CompScreen *s = w->screen;
+	GLdouble dProjection[16];
+    GLdouble dModel[16];
+    GLint    viewport[4];
+    double   x, y, z;
+    int	     i;
+
+    viewport[0] = s->outputDev[0].region.extents.x1;
+    viewport[1] = s->height - s->outputDev[0].region.extents.y2;
+    viewport[2] = s->outputDev[0].width;
+    viewport[3] = s->outputDev[0].height;
+
+    for (i = 0; i < 16; i++)
+    {
+	dModel[i]      = testfoo.m[i];
+
+	dProjection[i] = s->projection[i];
+    }
+
+
+	    //if (w->wmType & CompWindowTypeDesktopMask)
+        {
+				float win[4][2];
+				float scr[4][2];
+
+
+				float fx1,fx2,fy1,fy2;
+				fx1 = w->attrib.x;
+				fx2 = fx1 + w->width;
+				fy1 = w->attrib.y;
+				fy2 = fy1 + w->height;
+
+				win[0][0] = fx1;
+				win[0][1] = fy1;
+				win[1][0] = fx1;
+				win[1][1] = fy2;
+				win[2][0] = fx2;
+				win[2][1] = fy2;
+				win[3][0] = fx2;
+				win[3][1] = fy1;
+
+				scr[0][0] = 0;
+				scr[0][1] = 0;
+				scr[1][0] = 0;
+				scr[1][1] = s->height;
+				scr[2][0] = s->width;
+				scr[2][1] = s->height;
+				scr[3][0] = s->width;
+				scr[3][1] = 0;
+
+
+				for (i = 0; i < 4; i++)
+				{
+					gluProject (win[i][0], win[i][1], 0.0, dModel, dProjection, viewport, &x, &y, &z);
+					scr[i][0] = x;
+					scr[i][1] = s->height - y;
+				}
+
+
+                XTriangle Tris[] = {
+                        {{scr[0][0],scr[0][1]},{scr[1][0],scr[1][1]},{scr[2][0],scr[2][1]}},
+                        {{win[0][0],win[0][1]},{win[1][0],win[1][1]},{win[2][0],win[2][1]}},
+                        {{scr[0][0],scr[0][1]},{scr[3][0],scr[3][1]},{scr[2][0],scr[2][1]}},
+                        {{win[0][0],win[0][1]},{win[3][0],win[3][1]},{win[2][0],win[2][1]}},
+                        {{win[0][0],win[0][1]},{win[1][0],win[1][1]},{win[2][0],win[2][1]}},
+						{{0,0},{2,2},{2,3}},
+                        {{win[0][0],win[0][1]},{win[3][0],win[3][1]},{win[2][0],win[2][1]}},
+						{{0,0},{2,2},{2,3}}
+
+				}; 
+
+                
+                int nTris = sizeof(Tris)/sizeof(XTriangle);
+                int i;
+
+                for (i=0;i<nTris;i++)
+                {
+                        Tris[i].p1.x = XDoubleToFixed(Tris[i].p1.x);
+                        Tris[i].p1.y = XDoubleToFixed(Tris[i].p1.y);
+                        Tris[i].p2.x = XDoubleToFixed(Tris[i].p2.x);
+                        Tris[i].p2.y = XDoubleToFixed(Tris[i].p2.y);
+                        Tris[i].p3.x = XDoubleToFixed(Tris[i].p3.x);
+                        Tris[i].p3.y = XDoubleToFixed(Tris[i].p3.y);
+                }
+
+                XCompositeSetTriangularCoordinateMesh(w->screen->display->display,w->id,Tris,nTris);
+
+        }
+
+		if (w->frame)
+		{
+				float win[4][2];
+				float scr[4][2];
+
+
+				float fx1,fx2,fy1,fy2;
+
+
+				fx1 = w->attrib.x - w->input.left;
+				fx2 = fx1 + w->width + w->input.left + w->input.right;
+				fy1 = w->attrib.y - w->input.top;
+				fy2 = fy1 + w->height + w->input.top + w->input.bottom;
+
+				win[0][0] = fx1;
+				win[0][1] = fy1;
+				win[1][0] = fx1;
+				win[1][1] = fy2;
+				win[2][0] = fx2;
+				win[2][1] = fy2;
+				win[3][0] = fx2;
+				win[3][1] = fy1;
+
+				for (i = 0; i < 4; i++)
+				{
+					gluProject (win[i][0], win[i][1], 0.0, dModel, dProjection, viewport, &x, &y, &z);
+					scr[i][0] = x;
+					scr[i][1] = s->height - y;
+				}
+
+                XTriangle Tris[] = {
+                        {{scr[0][0],scr[0][1]},{scr[1][0],scr[1][1]},{scr[2][0],scr[2][1]}},
+                        {{win[0][0],win[0][1]},{win[1][0],win[1][1]},{win[2][0],win[2][1]}},
+                        {{scr[0][0],scr[0][1]},{scr[3][0],scr[3][1]},{scr[2][0],scr[2][1]}},
+                        {{win[0][0],win[0][1]},{win[3][0],win[3][1]},{win[2][0],win[2][1]}}
+                };
+                int nTris = sizeof(Tris)/sizeof(XTriangle);
+                int i;
+
+                for (i=0;i<nTris;i++)
+                {
+                        Tris[i].p1.x = XDoubleToFixed(Tris[i].p1.x);
+                        Tris[i].p1.y = XDoubleToFixed(Tris[i].p1.y);
+                        Tris[i].p2.x = XDoubleToFixed(Tris[i].p2.x);
+                        Tris[i].p2.y = XDoubleToFixed(Tris[i].p2.y);
+                        Tris[i].p3.x = XDoubleToFixed(Tris[i].p3.x);
+                        Tris[i].p3.y = XDoubleToFixed(Tris[i].p3.y);
+                }
+                XCompositeSetTriangularCoordinateMesh(w->screen->display->display,w->frame,Tris,nTris);
+
+        }
+
+
 }
 
 void
@@ -1004,6 +1155,7 @@ drawWindow (CompWindow		 *w,
 
     w->vCount = w->indexCount = 0;
     (*w->screen->addWindowGeometry) (w, &w->matrix, 1, w->region, region);
+	testfoo = *transform;
     if (w->vCount)
 	(*w->screen->drawWindowTexture) (w, w->texture, fragment, mask);
 
@@ -1055,6 +1207,9 @@ paintWindow (CompWindow		     *w,
 	glLoadMatrixf (transform->m);
     }
 
+	testfoo = *transform;
+
+
     status = (*w->screen->drawWindow) (w, transform, &fragment, region, mask);
 
     if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
diff --git a/src/window.c b/src/window.c
index fbae40e..17c7446 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1251,7 +1251,43 @@ bindWindow (CompWindow *w)
 
 	w->pixmap = XCompositeNameWindowPixmap (w->screen->display->display,
 						w->id);
-
+/*
+	    //if (w->wmType & CompWindowTypeDesktopMask)
+        {
+				int x1,x2,y1,y2;
+				x1 = w->attrib.x;
+				x2 = x1 + w->width;
+				y1 = w->attrib.y;
+				y2 = y1 + w->height;
+
+				int xx1,xx2,yy1,yy2;
+				xx1 = w->attrib.x;
+				xx2 = xx1 + w->width;
+				yy1 = w->attrib.y;
+				yy2 = yy1 + w->height;
+
+                XTriangle Tris[] = {
+                        {{x1,y1},{x2,y1},{x2,y2}},
+                        {{x1,y2},{x2,y2},{x2,y1}},
+                        {{x1,y1},{x1,y2},{x2,y2}},
+                        {{x1,y2},{x1,y1},{x2,y1}},
+                };
+                int nTris = sizeof(Tris)/sizeof(XTriangle);
+                int i;
+#define IntToxFixed(x) XDoubleToFixed(x)
+                for (i=0;i<nTris;i++)
+                {
+                        Tris[i].p1.x = IntToxFixed(Tris[i].p1.x);
+                        Tris[i].p1.y = IntToxFixed(Tris[i].p1.y);
+                        Tris[i].p2.x = IntToxFixed(Tris[i].p2.x);
+                        Tris[i].p2.y = IntToxFixed(Tris[i].p2.y);
+                        Tris[i].p3.x = IntToxFixed(Tris[i].p3.x);
+                        Tris[i].p3.y = IntToxFixed(Tris[i].p3.y);
+                }
+				printf("Bla\n");
+                XCompositeSetTriangularCoordinateMesh(w->screen->display->display,w->id,Tris,nTris);
+        }
+	*/
 	XUngrabServer (w->screen->display->display);
     }