diff --git a/client.c b/client.c index 9a98c1b4b..c8c854727 100644 --- a/client.c +++ b/client.c @@ -273,6 +273,20 @@ client_stack_below(client_t *c, xcb_window_t previous) return c->win; } +/** Stacking layout layers */ +typedef enum +{ + LAYER_DESKTOP = 1, + LAYER_BELOW, + LAYER_TILE, + LAYER_FLOAT, + LAYER_ABOVE, + LAYER_FULLSCREEN, + LAYER_MODAL, + LAYER_ONTOP, + LAYER_OUTOFSPACE +} layer_t; + /** Get the real layer of a client according to its attribute (fullscreen, …) * \param c The client. * \return The real layer. diff --git a/client.h b/client.h index 9315e2f8b..cb18b1fd6 100644 --- a/client.h +++ b/client.h @@ -27,6 +27,18 @@ #include "structs.h" #include "stack.h" +static void +client_delete(client_t **c) +{ + button_array_wipe(&(*c)->buttons); + p_delete(&(*c)->icon_path); + p_delete(&(*c)->name); + p_delete(c); +} + +ARRAY_FUNCS(client_t *, client, DO_NOTHING) +DO_RCNT(client_t, client, client_delete) + #define client_need_arrange(c) \ do { \ if(!globalconf.screens[(c)->screen].need_arrange \ diff --git a/structs.h b/structs.h index 1aa2fb427..a50cff317 100644 --- a/structs.h +++ b/structs.h @@ -35,20 +35,6 @@ #include "common/xembed.h" #include "common/refcount.h" -/** Stacking layout layers */ -typedef enum -{ - LAYER_DESKTOP = 1, - LAYER_BELOW, - LAYER_TILE, - LAYER_FLOAT, - LAYER_ABOVE, - LAYER_FULLSCREEN, - LAYER_MODAL, - LAYER_ONTOP, - LAYER_OUTOFSPACE -} layer_t; - /** Windows type */ typedef enum { @@ -78,7 +64,7 @@ typedef struct widget_t widget_t; typedef struct widget_node_t widget_node_t; typedef struct client_t client_t; typedef struct client_node_t client_node_t; -typedef struct _tag_t tag_t; +typedef struct tag tag_t; typedef struct tag_client_node_t tag_client_node_t; typedef widget_t *(widget_constructor_t)(alignment_t); typedef void (widget_destructor_t)(widget_t *); @@ -129,7 +115,6 @@ struct button_t /** Lua function to execute on release. */ luaA_ref release; }; - DO_RCNT(button_t, button, p_delete) DO_ARRAY(button_t *, button, button_unref) @@ -166,29 +151,6 @@ struct widget_t bool isvisible; }; -/** Delete a widget structure. - * \param widget The widget to destroy. - */ -static inline void -widget_delete(widget_t **widget) -{ - if((*widget)->destructor) - (*widget)->destructor(*widget); - button_array_wipe(&(*widget)->buttons); - p_delete(&(*widget)->name); - p_delete(widget); -} - -DO_RCNT(widget_t, widget, widget_delete) - -struct widget_node_t -{ - /** The widget */ - widget_t *widget; - /** The area where the widget was drawn */ - area_t area; -}; - /* Strut */ typedef struct { @@ -273,18 +235,7 @@ struct client_t /** Next and previous clients */ client_t *prev, *next; }; - -static void -client_delete(client_t **c) -{ - button_array_wipe(&(*c)->buttons); - p_delete(&(*c)->icon_path); - p_delete(&(*c)->name); - p_delete(c); -} - -DO_ARRAY(client_t *, client, DO_NOTHING) -DO_RCNT(client_t, client, client_delete) +ARRAY_TYPE(client_t *, client) struct client_node_t { @@ -295,7 +246,7 @@ struct client_node_t }; /** Tag type */ -struct _tag_t +struct tag { /** Ref count */ int refcount; diff --git a/tag.h b/tag.h index 7e39ef4d7..4f04c085c 100644 --- a/tag.h +++ b/tag.h @@ -23,6 +23,7 @@ #define AWESOME_TAG_H #include "structs.h" +#include "client.h" #include "common/refcount.h" /** Check if a client is tiled */ diff --git a/widget.h b/widget.h index 0d1d03c08..966c9143a 100644 --- a/widget.h +++ b/widget.h @@ -26,6 +26,29 @@ #define WIDGET_CACHE_EMBEDDED (1<<3) +struct widget_node_t +{ + /** The widget */ + widget_t *widget; + /** The area where the widget was drawn */ + area_t area; +}; + +/** Delete a widget structure. + * \param widget The widget to destroy. + */ +static inline void +widget_delete(widget_t **widget) +{ + if((*widget)->destructor) + (*widget)->destructor(*widget); + button_array_wipe(&(*widget)->buttons); + p_delete(&(*widget)->name); + p_delete(widget); +} + +DO_RCNT(widget_t, widget, widget_delete) + void widget_invalidate_cache(int, int); int widget_calculate_offset(int, int, int, int); void widget_common_new(widget_t *);