+void remove_window(Compositor *compositor, CompositedScreen *screen, Window w, int destroyed)
+{
+ unsigned i;
+
+ for(i=0; i<screen->nwindows; ++i)
+ if(screen->windows[i].window==w)
+ {
+ glDeleteTextures(1, &screen->windows[i].texture);
+ if(!destroyed)
+ {
+ XDamageDestroy(compositor->display, screen->windows[i].damage);
+ if(screen->windows[i].pixmap)
+ {
+ glXDestroyPixmap(compositor->display, screen->windows[i].glx_pixmap);
+ XFreePixmap(compositor->display, screen->windows[i].pixmap);
+ }
+ XCompositeUnredirectWindow(compositor->display, screen->windows[i].window, CompositeRedirectManual);
+ }
+
+ --screen->nwindows;
+ for(; i<screen->nwindows; ++i)
+ screen->windows[i] = screen->windows[i+1];
+ }
+}
+