bspwm/types.h

189 lines
3.5 KiB
C
Raw Normal View History

2012-07-31 14:32:13 +02:00
#ifndef _TYPES_H
#define _TYPES_H
2012-09-30 18:41:28 +03:00
#include <stdbool.h>
2012-08-18 11:18:19 +02:00
#include <xcb/xcb.h>
#include <xcb/xcb_event.h>
2012-08-20 22:38:29 +02:00
#include "helpers.h"
2012-07-30 10:29:21 +02:00
#define SPLIT_RATIO 0.5
2012-10-17 16:18:40 +02:00
#define DEFAULT_DESK_NAME "Desktop"
#define DEFAULT_MON_NAME "Monitor"
#define MISSING_VALUE "N/A"
2012-08-29 12:45:44 +02:00
2012-07-30 10:29:21 +02:00
typedef enum {
TYPE_HORIZONTAL,
TYPE_VERTICAL
2012-08-02 09:54:32 +02:00
} split_type_t;
2012-07-30 10:29:21 +02:00
2012-08-19 10:34:08 +02:00
typedef enum {
MODE_AUTOMATIC,
MODE_MANUAL
} split_mode_t;
2012-08-25 15:24:35 +02:00
typedef enum {
LAYOUT_TILED,
LAYOUT_MONOCLE
} layout_t;
2012-08-20 12:20:12 +02:00
typedef enum {
MOVE_PULL,
MOVE_PUSH
} fence_move_t;
typedef enum {
CHANGE_INCREASE,
CHANGE_DECREASE
} value_change_t;
2012-10-17 16:18:40 +02:00
typedef enum {
LIST_OPTION_VERBOSE,
LIST_OPTION_QUIET
} list_option_t;
2012-08-25 15:24:35 +02:00
typedef enum {
CLIENT_SKIP_NONE,
CLIENT_SKIP_FLOATING,
CLIENT_SKIP_TILED,
CLIENT_SKIP_CLASS_EQUAL,
CLIENT_SKIP_CLASS_DIFFER
2012-08-25 15:24:35 +02:00
} skip_client_t;
typedef enum {
DESKTOP_SKIP_NONE,
DESKTOP_SKIP_FREE,
DESKTOP_SKIP_OCCUPIED
} skip_desktop_t;
2012-08-25 15:24:35 +02:00
typedef enum {
2012-09-22 16:32:35 +02:00
CYCLE_NEXT,
CYCLE_PREV
2012-08-25 15:24:35 +02:00
} cycle_dir_t;
typedef enum {
NEAREST_OLDER,
NEAREST_NEWER
} nearest_arg_t;
2012-11-01 22:47:03 +01:00
typedef enum {
CIRCULATE_FORWARD,
CIRCULATE_BACKWARD
} circulate_dir_t;
2012-07-30 10:29:21 +02:00
typedef enum {
ROTATE_CLOCKWISE,
ROTATE_COUNTER_CLOCKWISE,
2012-08-17 22:18:26 +02:00
ROTATE_FULL_CYCLE
} rotate_t;
2012-08-04 21:24:47 +02:00
2012-08-03 19:40:26 +02:00
typedef enum {
DIR_LEFT,
DIR_RIGHT,
DIR_UP,
2012-08-03 19:40:26 +02:00
DIR_DOWN
2012-08-17 22:18:26 +02:00
} direction_t;
2012-07-30 10:29:21 +02:00
2012-09-22 16:32:35 +02:00
typedef enum {
TOP_LEFT,
TOP_RIGHT,
BOTTOM_LEFT,
BOTTOM_RIGHT
} corner_t;
2012-07-30 10:29:21 +02:00
typedef struct {
2012-08-18 22:36:46 +02:00
xcb_window_t window;
unsigned int uid;
char class_name[MAXLEN];
unsigned int border_width;
2012-07-30 10:29:21 +02:00
bool floating;
bool transient; /* transient window are always floating */
2012-07-30 10:29:21 +02:00
bool fullscreen;
bool locked; /* protects window from being closed */
bool urgent;
2012-09-21 17:39:22 +02:00
xcb_rectangle_t floating_rectangle;
xcb_rectangle_t tiled_rectangle;
2012-08-29 18:37:31 +02:00
} client_t;
2012-07-30 10:29:21 +02:00
2012-08-29 18:37:31 +02:00
typedef struct node_t node_t;
struct node_t {
2012-08-02 09:54:32 +02:00
split_type_t split_type;
2012-07-30 10:29:21 +02:00
double split_ratio;
xcb_rectangle_t rectangle;
2012-09-22 23:11:57 +02:00
bool vacant; /* vacant nodes only hold floating clients */
split_mode_t born_as;
2012-08-29 18:37:31 +02:00
node_t *first_child;
node_t *second_child;
node_t *parent;
2012-09-22 23:11:57 +02:00
client_t *client; /* NULL except for leaves */
2012-08-17 22:18:26 +02:00
};
2012-07-30 10:29:21 +02:00
2012-08-29 18:37:31 +02:00
typedef struct desktop_t desktop_t;
struct desktop_t {
char name[MAXLEN];
2012-08-25 15:24:35 +02:00
layout_t layout;
2012-08-29 18:37:31 +02:00
node_t *root;
node_t *focus;
node_t *last_focus;
desktop_t *prev;
desktop_t *next;
2012-08-17 22:18:26 +02:00
};
2012-07-31 14:32:13 +02:00
2012-10-17 16:18:40 +02:00
typedef struct monitor_t monitor_t;
struct monitor_t {
char name[MAXLEN];
xcb_rectangle_t rectangle;
desktop_t *desk;
desktop_t *last_desk;
desktop_t *desk_head;
desktop_t *desk_tail;
monitor_t *prev;
monitor_t *next;
};
2012-09-11 13:12:53 +02:00
typedef struct {
char name[MAXLEN];
2012-09-11 13:12:53 +02:00
} rule_cause_t;
typedef struct {
bool floating;
monitor_t *monitor;
desktop_t *desktop;
2012-09-11 13:12:53 +02:00
} rule_effect_t;
typedef struct rule_t rule_t;
struct rule_t {
rule_cause_t cause;
rule_effect_t effect;
rule_t *next;
};
2012-09-07 12:32:24 +02:00
typedef struct {
node_t *node;
desktop_t *desktop;
2012-10-17 16:18:40 +02:00
monitor_t *monitor;
2012-09-07 12:32:24 +02:00
} window_location_t;
2012-10-17 16:18:40 +02:00
typedef struct {
desktop_t *desktop;
monitor_t *monitor;
} desktop_location_t;
2012-09-22 16:32:35 +02:00
typedef struct {
xcb_point_t position;
xcb_button_t button;
xcb_rectangle_t rectangle;
2012-10-17 16:18:40 +02:00
monitor_t *monitor;
2012-09-22 16:32:35 +02:00
desktop_t *desktop;
node_t *node;
corner_t corner;
} pointer_state_t;
2012-08-29 18:37:31 +02:00
node_t *make_node(void);
2012-10-17 16:18:40 +02:00
monitor_t *make_monitor(xcb_rectangle_t *);
desktop_t *make_desktop(const char *);
2012-09-05 14:07:06 +02:00
client_t *make_client(xcb_window_t);
2012-09-11 13:12:53 +02:00
rule_t *make_rule(void);
pointer_state_t *make_pointer_state(void);
2012-08-18 11:18:19 +02:00
2012-07-31 14:32:13 +02:00
#endif