[swindow] Permit to delete NULL swindow
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
e80e6a73c5
commit
e5ed2f2f1c
3
client.c
3
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);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue