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>
|
2013-05-28 17:31:35 +02:00
|
|
|
#include <xcb/randr.h>
|
2012-08-18 11:18:19 +02:00
|
|
|
#include <xcb/xcb_event.h>
|
2012-08-20 22:38:29 +02:00
|
|
|
#include "helpers.h"
|
2012-07-30 10:29:21 +02:00
|
|
|
|
2012-10-17 16:18:40 +02:00
|
|
|
#define DEFAULT_DESK_NAME "Desktop"
|
|
|
|
#define DEFAULT_MON_NAME "Monitor"
|
2012-09-24 19:40:49 +02:00
|
|
|
#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 {
|
2013-07-08 11:42:05 +02:00
|
|
|
CLIENT_TYPE_ALL,
|
|
|
|
CLIENT_TYPE_FLOATING,
|
|
|
|
CLIENT_TYPE_TILED
|
|
|
|
} client_type_t;
|
2012-10-17 16:18:40 +02:00
|
|
|
|
2012-12-23 13:14:33 +01:00
|
|
|
typedef enum {
|
2013-07-08 11:42:05 +02:00
|
|
|
CLIENT_CLASS_ALL,
|
|
|
|
CLIENT_CLASS_EQUAL,
|
|
|
|
CLIENT_CLASS_DIFFER
|
|
|
|
} client_class_t;
|
2012-12-23 13:14:33 +01:00
|
|
|
|
2013-07-13 18:29:12 -04:00
|
|
|
typedef enum {
|
|
|
|
CLIENT_MODE_ALL,
|
|
|
|
CLIENT_MODE_AUTOMATIC,
|
|
|
|
CLIENT_MODE_MANUAL
|
|
|
|
} client_mode_t;
|
|
|
|
|
2013-07-19 10:13:22 +02:00
|
|
|
typedef enum {
|
|
|
|
CLIENT_URGENCY_ALL,
|
|
|
|
CLIENT_URGENCY_ON,
|
|
|
|
CLIENT_URGENCY_OFF
|
|
|
|
} client_urgency_t;
|
|
|
|
|
2013-07-08 11:42:05 +02:00
|
|
|
typedef struct {
|
|
|
|
client_type_t type;
|
|
|
|
client_class_t class;
|
2013-07-13 18:29:12 -04:00
|
|
|
client_mode_t mode;
|
2013-07-19 10:13:22 +02:00
|
|
|
client_urgency_t urgency;
|
2013-07-08 11:42:05 +02:00
|
|
|
} client_select_t;
|
2013-06-27 19:25:55 +02:00
|
|
|
|
2012-08-25 15:24:35 +02:00
|
|
|
typedef enum {
|
2013-07-08 11:42:05 +02:00
|
|
|
ALTER_NONE,
|
|
|
|
ALTER_TOGGLE,
|
|
|
|
ALTER_SET
|
|
|
|
} state_alter_t;
|
2012-08-25 15:24:35 +02:00
|
|
|
|
2012-10-23 13:31:11 +02:00
|
|
|
typedef enum {
|
2013-07-19 10:13:22 +02:00
|
|
|
DESKTOP_STATUS_ALL,
|
|
|
|
DESKTOP_STATUS_FREE,
|
|
|
|
DESKTOP_STATUS_OCCUPIED
|
|
|
|
} desktop_status_t;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
DESKTOP_URGENCY_ALL,
|
|
|
|
DESKTOP_URGENCY_ON,
|
|
|
|
DESKTOP_URGENCY_OFF
|
|
|
|
} desktop_urgency_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
desktop_status_t status;
|
|
|
|
desktop_urgency_t urgency;
|
2013-07-08 11:42:05 +02:00
|
|
|
} desktop_select_t;
|
2012-10-23 13:31:11 +02:00
|
|
|
|
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;
|
|
|
|
|
2012-11-01 22:47:03 +01:00
|
|
|
typedef enum {
|
|
|
|
CIRCULATE_FORWARD,
|
|
|
|
CIRCULATE_BACKWARD
|
|
|
|
} circulate_dir_t;
|
|
|
|
|
2013-02-26 12:54:01 +01:00
|
|
|
typedef enum {
|
|
|
|
FLIP_HORIZONTAL,
|
|
|
|
FLIP_VERTICAL
|
|
|
|
} flip_t;
|
|
|
|
|
2012-08-03 19:40:26 +02:00
|
|
|
typedef enum {
|
|
|
|
DIR_RIGHT,
|
2013-07-08 11:42:05 +02:00
|
|
|
DIR_DOWN,
|
|
|
|
DIR_LEFT,
|
|
|
|
DIR_UP
|
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 {
|
2013-02-28 12:27:26 +01:00
|
|
|
CORNER_TOP_LEFT,
|
|
|
|
CORNER_TOP_RIGHT,
|
2013-07-08 11:42:05 +02:00
|
|
|
CORNER_BOTTOM_RIGHT,
|
|
|
|
CORNER_BOTTOM_LEFT
|
2012-09-22 16:32:35 +02:00
|
|
|
} corner_t;
|
|
|
|
|
2013-01-06 18:04:55 +01:00
|
|
|
typedef enum {
|
2013-02-28 12:27:26 +01:00
|
|
|
SIDE_LEFT,
|
|
|
|
SIDE_TOP,
|
|
|
|
SIDE_RIGHT,
|
|
|
|
SIDE_BOTTOM
|
|
|
|
} side_t;
|
|
|
|
|
2013-01-06 18:04:55 +01:00
|
|
|
typedef enum {
|
2013-02-04 14:22:41 +01:00
|
|
|
ACTION_NONE,
|
2013-01-10 20:26:00 +01:00
|
|
|
ACTION_FOCUS,
|
|
|
|
ACTION_MOVE,
|
2013-02-28 12:27:26 +01:00
|
|
|
ACTION_RESIZE_SIDE,
|
2013-02-28 15:04:14 +01:00
|
|
|
ACTION_RESIZE_CORNER
|
2013-01-08 15:52:20 +01:00
|
|
|
} pointer_action_t;
|
2013-01-06 18:04:55 +01:00
|
|
|
|
2012-07-30 10:29:21 +02:00
|
|
|
typedef struct {
|
2012-08-18 22:36:46 +02:00
|
|
|
xcb_window_t window;
|
2012-10-04 14:46:41 +02:00
|
|
|
char class_name[MAXLEN];
|
2012-09-28 22:39:32 +02:00
|
|
|
unsigned int border_width;
|
2012-07-30 10:29:21 +02:00
|
|
|
bool floating;
|
2013-09-05 15:37:54 +02:00
|
|
|
bool transient; /* transient window are always floating */
|
2012-07-30 10:29:21 +02:00
|
|
|
bool fullscreen;
|
2013-09-05 15:37:54 +02:00
|
|
|
bool locked; /* protects window from being closed */
|
2012-09-20 23:32:32 +02:00
|
|
|
bool urgent;
|
2013-09-05 15:37:54 +02:00
|
|
|
bool icccm_focus; /* send an event to request input focus */
|
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;
|
2013-06-27 17:26:52 +02:00
|
|
|
split_mode_t split_mode;
|
|
|
|
direction_t split_dir;
|
2013-07-08 11:42:05 +02:00
|
|
|
int birth_rotation;
|
2012-07-30 10:29:21 +02:00
|
|
|
xcb_rectangle_t rectangle;
|
2012-09-22 23:11:57 +02:00
|
|
|
bool vacant; /* vacant nodes only hold floating clients */
|
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-11-04 12:27:39 +01:00
|
|
|
typedef struct node_list_t node_list_t;
|
|
|
|
struct node_list_t {
|
|
|
|
node_t *node;
|
2013-05-07 14:29:17 +02:00
|
|
|
bool latest; /* used for z-ordering tiled windows */
|
2012-11-04 12:27:39 +01:00
|
|
|
node_list_t *prev;
|
|
|
|
node_list_t *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
node_list_t *head;
|
|
|
|
node_list_t *tail;
|
|
|
|
} focus_history_t;
|
|
|
|
|
2012-08-29 18:37:31 +02:00
|
|
|
typedef struct desktop_t desktop_t;
|
|
|
|
struct desktop_t {
|
2012-10-04 14:46:41 +02:00
|
|
|
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;
|
2013-03-03 12:41:29 +01:00
|
|
|
focus_history_t *history;
|
2012-08-29 18:37:31 +02:00
|
|
|
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];
|
2013-05-28 17:31:35 +02:00
|
|
|
xcb_randr_output_t id;
|
2012-10-17 16:18:40 +02:00
|
|
|
xcb_rectangle_t rectangle;
|
2013-05-28 17:31:35 +02:00
|
|
|
bool wired;
|
2012-12-09 12:01:45 +01:00
|
|
|
int top_padding;
|
|
|
|
int right_padding;
|
|
|
|
int bottom_padding;
|
|
|
|
int left_padding;
|
2012-10-17 16:18:40 +02:00
|
|
|
desktop_t *desk;
|
|
|
|
desktop_t *last_desk;
|
|
|
|
desktop_t *desk_head;
|
|
|
|
desktop_t *desk_tail;
|
|
|
|
monitor_t *prev;
|
|
|
|
monitor_t *next;
|
|
|
|
};
|
|
|
|
|
2013-07-08 11:42:05 +02:00
|
|
|
typedef struct {
|
|
|
|
monitor_t *monitor;
|
|
|
|
desktop_t *desktop;
|
|
|
|
node_t *node;
|
|
|
|
} coordinates_t;
|
|
|
|
|
2012-09-11 13:12:53 +02:00
|
|
|
typedef struct {
|
2012-10-04 14:46:41 +02:00
|
|
|
char name[MAXLEN];
|
2012-09-11 13:12:53 +02:00
|
|
|
} rule_cause_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2012-09-01 21:55:35 +02:00
|
|
|
bool floating;
|
2013-03-12 10:56:45 +01:00
|
|
|
bool follow;
|
2013-08-06 11:26:51 +02:00
|
|
|
bool focus;
|
2013-07-08 11:42:05 +02:00
|
|
|
char desc[MAXLEN];
|
2012-09-11 13:12:53 +02:00
|
|
|
} rule_effect_t;
|
|
|
|
|
|
|
|
typedef struct rule_t rule_t;
|
|
|
|
struct rule_t {
|
2012-12-25 19:03:35 +01:00
|
|
|
unsigned int uid;
|
2012-09-11 13:12:53 +02:00
|
|
|
rule_cause_t cause;
|
|
|
|
rule_effect_t effect;
|
2012-12-25 19:03:35 +01:00
|
|
|
rule_t *prev;
|
2012-09-01 21:55:35 +02:00
|
|
|
rule_t *next;
|
|
|
|
};
|
|
|
|
|
2012-09-22 16:32:35 +02:00
|
|
|
typedef struct {
|
|
|
|
xcb_point_t position;
|
2013-01-08 15:52:20 +01:00
|
|
|
pointer_action_t action;
|
2012-09-22 16:32:35 +02:00
|
|
|
xcb_rectangle_t rectangle;
|
2013-02-28 15:04:14 +01:00
|
|
|
node_t *vertical_fence;
|
|
|
|
node_t *horizontal_fence;
|
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;
|
2013-02-04 14:22:41 +01:00
|
|
|
client_t *client;
|
|
|
|
xcb_window_t window;
|
2013-02-28 15:04:14 +01:00
|
|
|
bool is_tiled;
|
|
|
|
double vertical_ratio;
|
|
|
|
double horizontal_ratio;
|
2012-09-22 16:32:35 +02:00
|
|
|
corner_t corner;
|
2013-02-28 12:27:26 +01:00
|
|
|
side_t side;
|
2012-09-22 16:32:35 +02:00
|
|
|
} pointer_state_t;
|
|
|
|
|
2013-02-04 14:22:41 +01:00
|
|
|
typedef struct {
|
|
|
|
node_t *fence;
|
|
|
|
unsigned int distance;
|
|
|
|
} fence_distance_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 *);
|
2012-12-26 22:48:07 +01:00
|
|
|
monitor_t *find_monitor(char *);
|
2013-05-28 17:31:35 +02:00
|
|
|
monitor_t *get_monitor_by_id(xcb_randr_output_t);
|
|
|
|
monitor_t *add_monitor(xcb_rectangle_t *);
|
2012-12-26 14:39:46 +01:00
|
|
|
void remove_monitor(monitor_t *);
|
2013-05-31 16:10:54 +02:00
|
|
|
void merge_monitors(monitor_t *, monitor_t *);
|
2013-09-09 22:27:27 +02:00
|
|
|
void swap_monitors(monitor_t *, monitor_t *);
|
2012-09-12 14:56:51 +02:00
|
|
|
desktop_t *make_desktop(const char *);
|
2013-05-31 16:10:54 +02:00
|
|
|
void insert_desktop(monitor_t *, desktop_t *);
|
|
|
|
void add_desktop(monitor_t *, desktop_t *);
|
2012-12-27 22:36:06 +01:00
|
|
|
void empty_desktop(desktop_t *);
|
2013-05-31 16:10:54 +02:00
|
|
|
void unlink_desktop(monitor_t *, desktop_t *);
|
2012-12-26 14:39:46 +01:00
|
|
|
void remove_desktop(monitor_t *, desktop_t *);
|
2013-09-10 11:45:46 +02:00
|
|
|
void swap_desktops(monitor_t *, desktop_t *, desktop_t *);
|
2013-06-02 11:15:19 +02:00
|
|
|
void transfer_desktop(monitor_t *, monitor_t *, desktop_t *);
|
2013-03-03 12:41:29 +01:00
|
|
|
rule_t *make_rule(void);
|
|
|
|
pointer_state_t *make_pointer_state(void);
|
2012-09-05 14:07:06 +02:00
|
|
|
client_t *make_client(xcb_window_t);
|
2012-11-04 12:27:39 +01:00
|
|
|
focus_history_t *make_focus_history(void);
|
|
|
|
node_list_t *make_node_list(void);
|
|
|
|
void history_add(focus_history_t *, node_t *);
|
|
|
|
void history_remove(focus_history_t *, node_t *);
|
2013-03-03 12:41:29 +01:00
|
|
|
void empty_history(focus_history_t *);
|
|
|
|
node_t *history_get(focus_history_t *, int);
|
2013-07-19 10:45:55 +02:00
|
|
|
node_t *history_last(focus_history_t *, node_t *, client_select_t);
|
2013-06-24 16:25:50 +02:00
|
|
|
int history_rank(focus_history_t *, node_t *);
|
2012-08-18 11:18:19 +02:00
|
|
|
|
2012-07-31 14:32:13 +02:00
|
|
|
#endif
|