glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
-void remove_window(CompositedScreen *screen, Window w)
+void remove_window(Compositor *compositor, CompositedScreen *screen, Window w, int destroyed)
{
unsigned 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)
if(!screen)
return;
- remove_window(screen, event->window);
+ remove_window(compositor, screen, event->window, 1);
}
void process_map_event(Compositor *compositor, XMapEvent *event)
window->map_state = IsUnviewable;
}
+void process_reparent_event(Compositor *compositor, XReparentEvent *event)
+{
+ CompositedScreen *screen = find_screen_by_root(compositor, event->event);
+ if(!screen)
+ return;
+
+ if(event->parent==screen->root)
+ add_window(compositor, screen, event->window);
+ else
+ remove_window(compositor, screen, event->window, 0);
+}
+
void process_damage_event(Compositor *compositor, XDamageNotifyEvent *event)
{
CompositedScreen *screen = find_screen_by_window(compositor, event->drawable);
case UnmapNotify:
process_unmap_event(compositor, &event.xunmap);
break;
+ case ReparentNotify:
+ process_reparent_event(compositor, &event.xreparent);
+ break;
default:
if(event.type==compositor->damage_event+XDamageNotify)
process_damage_event(compositor, (XDamageNotifyEvent *)&event);