[swindow] Permit to delete NULL swindow

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-13 18:54:08 +02:00
parent e80e6a73c5
commit e5ed2f2f1c
3 changed files with 17 additions and 15 deletions

View File

@ -750,7 +750,6 @@ client_unmanage(client_t *c)
xcb_aux_sync(globalconf.connection);
xcb_ungrab_server(globalconf.connection);
if(c->titlebar.sw)
simplewindow_delete(&c->titlebar.sw);
p_delete(&c);

View File

@ -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.

View File

@ -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);