clang-format-3.5 **/*.h **/*.c
This should be the last commit that formats a big bunch of files. From here on, whenever I merge patches, I’ll run clang-format like described in the title.
This commit is contained in:
@ -24,7 +24,7 @@ const char *DEFAULT_BINDING_MODE;
|
||||
*
|
||||
*/
|
||||
Binding *configure_binding(const char *bindtype, const char *modifiers, const char *input_code,
|
||||
const char *release, const char *command, const char *mode);
|
||||
const char *release, const char *command, const char *mode);
|
||||
|
||||
/**
|
||||
* Grab the bound keys (tell X to send us keypress events for those keycodes)
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
Con *con_new_skeleton(Con *parent, i3Window *window);
|
||||
|
||||
|
||||
/* A wrapper for con_new_skeleton, to retain the old con_new behaviour
|
||||
*
|
||||
*/
|
||||
|
@ -241,10 +241,13 @@ struct Barconfig {
|
||||
char *socket_path;
|
||||
|
||||
/** Bar display mode (hide unless modifier is pressed or show in dock mode or always hide in invisible mode) */
|
||||
enum { M_DOCK = 0, M_HIDE = 1, M_INVISIBLE = 2 } mode;
|
||||
enum { M_DOCK = 0,
|
||||
M_HIDE = 1,
|
||||
M_INVISIBLE = 2 } mode;
|
||||
|
||||
/* The current hidden_state of the bar, which indicates whether it is hidden or shown */
|
||||
enum { S_HIDE = 0, S_SHOW = 1 } hidden_state;
|
||||
enum { S_HIDE = 0,
|
||||
S_SHOW = 1 } hidden_state;
|
||||
|
||||
/** Bar modifier (to show bar when in hide mode). */
|
||||
enum {
|
||||
@ -259,7 +262,8 @@ struct Barconfig {
|
||||
} modifier;
|
||||
|
||||
/** Bar position (bottom by default). */
|
||||
enum { P_BOTTOM = 0, P_TOP = 1 } position;
|
||||
enum { P_BOTTOM = 0,
|
||||
P_TOP = 1 } position;
|
||||
|
||||
/** Command that should be run to execute i3bar, give a full path if i3bar is not
|
||||
* in your $PATH.
|
||||
|
@ -24,7 +24,7 @@ uint32_t modifiers_from_str(const char *str);
|
||||
* using 'call cfg_foo()' in parser-specs/.*.spec. Useful so that we don’t need
|
||||
* to repeat the definition all the time. */
|
||||
#define CFGFUN(name, ...) \
|
||||
void cfg_ ## name (I3_CFG, ## __VA_ARGS__ )
|
||||
void cfg_##name(I3_CFG, ##__VA_ARGS__)
|
||||
|
||||
/* The following functions are called by the config parser, see
|
||||
* parser-specs/config.spec. They get the parsed parameters and store them in
|
||||
|
@ -47,34 +47,42 @@ typedef struct Match Match;
|
||||
typedef struct Assignment Assignment;
|
||||
typedef struct Window i3Window;
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Helper types
|
||||
*****************************************************************************/
|
||||
typedef enum { D_LEFT, D_RIGHT, D_UP, D_DOWN } direction_t;
|
||||
typedef enum { NO_ORIENTATION = 0, HORIZ, VERT } orientation_t;
|
||||
typedef enum { BS_NORMAL = 0, BS_NONE = 1, BS_PIXEL = 2 } border_style_t;
|
||||
typedef enum { D_LEFT,
|
||||
D_RIGHT,
|
||||
D_UP,
|
||||
D_DOWN } direction_t;
|
||||
typedef enum { NO_ORIENTATION = 0,
|
||||
HORIZ,
|
||||
VERT } orientation_t;
|
||||
typedef enum { BS_NORMAL = 0,
|
||||
BS_NONE = 1,
|
||||
BS_PIXEL = 2 } border_style_t;
|
||||
|
||||
/** parameter to specify whether tree_close() and x_window_kill() should kill
|
||||
* only this specific window or the whole X11 client */
|
||||
typedef enum { DONT_KILL_WINDOW = 0, KILL_WINDOW = 1, KILL_CLIENT = 2 } kill_window_t;
|
||||
typedef enum { DONT_KILL_WINDOW = 0,
|
||||
KILL_WINDOW = 1,
|
||||
KILL_CLIENT = 2 } kill_window_t;
|
||||
|
||||
/** describes if the window is adjacent to the output (physical screen) edges. */
|
||||
typedef enum { ADJ_NONE = 0,
|
||||
ADJ_LEFT_SCREEN_EDGE = (1 << 0),
|
||||
ADJ_RIGHT_SCREEN_EDGE = (1 << 1),
|
||||
ADJ_UPPER_SCREEN_EDGE = (1 << 2),
|
||||
ADJ_LOWER_SCREEN_EDGE = (1 << 4)} adjacent_t;
|
||||
ADJ_LOWER_SCREEN_EDGE = (1 << 4) } adjacent_t;
|
||||
|
||||
enum {
|
||||
BIND_NONE = 0,
|
||||
BIND_SHIFT = XCB_MOD_MASK_SHIFT, /* (1 << 0) */
|
||||
BIND_CONTROL = XCB_MOD_MASK_CONTROL, /* (1 << 2) */
|
||||
BIND_MOD1 = XCB_MOD_MASK_1, /* (1 << 3) */
|
||||
BIND_MOD2 = XCB_MOD_MASK_2, /* (1 << 4) */
|
||||
BIND_MOD3 = XCB_MOD_MASK_3, /* (1 << 5) */
|
||||
BIND_MOD4 = XCB_MOD_MASK_4, /* (1 << 6) */
|
||||
BIND_MOD5 = XCB_MOD_MASK_5, /* (1 << 7) */
|
||||
BIND_SHIFT = XCB_MOD_MASK_SHIFT, /* (1 << 0) */
|
||||
BIND_CONTROL = XCB_MOD_MASK_CONTROL, /* (1 << 2) */
|
||||
BIND_MOD1 = XCB_MOD_MASK_1, /* (1 << 3) */
|
||||
BIND_MOD2 = XCB_MOD_MASK_2, /* (1 << 4) */
|
||||
BIND_MOD3 = XCB_MOD_MASK_3, /* (1 << 5) */
|
||||
BIND_MOD4 = XCB_MOD_MASK_4, /* (1 << 6) */
|
||||
BIND_MOD5 = XCB_MOD_MASK_5, /* (1 << 7) */
|
||||
BIND_MODE_SWITCH = (1 << 8)
|
||||
};
|
||||
|
||||
@ -267,7 +275,6 @@ struct Binding {
|
||||
* This is an array of number_keycodes size. */
|
||||
xcb_keycode_t *translated_to;
|
||||
|
||||
|
||||
/** Command, like in command mode */
|
||||
char *command;
|
||||
|
||||
@ -367,7 +374,9 @@ struct Window {
|
||||
bool doesnt_accept_focus;
|
||||
|
||||
/** Whether the window says it is a dock window */
|
||||
enum { W_NODOCK = 0, W_DOCK_TOP = 1, W_DOCK_BOTTOM = 2 } dock;
|
||||
enum { W_NODOCK = 0,
|
||||
W_DOCK_TOP = 1,
|
||||
W_DOCK_BOTTOM = 2 } dock;
|
||||
|
||||
/** When this window was marked urgent. 0 means not urgent */
|
||||
struct timeval urgent;
|
||||
@ -407,7 +416,9 @@ struct Match {
|
||||
M_DOCK_BOTTOM = 3
|
||||
} dock;
|
||||
xcb_window_t id;
|
||||
enum { M_ANY = 0, M_TILING, M_FLOATING } floating;
|
||||
enum { M_ANY = 0,
|
||||
M_TILING,
|
||||
M_FLOATING } floating;
|
||||
Con *con_id;
|
||||
|
||||
/* Where the window looking for a match should be inserted:
|
||||
@ -419,7 +430,9 @@ struct Match {
|
||||
* (dockareas)
|
||||
*
|
||||
*/
|
||||
enum { M_HERE = 0, M_ASSIGN_WS, M_BELOW } insert_where;
|
||||
enum { M_HERE = 0,
|
||||
M_ASSIGN_WS,
|
||||
M_BELOW } insert_where;
|
||||
|
||||
TAILQ_ENTRY(Match) matches;
|
||||
|
||||
@ -450,10 +463,10 @@ struct Assignment {
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
A_ANY = 0,
|
||||
A_COMMAND = (1 << 0),
|
||||
A_ANY = 0,
|
||||
A_COMMAND = (1 << 0),
|
||||
A_TO_WORKSPACE = (1 << 1),
|
||||
A_TO_OUTPUT = (1 << 2)
|
||||
A_TO_OUTPUT = (1 << 2)
|
||||
} type;
|
||||
|
||||
/** the criteria to check if a window matches */
|
||||
@ -470,7 +483,9 @@ struct Assignment {
|
||||
};
|
||||
|
||||
/** Fullscreen modes. Used by Con.fullscreen_mode. */
|
||||
typedef enum { CF_NONE = 0, CF_OUTPUT = 1, CF_GLOBAL = 2 } fullscreen_mode_t;
|
||||
typedef enum { CF_NONE = 0,
|
||||
CF_OUTPUT = 1,
|
||||
CF_GLOBAL = 2 } fullscreen_mode_t;
|
||||
|
||||
/**
|
||||
* A 'Con' represents everything from the X11 root window down to a single X11 window.
|
||||
@ -596,7 +611,7 @@ struct Con {
|
||||
TAILQ_ENTRY(Con) floating_windows;
|
||||
|
||||
/** callbacks */
|
||||
void(*on_remove_child)(Con *);
|
||||
void (*on_remove_child)(Con *);
|
||||
|
||||
enum {
|
||||
/* Not a scratchpad window. */
|
||||
|
@ -12,18 +12,18 @@
|
||||
#include "tree.h"
|
||||
|
||||
/** Callback for dragging */
|
||||
typedef void(*callback_t)(Con*, Rect*, uint32_t, uint32_t, const void*);
|
||||
typedef void (*callback_t)(Con *, Rect *, uint32_t, uint32_t, const void *);
|
||||
|
||||
/** Macro to create a callback function for dragging */
|
||||
#define DRAGGING_CB(name) \
|
||||
static void name(Con *con, Rect *old_rect, uint32_t new_x, \
|
||||
uint32_t new_y, const void *extra)
|
||||
#define DRAGGING_CB(name) \
|
||||
static void name(Con *con, Rect *old_rect, uint32_t new_x, \
|
||||
uint32_t new_y, const void *extra)
|
||||
|
||||
/** On which border was the dragging initiated? */
|
||||
typedef enum { BORDER_LEFT = (1 << 0),
|
||||
BORDER_RIGHT = (1 << 1),
|
||||
BORDER_TOP = (1 << 2),
|
||||
BORDER_BOTTOM = (1 << 3)} border_t;
|
||||
typedef enum { BORDER_LEFT = (1 << 0),
|
||||
BORDER_RIGHT = (1 << 1),
|
||||
BORDER_TOP = (1 << 2),
|
||||
BORDER_BOTTOM = (1 << 3) } border_t;
|
||||
|
||||
/**
|
||||
* Enables floating mode for the given container by detaching it from its
|
||||
@ -164,8 +164,8 @@ typedef enum {
|
||||
*
|
||||
*/
|
||||
drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event,
|
||||
xcb_window_t confine_to, border_t border, int cursor,
|
||||
callback_t callback, const void *extra);
|
||||
xcb_window_t confine_to, border_t border, int cursor,
|
||||
callback_t callback, const void *extra);
|
||||
|
||||
/**
|
||||
* Repositions the CT_FLOATING_CON to have the coordinates specified by
|
||||
|
@ -42,7 +42,7 @@ extern xcb_key_symbols_t *keysyms;
|
||||
extern char **start_argv;
|
||||
extern Display *xlibdpy, *xkbdpy;
|
||||
extern int xkb_current_group;
|
||||
extern TAILQ_HEAD(bindings_head, Binding) *bindings;
|
||||
extern TAILQ_HEAD(bindings_head, Binding) * bindings;
|
||||
extern TAILQ_HEAD(autostarts_head, Autostart) autostarts;
|
||||
extern TAILQ_HEAD(autostarts_always_head, Autostart) autostarts_always;
|
||||
extern TAILQ_HEAD(ws_assignments_head, Workspace_Assignment) ws_assignments;
|
||||
|
@ -17,7 +17,7 @@ typedef struct i3_ipc_header {
|
||||
char magic[6];
|
||||
uint32_t size;
|
||||
uint32_t type;
|
||||
} __attribute__ ((packed)) i3_ipc_header_t;
|
||||
} __attribute__((packed)) i3_ipc_header_t;
|
||||
|
||||
/*
|
||||
* Messages from clients to i3
|
||||
@ -25,31 +25,31 @@ typedef struct i3_ipc_header {
|
||||
*/
|
||||
|
||||
/** Never change this, only on major IPC breakage (don’t do that) */
|
||||
#define I3_IPC_MAGIC "i3-ipc"
|
||||
#define I3_IPC_MAGIC "i3-ipc"
|
||||
|
||||
/** The payload of the message will be interpreted as a command */
|
||||
#define I3_IPC_MESSAGE_TYPE_COMMAND 0
|
||||
#define I3_IPC_MESSAGE_TYPE_COMMAND 0
|
||||
|
||||
/** Requests the current workspaces from i3 */
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_WORKSPACES 1
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_WORKSPACES 1
|
||||
|
||||
/** Subscribe to the specified events */
|
||||
#define I3_IPC_MESSAGE_TYPE_SUBSCRIBE 2
|
||||
#define I3_IPC_MESSAGE_TYPE_SUBSCRIBE 2
|
||||
|
||||
/** Requests the current outputs from i3 */
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_OUTPUTS 3
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_OUTPUTS 3
|
||||
|
||||
/** Requests the tree layout from i3 */
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_TREE 4
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_TREE 4
|
||||
|
||||
/** Request the current defined marks from i3 */
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_MARKS 5
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_MARKS 5
|
||||
|
||||
/** Request the configuration for a specific 'bar' */
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_BAR_CONFIG 6
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_BAR_CONFIG 6
|
||||
|
||||
/** Request the i3 version */
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_VERSION 7
|
||||
#define I3_IPC_MESSAGE_TYPE_GET_VERSION 7
|
||||
|
||||
/*
|
||||
* Messages from i3 to clients
|
||||
@ -57,46 +57,46 @@ typedef struct i3_ipc_header {
|
||||
*/
|
||||
|
||||
/** Command reply type */
|
||||
#define I3_IPC_REPLY_TYPE_COMMAND 0
|
||||
#define I3_IPC_REPLY_TYPE_COMMAND 0
|
||||
|
||||
/** Workspaces reply type */
|
||||
#define I3_IPC_REPLY_TYPE_WORKSPACES 1
|
||||
#define I3_IPC_REPLY_TYPE_WORKSPACES 1
|
||||
|
||||
/** Subscription reply type */
|
||||
#define I3_IPC_REPLY_TYPE_SUBSCRIBE 2
|
||||
#define I3_IPC_REPLY_TYPE_SUBSCRIBE 2
|
||||
|
||||
/** Outputs reply type */
|
||||
#define I3_IPC_REPLY_TYPE_OUTPUTS 3
|
||||
#define I3_IPC_REPLY_TYPE_OUTPUTS 3
|
||||
|
||||
/** Tree reply type */
|
||||
#define I3_IPC_REPLY_TYPE_TREE 4
|
||||
#define I3_IPC_REPLY_TYPE_TREE 4
|
||||
|
||||
/** Marks reply type */
|
||||
#define I3_IPC_REPLY_TYPE_MARKS 5
|
||||
#define I3_IPC_REPLY_TYPE_MARKS 5
|
||||
|
||||
/** Bar config reply type */
|
||||
#define I3_IPC_REPLY_TYPE_BAR_CONFIG 6
|
||||
#define I3_IPC_REPLY_TYPE_BAR_CONFIG 6
|
||||
|
||||
/** i3 version reply type */
|
||||
#define I3_IPC_REPLY_TYPE_VERSION 7
|
||||
#define I3_IPC_REPLY_TYPE_VERSION 7
|
||||
|
||||
/*
|
||||
* Events from i3 to clients. Events have the first bit set high.
|
||||
*
|
||||
*/
|
||||
#define I3_IPC_EVENT_MASK (1 << 31)
|
||||
#define I3_IPC_EVENT_MASK (1 << 31)
|
||||
|
||||
/* The workspace event will be triggered upon changes in the workspace list */
|
||||
#define I3_IPC_EVENT_WORKSPACE (I3_IPC_EVENT_MASK | 0)
|
||||
#define I3_IPC_EVENT_WORKSPACE (I3_IPC_EVENT_MASK | 0)
|
||||
|
||||
/* The output event will be triggered upon changes in the output list */
|
||||
#define I3_IPC_EVENT_OUTPUT (I3_IPC_EVENT_MASK | 1)
|
||||
#define I3_IPC_EVENT_OUTPUT (I3_IPC_EVENT_MASK | 1)
|
||||
|
||||
/* The output event will be triggered upon mode changes */
|
||||
#define I3_IPC_EVENT_MODE (I3_IPC_EVENT_MASK | 2)
|
||||
#define I3_IPC_EVENT_MODE (I3_IPC_EVENT_MASK | 2)
|
||||
|
||||
/* The window event will be triggered upon window changes */
|
||||
#define I3_IPC_EVENT_WINDOW (I3_IPC_EVENT_MASK | 3)
|
||||
#define I3_IPC_EVENT_WINDOW (I3_IPC_EVENT_MASK | 3)
|
||||
|
||||
/** Bar config update will be triggered to update the bar config */
|
||||
#define I3_IPC_EVENT_BARCONFIG_UPDATE (I3_IPC_EVENT_MASK | 4)
|
||||
#define I3_IPC_EVENT_BARCONFIG_UPDATE (I3_IPC_EVENT_MASK | 4)
|
||||
|
@ -23,13 +23,13 @@
|
||||
extern char *current_socketpath;
|
||||
|
||||
typedef struct ipc_client {
|
||||
int fd;
|
||||
int fd;
|
||||
|
||||
/* The events which this client wants to receive */
|
||||
int num_events;
|
||||
char **events;
|
||||
/* The events which this client wants to receive */
|
||||
int num_events;
|
||||
char **events;
|
||||
|
||||
TAILQ_ENTRY(ipc_client) clients;
|
||||
TAILQ_ENTRY(ipc_client) clients;
|
||||
} ipc_client;
|
||||
|
||||
/*
|
||||
@ -42,13 +42,13 @@ typedef struct ipc_client {
|
||||
* message_type is the type of the message as the sender specified it.
|
||||
*
|
||||
*/
|
||||
typedef void(*handler_t)(int, uint8_t*, int, uint32_t, uint32_t);
|
||||
typedef void (*handler_t)(int, uint8_t *, int, uint32_t, uint32_t);
|
||||
|
||||
/* Macro to declare a callback */
|
||||
#define IPC_HANDLER(name) \
|
||||
static void handle_ ## name (int fd, uint8_t *message, \
|
||||
int size, uint32_t message_size, \
|
||||
uint32_t message_type)
|
||||
#define IPC_HANDLER(name) \
|
||||
static void handle_##name(int fd, uint8_t *message, \
|
||||
int size, uint32_t message_size, \
|
||||
uint32_t message_type)
|
||||
|
||||
/**
|
||||
* Handler for activity on the listening socket, meaning that a new client
|
||||
|
@ -72,17 +72,17 @@ struct Font {
|
||||
* infrastructure, we define a fallback. */
|
||||
#if !defined(LOG)
|
||||
void verboselog(char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
#define LOG(fmt, ...) verboselog("[libi3] " __FILE__ " " fmt, ##__VA_ARGS__)
|
||||
#endif
|
||||
#if !defined(ELOG)
|
||||
void errorlog(char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
#define ELOG(fmt, ...) errorlog("[libi3] ERROR: " fmt, ##__VA_ARGS__)
|
||||
#endif
|
||||
#if !defined(DLOG)
|
||||
void debuglog(char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
#define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, I3__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
@ -167,13 +167,13 @@ void i3string_free(i3String *str);
|
||||
* to prevent accidentally using freed memory.
|
||||
*
|
||||
*/
|
||||
#define I3STRING_FREE(str) \
|
||||
do { \
|
||||
if (str != NULL) { \
|
||||
i3string_free(str); \
|
||||
str = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
#define I3STRING_FREE(str) \
|
||||
do { \
|
||||
if (str != NULL) { \
|
||||
i3string_free(str); \
|
||||
str = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Returns the UTF-8 encoded version of the i3String.
|
||||
@ -285,8 +285,8 @@ uint32_t aio_get_mod_mask_for(uint32_t keysym, xcb_key_symbols_t *symbols);
|
||||
*
|
||||
*/
|
||||
uint32_t get_mod_mask_for(uint32_t keysym,
|
||||
xcb_key_symbols_t *symbols,
|
||||
xcb_get_modifier_mapping_reply_t *modmap_reply);
|
||||
xcb_key_symbols_t *symbols,
|
||||
xcb_get_modifier_mapping_reply_t *modmap_reply);
|
||||
|
||||
/**
|
||||
* Loads a font for usage, also getting its height. If fallback is true,
|
||||
@ -338,14 +338,14 @@ void set_font_colors(xcb_gcontext_t gc, uint32_t foreground, uint32_t background
|
||||
*
|
||||
*/
|
||||
void draw_text(i3String *text, xcb_drawable_t drawable,
|
||||
xcb_gcontext_t gc, int x, int y, int max_width);
|
||||
xcb_gcontext_t gc, int x, int y, int max_width);
|
||||
|
||||
/**
|
||||
* ASCII version of draw_text to print static strings.
|
||||
*
|
||||
*/
|
||||
void draw_text_ascii(const char *text, xcb_drawable_t drawable,
|
||||
xcb_gcontext_t gc, int x, int y, int max_width);
|
||||
xcb_gcontext_t gc, int x, int y, int max_width);
|
||||
|
||||
/**
|
||||
* Predict the text width in pixels for the given text. Text must be
|
||||
|
@ -78,14 +78,14 @@ void set_verbosity(bool _verbose);
|
||||
*
|
||||
*/
|
||||
void debuglog(char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
|
||||
/**
|
||||
* Logs the given message to stdout while prefixing the current time to it.
|
||||
*
|
||||
*/
|
||||
void errorlog(char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
|
||||
/**
|
||||
* Logs the given message to stdout while prefixing the current time to it,
|
||||
@ -93,7 +93,7 @@ void errorlog(char *fmt, ...)
|
||||
*
|
||||
*/
|
||||
void verboselog(char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
|
||||
/**
|
||||
* Deletes the unused log files. Useful if i3 exits immediately, eg.
|
||||
|
704
include/queue.h
704
include/queue.h
@ -90,448 +90,468 @@
|
||||
/*
|
||||
* Singly-linked List definitions.
|
||||
*/
|
||||
#define SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
#define SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
#define SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked List access methods.
|
||||
*/
|
||||
#define SLIST_FIRST(head) ((head)->slh_first)
|
||||
#define SLIST_END(head) NULL
|
||||
#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
|
||||
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
#define SLIST_FIRST(head) ((head)->slh_first)
|
||||
#define SLIST_END(head) NULL
|
||||
#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
|
||||
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
|
||||
#define SLIST_FOREACH(var, head, field) \
|
||||
for((var) = SLIST_FIRST(head); \
|
||||
(var) != SLIST_END(head); \
|
||||
(var) = SLIST_NEXT(var, field))
|
||||
#define SLIST_FOREACH(var, head, field) \
|
||||
for ((var) = SLIST_FIRST(head); \
|
||||
(var) != SLIST_END(head); \
|
||||
(var) = SLIST_NEXT(var, field))
|
||||
|
||||
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
|
||||
for ((varp) = &SLIST_FIRST((head)); \
|
||||
((var) = *(varp)) != SLIST_END(head); \
|
||||
(varp) = &SLIST_NEXT((var), field))
|
||||
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
|
||||
for ((varp) = &SLIST_FIRST((head)); \
|
||||
((var) = *(varp)) != SLIST_END(head); \
|
||||
(varp) = &SLIST_NEXT((var), field))
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
#define SLIST_INIT(head) { \
|
||||
SLIST_FIRST(head) = SLIST_END(head); \
|
||||
}
|
||||
#define SLIST_INIT(head) \
|
||||
{ \
|
||||
SLIST_FIRST(head) = SLIST_END(head); \
|
||||
}
|
||||
|
||||
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
|
||||
(elm)->field.sle_next = (slistelm)->field.sle_next; \
|
||||
(slistelm)->field.sle_next = (elm); \
|
||||
} while (0)
|
||||
#define SLIST_INSERT_AFTER(slistelm, elm, field) \
|
||||
do { \
|
||||
(elm)->field.sle_next = (slistelm)->field.sle_next; \
|
||||
(slistelm)->field.sle_next = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (head)->slh_first; \
|
||||
(head)->slh_first = (elm); \
|
||||
} while (0)
|
||||
#define SLIST_INSERT_HEAD(head, elm, field) \
|
||||
do { \
|
||||
(elm)->field.sle_next = (head)->slh_first; \
|
||||
(head)->slh_first = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_NEXT(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
|
||||
} while (0)
|
||||
#define SLIST_REMOVE_NEXT(head, elm, field) \
|
||||
do { \
|
||||
(elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_HEAD(head, field) do { \
|
||||
(head)->slh_first = (head)->slh_first->field.sle_next; \
|
||||
} while (0)
|
||||
#define SLIST_REMOVE_HEAD(head, field) \
|
||||
do { \
|
||||
(head)->slh_first = (head)->slh_first->field.sle_next; \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->slh_first == (elm)) { \
|
||||
SLIST_REMOVE_HEAD((head), field); \
|
||||
} else { \
|
||||
struct type *curelm = (head)->slh_first; \
|
||||
\
|
||||
while (curelm->field.sle_next != (elm)) \
|
||||
curelm = curelm->field.sle_next; \
|
||||
curelm->field.sle_next = \
|
||||
curelm->field.sle_next->field.sle_next; \
|
||||
_Q_INVALIDATE((elm)->field.sle_next); \
|
||||
} \
|
||||
} while (0)
|
||||
#define SLIST_REMOVE(head, elm, type, field) \
|
||||
do { \
|
||||
if ((head)->slh_first == (elm)) { \
|
||||
SLIST_REMOVE_HEAD((head), field); \
|
||||
} else { \
|
||||
struct type *curelm = (head)->slh_first; \
|
||||
\
|
||||
while (curelm->field.sle_next != (elm)) \
|
||||
curelm = curelm->field.sle_next; \
|
||||
curelm->field.sle_next = curelm->field.sle_next->field.sle_next; \
|
||||
_Q_INVALIDATE((elm)->field.sle_next); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* List definitions.
|
||||
*/
|
||||
#define LIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *lh_first; /* first element */ \
|
||||
}
|
||||
#define LIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *lh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define LIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
#define LIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define LIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *le_next; /* next element */ \
|
||||
struct type **le_prev; /* address of previous next element */ \
|
||||
}
|
||||
#define LIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *le_next; /* next element */ \
|
||||
struct type **le_prev; /* address of previous next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* List access methods
|
||||
*/
|
||||
#define LIST_FIRST(head) ((head)->lh_first)
|
||||
#define LIST_END(head) NULL
|
||||
#define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
|
||||
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
|
||||
#define LIST_FIRST(head) ((head)->lh_first)
|
||||
#define LIST_END(head) NULL
|
||||
#define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
|
||||
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
|
||||
|
||||
#define LIST_FOREACH(var, head, field) \
|
||||
for((var) = LIST_FIRST(head); \
|
||||
(var)!= LIST_END(head); \
|
||||
(var) = LIST_NEXT(var, field))
|
||||
#define LIST_FOREACH(var, head, field) \
|
||||
for ((var) = LIST_FIRST(head); \
|
||||
(var) != LIST_END(head); \
|
||||
(var) = LIST_NEXT(var, field))
|
||||
|
||||
/*
|
||||
* List functions.
|
||||
*/
|
||||
#define LIST_INIT(head) do { \
|
||||
LIST_FIRST(head) = LIST_END(head); \
|
||||
} while (0)
|
||||
#define LIST_INIT(head) \
|
||||
do { \
|
||||
LIST_FIRST(head) = LIST_END(head); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
|
||||
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
|
||||
(listelm)->field.le_next->field.le_prev = \
|
||||
&(elm)->field.le_next; \
|
||||
(listelm)->field.le_next = (elm); \
|
||||
(elm)->field.le_prev = &(listelm)->field.le_next; \
|
||||
} while (0)
|
||||
#define LIST_INSERT_AFTER(listelm, elm, field) \
|
||||
do { \
|
||||
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
|
||||
(listelm)->field.le_next->field.le_prev = &(elm)->field.le_next; \
|
||||
(listelm)->field.le_next = (elm); \
|
||||
(elm)->field.le_prev = &(listelm)->field.le_next; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
(elm)->field.le_prev = (listelm)->field.le_prev; \
|
||||
(elm)->field.le_next = (listelm); \
|
||||
*(listelm)->field.le_prev = (elm); \
|
||||
(listelm)->field.le_prev = &(elm)->field.le_next; \
|
||||
} while (0)
|
||||
#define LIST_INSERT_BEFORE(listelm, elm, field) \
|
||||
do { \
|
||||
(elm)->field.le_prev = (listelm)->field.le_prev; \
|
||||
(elm)->field.le_next = (listelm); \
|
||||
*(listelm)->field.le_prev = (elm); \
|
||||
(listelm)->field.le_prev = &(elm)->field.le_next; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
|
||||
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
|
||||
(head)->lh_first = (elm); \
|
||||
(elm)->field.le_prev = &(head)->lh_first; \
|
||||
} while (0)
|
||||
#define LIST_INSERT_HEAD(head, elm, field) \
|
||||
do { \
|
||||
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
|
||||
(head)->lh_first->field.le_prev = &(elm)->field.le_next; \
|
||||
(head)->lh_first = (elm); \
|
||||
(elm)->field.le_prev = &(head)->lh_first; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_REMOVE(elm, field) do { \
|
||||
if ((elm)->field.le_next != NULL) \
|
||||
(elm)->field.le_next->field.le_prev = \
|
||||
(elm)->field.le_prev; \
|
||||
*(elm)->field.le_prev = (elm)->field.le_next; \
|
||||
_Q_INVALIDATE((elm)->field.le_prev); \
|
||||
_Q_INVALIDATE((elm)->field.le_next); \
|
||||
} while (0)
|
||||
#define LIST_REMOVE(elm, field) \
|
||||
do { \
|
||||
if ((elm)->field.le_next != NULL) \
|
||||
(elm)->field.le_next->field.le_prev = (elm)->field.le_prev; \
|
||||
*(elm)->field.le_prev = (elm)->field.le_next; \
|
||||
_Q_INVALIDATE((elm)->field.le_prev); \
|
||||
_Q_INVALIDATE((elm)->field.le_next); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_REPLACE(elm, elm2, field) do { \
|
||||
if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
|
||||
(elm2)->field.le_next->field.le_prev = \
|
||||
&(elm2)->field.le_next; \
|
||||
(elm2)->field.le_prev = (elm)->field.le_prev; \
|
||||
*(elm2)->field.le_prev = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.le_prev); \
|
||||
_Q_INVALIDATE((elm)->field.le_next); \
|
||||
} while (0)
|
||||
#define LIST_REPLACE(elm, elm2, field) \
|
||||
do { \
|
||||
if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
|
||||
(elm2)->field.le_next->field.le_prev = &(elm2)->field.le_next; \
|
||||
(elm2)->field.le_prev = (elm)->field.le_prev; \
|
||||
*(elm2)->field.le_prev = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.le_prev); \
|
||||
_Q_INVALIDATE((elm)->field.le_next); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Simple queue definitions.
|
||||
*/
|
||||
#define SIMPLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *sqh_first; /* first element */ \
|
||||
struct type **sqh_last; /* addr of last next element */ \
|
||||
}
|
||||
#define SIMPLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *sqh_first; /* first element */ \
|
||||
struct type **sqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define SIMPLEQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).sqh_first }
|
||||
#define SIMPLEQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).sqh_first }
|
||||
|
||||
#define SIMPLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sqe_next; /* next element */ \
|
||||
}
|
||||
#define SIMPLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sqe_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Simple queue access methods.
|
||||
*/
|
||||
#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
|
||||
#define SIMPLEQ_END(head) NULL
|
||||
#define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
|
||||
#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
|
||||
#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
|
||||
#define SIMPLEQ_END(head) NULL
|
||||
#define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
|
||||
#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
|
||||
|
||||
#define SIMPLEQ_FOREACH(var, head, field) \
|
||||
for((var) = SIMPLEQ_FIRST(head); \
|
||||
(var) != SIMPLEQ_END(head); \
|
||||
(var) = SIMPLEQ_NEXT(var, field))
|
||||
#define SIMPLEQ_FOREACH(var, head, field) \
|
||||
for ((var) = SIMPLEQ_FIRST(head); \
|
||||
(var) != SIMPLEQ_END(head); \
|
||||
(var) = SIMPLEQ_NEXT(var, field))
|
||||
|
||||
/*
|
||||
* Simple queue functions.
|
||||
*/
|
||||
#define SIMPLEQ_INIT(head) do { \
|
||||
(head)->sqh_first = NULL; \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (0)
|
||||
#define SIMPLEQ_INIT(head) \
|
||||
do { \
|
||||
(head)->sqh_first = NULL; \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(head)->sqh_first = (elm); \
|
||||
} while (0)
|
||||
#define SIMPLEQ_INSERT_HEAD(head, elm, field) \
|
||||
do { \
|
||||
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(head)->sqh_first = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.sqe_next = NULL; \
|
||||
*(head)->sqh_last = (elm); \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
} while (0)
|
||||
#define SIMPLEQ_INSERT_TAIL(head, elm, field) \
|
||||
do { \
|
||||
(elm)->field.sqe_next = NULL; \
|
||||
*(head)->sqh_last = (elm); \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(listelm)->field.sqe_next = (elm); \
|
||||
} while (0)
|
||||
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) \
|
||||
do { \
|
||||
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL) \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(listelm)->field.sqe_next = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
|
||||
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (0)
|
||||
#define SIMPLEQ_REMOVE_HEAD(head, field) \
|
||||
do { \
|
||||
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Tail queue definitions.
|
||||
*/
|
||||
#define TAILQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *tqh_first; /* first element */ \
|
||||
struct type **tqh_last; /* addr of last next element */ \
|
||||
}
|
||||
#define TAILQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *tqh_first; /* first element */ \
|
||||
struct type **tqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define TAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).tqh_first }
|
||||
#define TAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).tqh_first }
|
||||
|
||||
#define TAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *tqe_next; /* next element */ \
|
||||
struct type **tqe_prev; /* address of previous next element */ \
|
||||
}
|
||||
#define TAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *tqe_next; /* next element */ \
|
||||
struct type **tqe_prev; /* address of previous next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* tail queue access methods
|
||||
*/
|
||||
#define TAILQ_FIRST(head) ((head)->tqh_first)
|
||||
#define TAILQ_END(head) NULL
|
||||
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
|
||||
#define TAILQ_LAST(head, headname) \
|
||||
(*(((struct headname *)((head)->tqh_last))->tqh_last))
|
||||
#define TAILQ_FIRST(head) ((head)->tqh_first)
|
||||
#define TAILQ_END(head) NULL
|
||||
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
|
||||
#define TAILQ_LAST(head, headname) \
|
||||
(*(((struct headname *)((head)->tqh_last))->tqh_last))
|
||||
/* XXX */
|
||||
#define TAILQ_PREV(elm, headname, field) \
|
||||
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
|
||||
#define TAILQ_EMPTY(head) \
|
||||
(TAILQ_FIRST(head) == TAILQ_END(head))
|
||||
#define TAILQ_PREV(elm, headname, field) \
|
||||
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
|
||||
#define TAILQ_EMPTY(head) \
|
||||
(TAILQ_FIRST(head) == TAILQ_END(head))
|
||||
|
||||
#define TAILQ_FOREACH(var, head, field) \
|
||||
for((var) = TAILQ_FIRST(head); \
|
||||
(var) != TAILQ_END(head); \
|
||||
(var) = TAILQ_NEXT(var, field))
|
||||
#define TAILQ_FOREACH(var, head, field) \
|
||||
for ((var) = TAILQ_FIRST(head); \
|
||||
(var) != TAILQ_END(head); \
|
||||
(var) = TAILQ_NEXT(var, field))
|
||||
|
||||
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
||||
for((var) = TAILQ_LAST(head, headname); \
|
||||
(var) != TAILQ_END(head); \
|
||||
(var) = TAILQ_PREV(var, headname, field))
|
||||
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
||||
for ((var) = TAILQ_LAST(head, headname); \
|
||||
(var) != TAILQ_END(head); \
|
||||
(var) = TAILQ_PREV(var, headname, field))
|
||||
|
||||
/*
|
||||
* Tail queue functions.
|
||||
*/
|
||||
#define TAILQ_INIT(head) do { \
|
||||
(head)->tqh_first = NULL; \
|
||||
(head)->tqh_last = &(head)->tqh_first; \
|
||||
} while (0)
|
||||
#define TAILQ_INIT(head) \
|
||||
do { \
|
||||
(head)->tqh_first = NULL; \
|
||||
(head)->tqh_last = &(head)->tqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
|
||||
(head)->tqh_first->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(head)->tqh_first = (elm); \
|
||||
(elm)->field.tqe_prev = &(head)->tqh_first; \
|
||||
} while (0)
|
||||
#define TAILQ_INSERT_HEAD(head, elm, field) \
|
||||
do { \
|
||||
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
|
||||
(head)->tqh_first->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(head)->tqh_first = (elm); \
|
||||
(elm)->field.tqe_prev = &(head)->tqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.tqe_next = NULL; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
} while (0)
|
||||
#define TAILQ_INSERT_TAIL(head, elm, field) \
|
||||
do { \
|
||||
(elm)->field.tqe_next = NULL; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(listelm)->field.tqe_next = (elm); \
|
||||
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
|
||||
} while (0)
|
||||
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) \
|
||||
do { \
|
||||
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(listelm)->field.tqe_next = (elm); \
|
||||
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
|
||||
(elm)->field.tqe_next = (listelm); \
|
||||
*(listelm)->field.tqe_prev = (elm); \
|
||||
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
} while (0)
|
||||
#define TAILQ_INSERT_BEFORE(listelm, elm, field) \
|
||||
do { \
|
||||
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
|
||||
(elm)->field.tqe_next = (listelm); \
|
||||
*(listelm)->field.tqe_prev = (elm); \
|
||||
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_REMOVE(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next) != NULL) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
(elm)->field.tqe_prev; \
|
||||
else \
|
||||
(head)->tqh_last = (elm)->field.tqe_prev; \
|
||||
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
|
||||
_Q_INVALIDATE((elm)->field.tqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_next); \
|
||||
} while (0)
|
||||
#define TAILQ_REMOVE(head, elm, field) \
|
||||
do { \
|
||||
if (((elm)->field.tqe_next) != NULL) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = (elm)->field.tqe_prev; \
|
||||
else \
|
||||
(head)->tqh_last = (elm)->field.tqe_prev; \
|
||||
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
|
||||
_Q_INVALIDATE((elm)->field.tqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_next); \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_REPLACE(head, elm, elm2, field) do { \
|
||||
if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
|
||||
(elm2)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm2)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm2)->field.tqe_next; \
|
||||
(elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
|
||||
*(elm2)->field.tqe_prev = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_next); \
|
||||
} while (0)
|
||||
#define TAILQ_REPLACE(head, elm, elm2, field) \
|
||||
do { \
|
||||
if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
|
||||
(elm2)->field.tqe_next->field.tqe_prev = &(elm2)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm2)->field.tqe_next; \
|
||||
(elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
|
||||
*(elm2)->field.tqe_prev = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_next); \
|
||||
} while (0)
|
||||
|
||||
/* Swaps two consecutive elements. 'second' *MUST* follow 'first' */
|
||||
#define TAILQ_SWAP(first, second, head, field) do { \
|
||||
*((first)->field.tqe_prev) = (second); \
|
||||
(second)->field.tqe_prev = (first)->field.tqe_prev; \
|
||||
(first)->field.tqe_prev = &((second)->field.tqe_next); \
|
||||
(first)->field.tqe_next = (second)->field.tqe_next; \
|
||||
if ((second)->field.tqe_next) \
|
||||
(second)->field.tqe_next->field.tqe_prev = &((first)->field.tqe_next); \
|
||||
(second)->field.tqe_next = first; \
|
||||
if ((head)->tqh_last == &((second)->field.tqe_next)) \
|
||||
(head)->tqh_last = &((first)->field.tqe_next); \
|
||||
} while (0)
|
||||
#define TAILQ_SWAP(first, second, head, field) \
|
||||
do { \
|
||||
*((first)->field.tqe_prev) = (second); \
|
||||
(second)->field.tqe_prev = (first)->field.tqe_prev; \
|
||||
(first)->field.tqe_prev = &((second)->field.tqe_next); \
|
||||
(first)->field.tqe_next = (second)->field.tqe_next; \
|
||||
if ((second)->field.tqe_next) \
|
||||
(second)->field.tqe_next->field.tqe_prev = &((first)->field.tqe_next); \
|
||||
(second)->field.tqe_next = first; \
|
||||
if ((head)->tqh_last == &((second)->field.tqe_next)) \
|
||||
(head)->tqh_last = &((first)->field.tqe_next); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Circular queue definitions.
|
||||
*/
|
||||
#define CIRCLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *cqh_first; /* first element */ \
|
||||
struct type *cqh_last; /* last element */ \
|
||||
}
|
||||
#define CIRCLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *cqh_first; /* first element */ \
|
||||
struct type *cqh_last; /* last element */ \
|
||||
}
|
||||
|
||||
#define CIRCLEQ_HEAD_INITIALIZER(head) \
|
||||
{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
|
||||
#define CIRCLEQ_HEAD_INITIALIZER(head) \
|
||||
{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
|
||||
|
||||
#define CIRCLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *cqe_next; /* next element */ \
|
||||
struct type *cqe_prev; /* previous element */ \
|
||||
}
|
||||
#define CIRCLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *cqe_next; /* next element */ \
|
||||
struct type *cqe_prev; /* previous element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Circular queue access methods
|
||||
*/
|
||||
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
|
||||
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
|
||||
#define CIRCLEQ_END(head) ((void *)(head))
|
||||
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
|
||||
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
|
||||
#define CIRCLEQ_EMPTY(head) \
|
||||
(CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
|
||||
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
|
||||
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
|
||||
#define CIRCLEQ_END(head) ((void *)(head))
|
||||
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
|
||||
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
|
||||
#define CIRCLEQ_EMPTY(head) \
|
||||
(CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
|
||||
|
||||
#define CIRCLEQ_FOREACH(var, head, field) \
|
||||
for((var) = CIRCLEQ_FIRST(head); \
|
||||
(var) != CIRCLEQ_END(head); \
|
||||
(var) = CIRCLEQ_NEXT(var, field))
|
||||
#define CIRCLEQ_FOREACH(var, head, field) \
|
||||
for ((var) = CIRCLEQ_FIRST(head); \
|
||||
(var) != CIRCLEQ_END(head); \
|
||||
(var) = CIRCLEQ_NEXT(var, field))
|
||||
|
||||
#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
|
||||
for((var) = CIRCLEQ_LAST(head); \
|
||||
(var) != CIRCLEQ_END(head); \
|
||||
(var) = CIRCLEQ_PREV(var, field))
|
||||
#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
|
||||
for ((var) = CIRCLEQ_LAST(head); \
|
||||
(var) != CIRCLEQ_END(head); \
|
||||
(var) = CIRCLEQ_PREV(var, field))
|
||||
|
||||
/*
|
||||
* Circular queue functions.
|
||||
*/
|
||||
#define CIRCLEQ_INIT(head) do { \
|
||||
(head)->cqh_first = CIRCLEQ_END(head); \
|
||||
(head)->cqh_last = CIRCLEQ_END(head); \
|
||||
} while (0)
|
||||
#define CIRCLEQ_INIT(head) \
|
||||
do { \
|
||||
(head)->cqh_first = CIRCLEQ_END(head); \
|
||||
(head)->cqh_last = CIRCLEQ_END(head); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
|
||||
(elm)->field.cqe_prev = (listelm); \
|
||||
if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
|
||||
(listelm)->field.cqe_next = (elm); \
|
||||
} while (0)
|
||||
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) \
|
||||
do { \
|
||||
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
|
||||
(elm)->field.cqe_prev = (listelm); \
|
||||
if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
|
||||
(listelm)->field.cqe_next = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
|
||||
(elm)->field.cqe_next = (listelm); \
|
||||
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
|
||||
if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
|
||||
(listelm)->field.cqe_prev = (elm); \
|
||||
} while (0)
|
||||
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) \
|
||||
do { \
|
||||
(elm)->field.cqe_next = (listelm); \
|
||||
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
|
||||
if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
|
||||
(listelm)->field.cqe_prev = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.cqe_next = (head)->cqh_first; \
|
||||
(elm)->field.cqe_prev = CIRCLEQ_END(head); \
|
||||
if ((head)->cqh_last == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(head)->cqh_first->field.cqe_prev = (elm); \
|
||||
(head)->cqh_first = (elm); \
|
||||
} while (0)
|
||||
#define CIRCLEQ_INSERT_HEAD(head, elm, field) \
|
||||
do { \
|
||||
(elm)->field.cqe_next = (head)->cqh_first; \
|
||||
(elm)->field.cqe_prev = CIRCLEQ_END(head); \
|
||||
if ((head)->cqh_last == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(head)->cqh_first->field.cqe_prev = (elm); \
|
||||
(head)->cqh_first = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.cqe_next = CIRCLEQ_END(head); \
|
||||
(elm)->field.cqe_prev = (head)->cqh_last; \
|
||||
if ((head)->cqh_first == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(head)->cqh_last->field.cqe_next = (elm); \
|
||||
(head)->cqh_last = (elm); \
|
||||
} while (0)
|
||||
#define CIRCLEQ_INSERT_TAIL(head, elm, field) \
|
||||
do { \
|
||||
(elm)->field.cqe_next = CIRCLEQ_END(head); \
|
||||
(elm)->field.cqe_prev = (head)->cqh_last; \
|
||||
if ((head)->cqh_first == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(head)->cqh_last->field.cqe_next = (elm); \
|
||||
(head)->cqh_last = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_REMOVE(head, elm, field) do { \
|
||||
if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm)->field.cqe_prev; \
|
||||
else \
|
||||
(elm)->field.cqe_next->field.cqe_prev = \
|
||||
(elm)->field.cqe_prev; \
|
||||
if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm)->field.cqe_next; \
|
||||
else \
|
||||
(elm)->field.cqe_prev->field.cqe_next = \
|
||||
(elm)->field.cqe_next; \
|
||||
_Q_INVALIDATE((elm)->field.cqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_next); \
|
||||
} while (0)
|
||||
#define CIRCLEQ_REMOVE(head, elm, field) \
|
||||
do { \
|
||||
if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm)->field.cqe_prev; \
|
||||
else \
|
||||
(elm)->field.cqe_next->field.cqe_prev = (elm)->field.cqe_prev; \
|
||||
if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm)->field.cqe_next; \
|
||||
else \
|
||||
(elm)->field.cqe_prev->field.cqe_next = (elm)->field.cqe_next; \
|
||||
_Q_INVALIDATE((elm)->field.cqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_next); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
|
||||
if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
|
||||
CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm2); \
|
||||
else \
|
||||
(elm2)->field.cqe_next->field.cqe_prev = (elm2); \
|
||||
if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
|
||||
CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm2); \
|
||||
else \
|
||||
(elm2)->field.cqe_prev->field.cqe_next = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_next); \
|
||||
} while (0)
|
||||
#define CIRCLEQ_REPLACE(head, elm, elm2, field) \
|
||||
do { \
|
||||
if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm2); \
|
||||
else \
|
||||
(elm2)->field.cqe_next->field.cqe_prev = (elm2); \
|
||||
if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm2); \
|
||||
else \
|
||||
(elm2)->field.cqe_prev->field.cqe_next = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_next); \
|
||||
} while (0)
|
||||
|
@ -68,15 +68,15 @@ extern "C" {
|
||||
|
||||
#ifndef _sd_printf_attr_
|
||||
#if __GNUC__ >= 4
|
||||
#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
|
||||
#define _sd_printf_attr_(a, b) __attribute__((format(printf, a, b)))
|
||||
#else
|
||||
#define _sd_printf_attr_(a,b)
|
||||
#define _sd_printf_attr_(a, b)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _sd_hidden_
|
||||
#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS)
|
||||
#define _sd_hidden_ __attribute__ ((visibility("hidden")))
|
||||
#define _sd_hidden_ __attribute__((visibility("hidden")))
|
||||
#else
|
||||
#define _sd_hidden_
|
||||
#endif
|
||||
@ -89,14 +89,14 @@ extern "C" {
|
||||
|
||||
This is similar to printk() usage in the kernel.
|
||||
*/
|
||||
#define SD_EMERG "<0>" /* system is unusable */
|
||||
#define SD_ALERT "<1>" /* action must be taken immediately */
|
||||
#define SD_CRIT "<2>" /* critical conditions */
|
||||
#define SD_ERR "<3>" /* error conditions */
|
||||
#define SD_WARNING "<4>" /* warning conditions */
|
||||
#define SD_NOTICE "<5>" /* normal but significant condition */
|
||||
#define SD_INFO "<6>" /* informational */
|
||||
#define SD_DEBUG "<7>" /* debug-level messages */
|
||||
#define SD_EMERG "<0>" /* system is unusable */
|
||||
#define SD_ALERT "<1>" /* action must be taken immediately */
|
||||
#define SD_CRIT "<2>" /* critical conditions */
|
||||
#define SD_ERR "<3>" /* error conditions */
|
||||
#define SD_WARNING "<4>" /* warning conditions */
|
||||
#define SD_NOTICE "<5>" /* normal but significant condition */
|
||||
#define SD_INFO "<6>" /* informational */
|
||||
#define SD_DEBUG "<7>" /* debug-level messages */
|
||||
|
||||
/* The first passed file descriptor is fd 3 */
|
||||
#define SD_LISTEN_FDS_START 3
|
||||
@ -242,7 +242,7 @@ int sd_notify(int unset_environment, const char *state) _sd_hidden_;
|
||||
|
||||
See sd_notifyf(3) for more information.
|
||||
*/
|
||||
int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3) _sd_hidden_;
|
||||
int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2, 3) _sd_hidden_;
|
||||
|
||||
/*
|
||||
Returns > 0 if the system was booted with systemd. Returns < 0 on
|
||||
|
@ -49,7 +49,7 @@ void startup_monitor_event(SnMonitorEvent *event, void *userdata);
|
||||
*
|
||||
*/
|
||||
struct Startup_Sequence *startup_sequence_get(i3Window *cwindow,
|
||||
xcb_get_property_reply_t *startup_id_reply, bool ignore_mapped_leader);
|
||||
xcb_get_property_reply_t *startup_id_reply, bool ignore_mapped_leader);
|
||||
|
||||
/**
|
||||
* Checks if the given window belongs to a startup notification by checking if
|
||||
|
@ -15,43 +15,45 @@
|
||||
#include "data.h"
|
||||
|
||||
#define die(...) errx(EXIT_FAILURE, __VA_ARGS__);
|
||||
#define exit_if_null(pointer, ...) { if (pointer == NULL) die(__VA_ARGS__); }
|
||||
#define exit_if_null(pointer, ...) \
|
||||
{ \
|
||||
if (pointer == NULL) \
|
||||
die(__VA_ARGS__); \
|
||||
}
|
||||
#define STARTS_WITH(string, needle) (strncasecmp(string, needle, strlen(needle)) == 0)
|
||||
#define CIRCLEQ_NEXT_OR_NULL(head, elm, field) (CIRCLEQ_NEXT(elm, field) != CIRCLEQ_END(head) ? \
|
||||
CIRCLEQ_NEXT(elm, field) : NULL)
|
||||
#define CIRCLEQ_PREV_OR_NULL(head, elm, field) (CIRCLEQ_PREV(elm, field) != CIRCLEQ_END(head) ? \
|
||||
CIRCLEQ_PREV(elm, field) : NULL)
|
||||
#define FOR_TABLE(workspace) \
|
||||
for (int cols = 0; cols < (workspace)->cols; cols++) \
|
||||
for (int rows = 0; rows < (workspace)->rows; rows++)
|
||||
#define CIRCLEQ_NEXT_OR_NULL(head, elm, field) (CIRCLEQ_NEXT(elm, field) != CIRCLEQ_END(head) ? CIRCLEQ_NEXT(elm, field) : NULL)
|
||||
#define CIRCLEQ_PREV_OR_NULL(head, elm, field) (CIRCLEQ_PREV(elm, field) != CIRCLEQ_END(head) ? CIRCLEQ_PREV(elm, field) : NULL)
|
||||
#define FOR_TABLE(workspace) \
|
||||
for (int cols = 0; cols < (workspace)->cols; cols++) \
|
||||
for (int rows = 0; rows < (workspace)->rows; rows++)
|
||||
|
||||
#define NODES_FOREACH(head) \
|
||||
for (Con *child = (Con*)-1; (child == (Con*)-1) && ((child = 0), true);) \
|
||||
TAILQ_FOREACH(child, &((head)->nodes_head), nodes)
|
||||
#define NODES_FOREACH(head) \
|
||||
for (Con *child = (Con *)-1; (child == (Con *)-1) && ((child = 0), true);) \
|
||||
TAILQ_FOREACH(child, &((head)->nodes_head), nodes)
|
||||
|
||||
#define NODES_FOREACH_REVERSE(head) \
|
||||
for (Con *child = (Con*)-1; (child == (Con*)-1) && ((child = 0), true);) \
|
||||
TAILQ_FOREACH_REVERSE(child, &((head)->nodes_head), nodes_head, nodes)
|
||||
#define NODES_FOREACH_REVERSE(head) \
|
||||
for (Con *child = (Con *)-1; (child == (Con *)-1) && ((child = 0), true);) \
|
||||
TAILQ_FOREACH_REVERSE(child, &((head)->nodes_head), nodes_head, nodes)
|
||||
|
||||
/* greps the ->nodes of the given head and returns the first node that matches the given condition */
|
||||
#define GREP_FIRST(dest, head, condition) \
|
||||
NODES_FOREACH(head) { \
|
||||
if (!(condition)) \
|
||||
continue; \
|
||||
\
|
||||
(dest) = child; \
|
||||
break; \
|
||||
NODES_FOREACH(head) { \
|
||||
if (!(condition)) \
|
||||
continue; \
|
||||
\
|
||||
(dest) = child; \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define FREE(pointer) do { \
|
||||
#define FREE(pointer) \
|
||||
do { \
|
||||
if (pointer != NULL) { \
|
||||
free(pointer); \
|
||||
pointer = NULL; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
free(pointer); \
|
||||
pointer = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CALL(obj, member, ...) obj->member(obj, ## __VA_ARGS__)
|
||||
#define CALL(obj, member, ...) obj->member(obj, ##__VA_ARGS__)
|
||||
|
||||
int min(int a, int b);
|
||||
int max(int a, int b);
|
||||
|
@ -68,25 +68,25 @@ void workspace_show_by_name(const char *num);
|
||||
* Returns the next workspace.
|
||||
*
|
||||
*/
|
||||
Con* workspace_next(void);
|
||||
Con *workspace_next(void);
|
||||
|
||||
/**
|
||||
* Returns the previous workspace.
|
||||
*
|
||||
*/
|
||||
Con* workspace_prev(void);
|
||||
Con *workspace_prev(void);
|
||||
|
||||
/**
|
||||
* Returns the next workspace on the same output
|
||||
*
|
||||
*/
|
||||
Con* workspace_next_on_output(void);
|
||||
Con *workspace_next_on_output(void);
|
||||
|
||||
/**
|
||||
* Returns the previous workspace on the same output
|
||||
*
|
||||
*/
|
||||
Con* workspace_prev_on_output(void);
|
||||
Con *workspace_prev_on_output(void);
|
||||
|
||||
/**
|
||||
* Focuses the previously focused workspace.
|
||||
@ -100,7 +100,6 @@ void workspace_back_and_forth(void);
|
||||
*/
|
||||
Con *workspace_back_and_forth_get(void);
|
||||
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Assigns the given workspace to the given screen by correctly updating its
|
||||
|
@ -12,48 +12,48 @@
|
||||
#include "data.h"
|
||||
#include "xcursor.h"
|
||||
|
||||
#define _NET_WM_STATE_REMOVE 0
|
||||
#define _NET_WM_STATE_ADD 1
|
||||
#define _NET_WM_STATE_TOGGLE 2
|
||||
#define _NET_WM_STATE_REMOVE 0
|
||||
#define _NET_WM_STATE_ADD 1
|
||||
#define _NET_WM_STATE_TOGGLE 2
|
||||
|
||||
/** This is the equivalent of XC_left_ptr. I’m not sure why xcb doesn’t have a
|
||||
* constant for that. */
|
||||
#define XCB_CURSOR_LEFT_PTR 68
|
||||
#define XCB_CURSOR_LEFT_PTR 68
|
||||
#define XCB_CURSOR_SB_H_DOUBLE_ARROW 108
|
||||
#define XCB_CURSOR_SB_V_DOUBLE_ARROW 116
|
||||
#define XCB_CURSOR_WATCH 150
|
||||
|
||||
/* from X11/keysymdef.h */
|
||||
#define XCB_NUM_LOCK 0xff7f
|
||||
#define XCB_NUM_LOCK 0xff7f
|
||||
|
||||
/* The event masks are defined here because we don’t only set them once but we
|
||||
need to set slight variations of them (without XCB_EVENT_MASK_ENTER_WINDOW
|
||||
while rendering the layout) */
|
||||
/** The XCB_CW_EVENT_MASK for the child (= real window) */
|
||||
#define CHILD_EVENT_MASK (XCB_EVENT_MASK_PROPERTY_CHANGE | \
|
||||
#define CHILD_EVENT_MASK (XCB_EVENT_MASK_PROPERTY_CHANGE | \
|
||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY | \
|
||||
XCB_EVENT_MASK_FOCUS_CHANGE)
|
||||
|
||||
/** The XCB_CW_EVENT_MASK for its frame */
|
||||
#define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | /* …mouse is pressed/released */ \
|
||||
XCB_EVENT_MASK_BUTTON_RELEASE | \
|
||||
XCB_EVENT_MASK_POINTER_MOTION | /* …mouse is moved */ \
|
||||
XCB_EVENT_MASK_EXPOSURE | /* …our window needs to be redrawn */ \
|
||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* …the frame gets destroyed */ \
|
||||
#define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | /* …mouse is pressed/released */ \
|
||||
XCB_EVENT_MASK_BUTTON_RELEASE | \
|
||||
XCB_EVENT_MASK_POINTER_MOTION | /* …mouse is moved */ \
|
||||
XCB_EVENT_MASK_EXPOSURE | /* …our window needs to be redrawn */ \
|
||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* …the frame gets destroyed */ \
|
||||
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | /* …the application tries to resize itself */ \
|
||||
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | /* …subwindows get notifies */ \
|
||||
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | /* …subwindows get notifies */ \
|
||||
XCB_EVENT_MASK_ENTER_WINDOW) /* …user moves cursor inside our window */
|
||||
|
||||
#define ROOT_EVENT_MASK (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \
|
||||
XCB_EVENT_MASK_BUTTON_PRESS | \
|
||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* when the user adds a screen (e.g. video \
|
||||
projector), the root window gets a \
|
||||
ConfigureNotify */ \
|
||||
XCB_EVENT_MASK_POINTER_MOTION | \
|
||||
XCB_EVENT_MASK_PROPERTY_CHANGE | \
|
||||
XCB_EVENT_MASK_ENTER_WINDOW)
|
||||
#define ROOT_EVENT_MASK (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \
|
||||
XCB_EVENT_MASK_BUTTON_PRESS | \
|
||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* when the user adds a screen (e.g. video \
|
||||
projector), the root window gets a \
|
||||
ConfigureNotify */ \
|
||||
XCB_EVENT_MASK_POINTER_MOTION | \
|
||||
XCB_EVENT_MASK_PROPERTY_CHANGE | \
|
||||
XCB_EVENT_MASK_ENTER_WINDOW)
|
||||
|
||||
#define xmacro(atom) xcb_atom_t A_ ## atom;
|
||||
#define xmacro(atom) xcb_atom_t A_##atom;
|
||||
#include "atoms.xmacro"
|
||||
#undef xmacro
|
||||
|
||||
@ -65,7 +65,7 @@ extern unsigned int xcb_numlock_mask;
|
||||
*
|
||||
*/
|
||||
xcb_window_t create_window(xcb_connection_t *conn, Rect r, uint16_t depth, xcb_visualid_t visual,
|
||||
uint16_t window_class, enum xcursor_cursor_t cursor, bool map, uint32_t mask, uint32_t *values);
|
||||
uint16_t window_class, enum xcursor_cursor_t cursor, bool map, uint32_t mask, uint32_t *values);
|
||||
|
||||
/**
|
||||
* Draws a line from x,y to to_x,to_y using the given color
|
||||
@ -108,7 +108,6 @@ void xcb_raise_window(xcb_connection_t *conn, xcb_window_t window);
|
||||
*/
|
||||
void xcb_set_window_rect(xcb_connection_t *conn, xcb_window_t window, Rect r);
|
||||
|
||||
|
||||
bool xcb_reply_contains_atom(xcb_get_property_reply_t *prop, xcb_atom_t atom);
|
||||
|
||||
/**
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include <yajl/yajl_version.h>
|
||||
|
||||
/* Shorter names for all those yajl_gen_* functions */
|
||||
#define y(x, ...) yajl_gen_ ## x (gen, ##__VA_ARGS__)
|
||||
#define ystr(str) yajl_gen_string(gen, (unsigned char*)str, strlen(str))
|
||||
#define y(x, ...) yajl_gen_##x(gen, ##__VA_ARGS__)
|
||||
#define ystr(str) yajl_gen_string(gen, (unsigned char *)str, strlen(str))
|
||||
|
||||
#define ygenalloc() yajl_gen_alloc(NULL)
|
||||
#define yalloc(callbacks, client) yajl_alloc(callbacks, NULL, client)
|
||||
|
Reference in New Issue
Block a user