structs: move some define out

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-10-21 17:33:16 +02:00
parent 569ea75409
commit d3ceff0282
5 changed files with 53 additions and 52 deletions

View File

@ -273,6 +273,20 @@ client_stack_below(client_t *c, xcb_window_t previous)
return c->win; 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, …) /** Get the real layer of a client according to its attribute (fullscreen, …)
* \param c The client. * \param c The client.
* \return The real layer. * \return The real layer.

View File

@ -27,6 +27,18 @@
#include "structs.h" #include "structs.h"
#include "stack.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) \ #define client_need_arrange(c) \
do { \ do { \
if(!globalconf.screens[(c)->screen].need_arrange \ if(!globalconf.screens[(c)->screen].need_arrange \

View File

@ -35,20 +35,6 @@
#include "common/xembed.h" #include "common/xembed.h"
#include "common/refcount.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 */ /** Windows type */
typedef enum typedef enum
{ {
@ -78,7 +64,7 @@ typedef struct widget_t widget_t;
typedef struct widget_node_t widget_node_t; typedef struct widget_node_t widget_node_t;
typedef struct client_t client_t; typedef struct client_t client_t;
typedef struct client_node_t client_node_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 struct tag_client_node_t tag_client_node_t;
typedef widget_t *(widget_constructor_t)(alignment_t); typedef widget_t *(widget_constructor_t)(alignment_t);
typedef void (widget_destructor_t)(widget_t *); typedef void (widget_destructor_t)(widget_t *);
@ -129,7 +115,6 @@ struct button_t
/** Lua function to execute on release. */ /** Lua function to execute on release. */
luaA_ref release; luaA_ref release;
}; };
DO_RCNT(button_t, button, p_delete) DO_RCNT(button_t, button, p_delete)
DO_ARRAY(button_t *, button, button_unref) DO_ARRAY(button_t *, button, button_unref)
@ -166,29 +151,6 @@ struct widget_t
bool isvisible; 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 */ /* Strut */
typedef struct typedef struct
{ {
@ -273,18 +235,7 @@ struct client_t
/** Next and previous clients */ /** Next and previous clients */
client_t *prev, *next; client_t *prev, *next;
}; };
ARRAY_TYPE(client_t *, client)
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)
struct client_node_t struct client_node_t
{ {
@ -295,7 +246,7 @@ struct client_node_t
}; };
/** Tag type */ /** Tag type */
struct _tag_t struct tag
{ {
/** Ref count */ /** Ref count */
int refcount; int refcount;

1
tag.h
View File

@ -23,6 +23,7 @@
#define AWESOME_TAG_H #define AWESOME_TAG_H
#include "structs.h" #include "structs.h"
#include "client.h"
#include "common/refcount.h" #include "common/refcount.h"
/** Check if a client is tiled */ /** Check if a client is tiled */

View File

@ -26,6 +26,29 @@
#define WIDGET_CACHE_EMBEDDED (1<<3) #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); void widget_invalidate_cache(int, int);
int widget_calculate_offset(int, int, int, int); int widget_calculate_offset(int, int, int, int);
void widget_common_new(widget_t *); void widget_common_new(widget_t *);