bspwm/types.h

337 lines
6.9 KiB
C
Raw Normal View History

/* Copyright (c) 2012, Bastien Dejean
2013-10-08 21:05:56 +02:00
* All rights reserved.
2014-01-19 14:41:37 +01:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
2014-01-19 14:41:37 +01:00
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
2014-01-19 14:41:37 +01:00
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
2013-10-08 21:05:56 +02:00
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2013-10-08 21:05:56 +02:00
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BSPWM_TYPES_H
#define BSPWM_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>
2016-04-07 18:08:32 +02:00
#include <xcb/xcb_icccm.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
#define MISSING_VALUE "N/A"
2015-12-22 19:25:45 +01:00
#define MAX_WM_STATES 4
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
2012-08-19 10:34:08 +02:00
} split_mode_t;
typedef enum {
STATE_TILED,
STATE_PSEUDO_TILED,
STATE_FLOATING,
STATE_FULLSCREEN
} client_state_t;
2016-04-07 18:08:32 +02:00
typedef enum {
WM_FLAG_MODAL = 1 << 0,
WM_FLAG_STICKY = 1 << 1,
WM_FLAG_MAXIMIZED_VERT = 1 << 2,
WM_FLAG_MAXIMIZED_HORZ = 1 << 3,
WM_FLAG_SHADED = 1 << 4,
WM_FLAG_SKIP_TASKBAR = 1 << 5,
WM_FLAG_SKIP_PAGER = 1 << 6,
WM_FLAG_HIDDEN = 1 << 7,
WM_FLAG_FULLSCREEN = 1 << 8,
WM_FLAG_ABOVE = 1 << 9,
WM_FLAG_BELOW = 1 << 10,
WM_FLAG_DEMANDS_ATTENTION = 1 << 11,
} wm_flags_t;
typedef enum {
LAYER_BELOW,
LAYER_NORMAL,
LAYER_ABOVE
} stack_layer_t;
2012-10-17 16:18:40 +02:00
typedef enum {
2015-10-27 21:26:09 +01:00
OPTION_NONE,
OPTION_TRUE,
OPTION_FALSE
} option_bool_t;
2013-06-27 19:25:55 +02:00
2012-08-25 15:24:35 +02:00
typedef enum {
ALTER_TOGGLE,
ALTER_SET
2013-10-05 22:32:40 +02:00
} alter_state_t;
2012-08-25 15:24:35 +02:00
typedef enum {
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
2012-11-01 22:47:03 +01:00
} circulate_dir_t;
2013-10-08 13:59:17 +02:00
typedef enum {
HISTORY_OLDER,
HISTORY_NEWER
2013-10-08 13:59:17 +02:00
} history_dir_t;
2012-08-03 19:40:26 +02:00
typedef enum {
2015-12-22 19:25:45 +01:00
DIR_NORTH,
DIR_WEST,
DIR_SOUTH,
DIR_EAST
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 {
2016-04-07 18:08:32 +02:00
HANDLE_LEFT = 1 << 0,
HANDLE_TOP = 1 << 1,
HANDLE_RIGHT = 1 << 2,
HANDLE_BOTTOM = 1 << 3,
HANDLE_TOP_LEFT = HANDLE_TOP | HANDLE_LEFT,
HANDLE_TOP_RIGHT = HANDLE_TOP | HANDLE_RIGHT,
HANDLE_BOTTOM_RIGHT = HANDLE_BOTTOM | HANDLE_RIGHT,
HANDLE_BOTTOM_LEFT = HANDLE_BOTTOM | HANDLE_LEFT
} resize_handle_t;
typedef enum {
ACTION_FOCUS,
ACTION_MOVE,
ACTION_RESIZE_SIDE,
ACTION_RESIZE_CORNER
} pointer_action_t;
typedef enum {
LAYOUT_TILED,
LAYOUT_MONOCLE
} layout_t;
typedef enum {
FLIP_HORIZONTAL,
FLIP_VERTICAL
} flip_t;
typedef enum {
FIRST_CHILD,
SECOND_CHILD
} child_polarity_t;
typedef struct {
2015-12-22 19:25:45 +01:00
option_bool_t automatic;
option_bool_t focused;
option_bool_t local;
option_bool_t leaf;
option_bool_t window;
option_bool_t tiled;
2015-10-27 21:26:09 +01:00
option_bool_t pseudo_tiled;
option_bool_t floating;
2015-10-27 21:26:09 +01:00
option_bool_t fullscreen;
2016-04-16 18:13:31 +02:00
option_bool_t hidden;
2015-10-27 21:26:09 +01:00
option_bool_t sticky;
option_bool_t private;
2016-04-16 18:13:31 +02:00
option_bool_t locked;
2015-10-27 21:26:09 +01:00
option_bool_t urgent;
option_bool_t same_class;
option_bool_t descendant_of;
option_bool_t ancestor_of;
2015-11-23 10:40:10 +01:00
option_bool_t below;
option_bool_t normal;
option_bool_t above;
2015-12-22 19:25:45 +01:00
} node_select_t;
2015-10-27 21:26:09 +01:00
typedef struct {
option_bool_t occupied;
option_bool_t focused;
2015-10-27 21:26:09 +01:00
option_bool_t urgent;
option_bool_t local;
} desktop_select_t;
typedef struct {
option_bool_t occupied;
option_bool_t focused;
} monitor_select_t;
2016-04-07 18:08:32 +02:00
typedef struct icccm_props_t icccm_props_t;
struct icccm_props_t {
bool take_focus;
bool input_hint;
};
2012-07-30 10:29:21 +02:00
typedef struct {
2014-03-29 10:56:22 +01:00
char class_name[3 * SMALEN / 2];
char instance_name[3 * SMALEN / 2];
unsigned int border_width;
bool urgent;
2016-04-16 18:13:31 +02:00
bool shown;
client_state_t state;
client_state_t last_state;
stack_layer_t layer;
stack_layer_t last_layer;
xcb_rectangle_t floating_rectangle;
xcb_rectangle_t tiled_rectangle;
2016-04-07 18:08:32 +02:00
xcb_size_hints_t size_hints;
icccm_props_t icccm_props;
wm_flags_t wm_flags;
2012-08-29 18:37:31 +02:00
} client_t;
2012-07-30 10:29:21 +02:00
2015-12-22 19:25:45 +01:00
typedef struct presel_t presel_t;
struct presel_t {
double split_ratio;
direction_t split_dir;
xcb_window_t feedback;
};
2012-08-29 18:37:31 +02:00
typedef struct node_t node_t;
struct node_t {
2015-12-22 19:25:45 +01:00
uint32_t id;
split_type_t split_type;
double split_ratio;
int birth_rotation;
2015-12-22 19:25:45 +01:00
presel_t *presel;
xcb_rectangle_t rectangle;
2015-12-22 19:25:45 +01:00
bool vacant;
2016-04-16 18:13:31 +02:00
bool hidden;
2015-12-22 19:25:45 +01:00
bool sticky;
bool private;
bool locked;
node_t *first_child;
node_t *second_child;
node_t *parent;
2015-12-22 19:25:45 +01:00
client_t *client;
2012-08-17 22:18:26 +02:00
};
2012-07-30 10:29:21 +02:00
typedef struct padding_t padding_t;
struct padding_t {
int top;
int right;
int bottom;
int left;
};
2012-08-29 18:37:31 +02:00
typedef struct desktop_t desktop_t;
struct desktop_t {
char name[SMALEN];
uint32_t id;
layout_t layout;
node_t *root;
node_t *focus;
desktop_t *prev;
desktop_t *next;
padding_t padding;
int window_gap;
unsigned int border_width;
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[SMALEN];
uint32_t id;
xcb_randr_output_t randr_id;
xcb_window_t root;
bool wired;
padding_t padding;
2015-12-22 19:25:45 +01:00
unsigned int sticky_count;
int window_gap;
unsigned int border_width;
xcb_rectangle_t rectangle;
desktop_t *desk;
desktop_t *desk_head;
desktop_t *desk_tail;
monitor_t *prev;
monitor_t *next;
2012-10-17 16:18:40 +02:00
};
typedef struct {
monitor_t *monitor;
desktop_t *desktop;
node_t *node;
} coordinates_t;
typedef struct history_t history_t;
struct history_t {
coordinates_t loc;
bool latest;
history_t *prev;
history_t *next;
};
typedef struct stacking_list_t stacking_list_t;
struct stacking_list_t {
node_t *node;
stacking_list_t *prev;
stacking_list_t *next;
};
typedef struct subscriber_list_t subscriber_list_t;
struct subscriber_list_t {
int fd;
FILE *stream;
int field;
subscriber_list_t *prev;
subscriber_list_t *next;
};
typedef struct rule_t rule_t;
struct rule_t {
2015-12-22 19:25:45 +01:00
char class_name[MAXLEN];
char instance_name[MAXLEN];
char effect[MAXLEN];
bool one_shot;
rule_t *prev;
rule_t *next;
};
2012-09-11 13:12:53 +02:00
typedef struct {
2014-03-29 10:56:22 +01:00
char class_name[3 * SMALEN / 2];
char instance_name[3 * SMALEN / 2];
char monitor_desc[MAXLEN];
char desktop_desc[MAXLEN];
char node_desc[MAXLEN];
char split_dir[SMALEN];
2015-12-22 19:25:45 +01:00
double split_ratio;
stack_layer_t *layer;
client_state_t *state;
2016-04-16 18:13:31 +02:00
bool hidden;
bool sticky;
bool private;
2016-04-16 18:13:31 +02:00
bool locked;
bool center;
bool follow;
bool manage;
bool focus;
2014-08-14 18:14:25 +02:00
bool border;
2013-11-05 20:09:24 +01:00
} rule_consequence_t;
typedef struct pending_rule_t pending_rule_t;
struct pending_rule_t {
int fd;
xcb_window_t win;
rule_consequence_t *csq;
pending_rule_t *prev;
pending_rule_t *next;
};
2012-07-31 14:32:13 +02:00
#endif