]> git.lizzy.rs Git - bspwm.git/blob - types.h
Move floating windows with the mouse, fix born_as
[bspwm.git] / types.h
1 #ifndef _TYPES_H
2 #define _TYPES_H
3
4 #include <xcb/xcb.h>
5 #include <xcb/xcb_event.h>
6 #include "helpers.h"
7
8 #define SPLIT_RATIO  0.5
9 #define DEFAULT_DESK_NAME    "One"
10
11 typedef enum {
12     TYPE_HORIZONTAL,
13     TYPE_VERTICAL
14 } split_type_t;
15
16 typedef enum {
17     MODE_AUTOMATIC,
18     MODE_MANUAL
19 } split_mode_t;
20
21 typedef enum {
22     LAYOUT_TILED,
23     LAYOUT_MONOCLE
24 } layout_t;
25
26 typedef enum {
27     MOVE_PULL,
28     MOVE_PUSH
29 } fence_move_t;
30
31 typedef enum {
32     CHANGE_INCREASE,
33     CHANGE_DECREASE
34 } value_change_t;
35
36 typedef enum {
37     SKIP_NONE,
38     SKIP_FLOATING,
39     SKIP_TILED
40 } skip_client_t;
41
42 typedef enum {
43     DIR_NEXT,
44     DIR_PREV
45 } cycle_dir_t;
46
47 typedef enum {
48     ROTATE_CLOCKWISE,
49     ROTATE_COUNTER_CLOCKWISE,
50     ROTATE_FULL_CYCLE
51 } rotate_t;
52
53 typedef enum {
54     DIR_LEFT,
55     DIR_RIGHT,
56     DIR_UP,
57     DIR_DOWN
58 } direction_t;
59
60 typedef struct {
61     xcb_window_t window;
62     bool floating;
63     bool transient;  /* transient window are always floating */
64     bool fullscreen;
65     bool locked;     /* protects window from being closed */
66     bool urgent;
67     xcb_rectangle_t floating_rectangle;
68     xcb_rectangle_t tiled_rectangle;
69 } client_t;
70
71 typedef struct node_t node_t;
72 struct node_t {
73     split_type_t split_type;
74     double split_ratio;
75     xcb_rectangle_t rectangle;
76     bool vacant; /* vacant nodes only hold floating clients */
77     split_mode_t born_as; /* container node property used to when removing leaves */
78     node_t *first_child;
79     node_t *second_child;
80     node_t *parent;
81     client_t *client; /* NULL except for leaves */
82 };
83
84 typedef struct desktop_t desktop_t;
85 struct desktop_t {
86     char name[MAXLEN];
87     layout_t layout;
88     node_t *root;
89     node_t *focus;
90     node_t *last_focus;
91     desktop_t *prev;
92     desktop_t *next;
93 };
94
95 typedef struct {
96     char name[MAXLEN];
97 } rule_cause_t;
98
99 typedef struct {
100     bool floating;
101     char desk_name[MAXLEN];
102 } rule_effect_t;
103
104 typedef struct rule_t rule_t;
105 struct rule_t {
106     rule_cause_t cause;
107     rule_effect_t effect;
108     rule_t *next;
109 };
110
111 typedef struct {
112     xcb_button_t button;
113     xcb_point_t position;
114     xcb_rectangle_t rectangle;
115     xcb_window_t window;
116 } pointer_state_t;
117
118 typedef struct {
119     node_t *node;
120     desktop_t *desktop;
121 } window_location_t;
122
123 node_t *make_node(void);
124 desktop_t *make_desktop(const char *);
125 client_t *make_client(xcb_window_t);
126 rule_t *make_rule(void);
127 pointer_state_t *make_pointer_state(void);
128
129 #endif