destroywindow.c (486B)
1 /* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail> 2 * See LICENSE file for license details. 3 */ 4 #include "../x11.h" 5 6 void 7 cleanupwindow(Window *w) { 8 assert(w->type == WWindow); 9 sethandler(w, nil); 10 while(w->handler_link) 11 pophandler(w, w->handler_link->handler); 12 free(w->hints); 13 free(w->dnd); 14 if(w->xft) 15 xft->drawdestroy(w->xft); 16 if(w->gc) 17 XFreeGC(display, w->gc); 18 } 19 20 void 21 destroywindow(Window *w) { 22 cleanupwindow(w); 23 XDestroyWindow(display, w->xid); 24 free(w); 25 }