use translate to place windows, and draw them based on 0,0
authorDana Jansens <danakj@orodu.net>
Sat, 15 Mar 2008 23:26:33 +0000 (19:26 -0400)
committerDana Jansens <danakj@orodu.net>
Sat, 15 Mar 2008 23:26:33 +0000 (19:26 -0400)
glxrender.c

index ff7e79b..1dc1747 100644 (file)
@@ -494,8 +494,14 @@ glxrender_paint(d_screen_t *sc)
 
             wd = window_find_plugin_data(w, plugin_id);
 
-            paint_shadow(w, d, wd, x, y, width, height, bwidth);
-            paint_window(w, d, wd, opaque, x, y, width, height, bwidth);
+            glPushMatrix();
+            glTranslatef(x + d->xshadowoff, y + d->yshadowoff, 0.0f);
+
+            paint_shadow(w, d, wd, 0, 0, width, height, bwidth);
+            glTranslatef(-d->xshadowoff, -d->yshadowoff, 0.0f);
+            paint_window(w, d, wd, opaque, 0, 0, width, height, bwidth);
+
+            glPopMatrix();
         }
     }
 
@@ -548,6 +554,7 @@ paint_window(d_window_t *w, data_t *d, window_data_t *wd, gboolean opaque,
     }
 
     glBegin(GL_QUADS);
+    glTexCoord2f(0, 0);
     glVertex2i(x, y);
     glTexCoord2f(1, 0);
     glVertex2i(x + width + bwidth, y);
@@ -556,7 +563,6 @@ paint_window(d_window_t *w, data_t *d, window_data_t *wd, gboolean opaque,
                y + height + bwidth);
     glTexCoord2f(0, 1);
     glVertex2i(x, y + height + bwidth);
-    glTexCoord2f(0, 0);
     glEnd();
 
     glBindTexture(GL_TEXTURE_2D, 0);
@@ -572,8 +578,6 @@ static void
 paint_shadow(d_window_t *w, data_t *d, window_data_t *wd,
              int x, int y, int width, int height, int bwidth)
 {
-    int xoff = d->xshadowoff;
-    int yoff = d->yshadowoff;
     float alpha = d->shadowalpha;
 
     alpha *= window_get_opacity(w);
@@ -591,23 +595,23 @@ paint_shadow(d_window_t *w, data_t *d, window_data_t *wd,
         glBindTexture(GL_TEXTURE_2D, wd->texname);
 
         glBegin(GL_QUADS);
-        glVertex2i(x + xoff, y + yoff);
+        glTexCoord2f(0, 0);
+        glVertex2i(x, y);
         glTexCoord2f(1, 0);
-        glVertex2i(x + width + bwidth + xoff, y + yoff);
+        glVertex2i(x + width + bwidth, y);
         glTexCoord2f(1, 1);
-        glVertex2i(x + width + bwidth + xoff,
-                   y + height + bwidth + yoff);
+        glVertex2i(x + width + bwidth,
+                   y + height + bwidth);
         glTexCoord2f(0, 1);
-        glVertex2i(x + xoff, y + height + bwidth + yoff);
-        glTexCoord2f(0, 0);
+        glVertex2i(x, y + height + bwidth);
         glEnd();
 
         glBindTexture(GL_TEXTURE_2D, 0);
     }
     else
         /* draw a solid rectangle */
-        glRecti(x + xoff, y + yoff,
-                x + width + bwidth - 1 + xoff, y + height + bwidth - 1 + yoff);
+        glRecti(x, y,
+                x + width + bwidth - 1, y + height + bwidth - 1);
 
     glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
     glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);