diff --git a/client.c b/client.c index be5616e1d..984b3c27d 100644 --- a/client.c +++ b/client.c @@ -750,8 +750,7 @@ client_unmanage(client_t *c) xcb_aux_sync(globalconf.connection); xcb_ungrab_server(globalconf.connection); - if(c->titlebar.sw) - simplewindow_delete(&c->titlebar.sw); + simplewindow_delete(&c->titlebar.sw); p_delete(&c); } diff --git a/common/swindow.c b/common/swindow.c index 7d5b847f5..6f39106eb 100644 --- a/common/swindow.c +++ b/common/swindow.c @@ -82,18 +82,6 @@ simplewindow_new(xcb_connection_t *conn, int phys_screen, int x, int y, return sw; } -/** Destroy a simple window and all its resources. - * \param sw The simple_window_t to delete. - */ -void -simplewindow_delete(simple_window_t **sw) -{ - xcb_destroy_window((*sw)->connection, (*sw)->window); - xcb_free_pixmap((*sw)->connection, (*sw)->drawable); - xcb_free_gc((*sw)->connection, (*sw)->gc); - p_delete(sw); -} - /** Move a simple window. * \param sw The simple window to move. * \param x New x coordinate. diff --git a/common/swindow.h b/common/swindow.h index 2c6c73b7c..ed6a3a062 100644 --- a/common/swindow.h +++ b/common/swindow.h @@ -44,7 +44,22 @@ typedef struct simple_window_t } simple_window_t; simple_window_t * simplewindow_new(xcb_connection_t *, int, int, int, unsigned int, unsigned int, unsigned int); -void simplewindow_delete(simple_window_t **); + +/** Destroy a simple window and all its resources. + * \param sw The simple_window_t to delete. + */ +static inline void +simplewindow_delete(simple_window_t **sw) +{ + if(*sw) + { + xcb_destroy_window((*sw)->connection, (*sw)->window); + xcb_free_pixmap((*sw)->connection, (*sw)->drawable); + xcb_free_gc((*sw)->connection, (*sw)->gc); + p_delete(sw); + } +} + void simplewindow_move(simple_window_t *, int, int); void simplewindow_resize(simple_window_t *, unsigned int, unsigned int);