diff --git a/ewmh.c b/ewmh.c index 12d308bb..52f362ca 100644 --- a/ewmh.c +++ b/ewmh.c @@ -506,6 +506,10 @@ ewmh_check_client_hints(client_t *c) p_delete(&reply); } +/** Get NET_WM_ICON. + * \param w The window. + * \return A netwm_icon_t structure which must be deleted after usage. + */ netwm_icon_t * ewmh_get_window_icon(xcb_window_t w) { diff --git a/ewmh.h b/ewmh.h index 7d36d619..78805166 100644 --- a/ewmh.h +++ b/ewmh.h @@ -31,6 +31,13 @@ typedef struct unsigned char *image; } netwm_icon_t; +static inline void +netwm_icon_delete(netwm_icon_t **i) +{ + p_delete(&(*i)->image); + p_delete(i); +} + void ewmh_init(int); void ewmh_update_net_client_list(int); void ewmh_update_net_numbers_of_desktop(int); diff --git a/widgets/tasklist.c b/widgets/tasklist.c index 9e5e4e5e..3086a284 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -219,8 +219,7 @@ tasklist_draw(draw_context_t *ctx, int screen, w->area.y, icon->width, icon->height, ctx->height, icon->image); - p_delete(&icon->image); - p_delete(&icon); + netwm_icon_delete(&icon); } } else