2013-10-08 21:05:56 +02:00
|
|
|
/* * Copyright (c) 2012-2013 Bastien Dejean
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
* are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright notice, this
|
|
|
|
* list of conditions and the following disclaimer.
|
|
|
|
* * 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.
|
|
|
|
*
|
|
|
|
* 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
* 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
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2013-10-08 21:02:33 +02:00
|
|
|
#ifndef BSPWM_TYPES_H
|
|
|
|
#define BSPWM_TYPES_H
|
2012-07-31 14:32:13 +02:00
|
|
|
|
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-09-24 19:40:49 +02:00
|
|
|
#define MISSING_VALUE "N/A"
|
2013-10-07 11:41:54 +02:00
|
|
|
#define MAX_STATE 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
|
|
|
|
} split_mode_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-08 11:42:05 +02:00
|
|
|
typedef struct {
|
|
|
|
client_type_t type;
|
|
|
|
client_class_t class;
|
2013-10-08 17:47:00 +02:00
|
|
|
bool urgent;
|
|
|
|
bool manual;
|
|
|
|
bool local;
|
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_TOGGLE,
|
|
|
|
ALTER_SET
|
2013-10-05 22:32:40 +02:00
|
|
|
} alter_state_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;
|
|
|
|
|
2012-11-01 22:47:03 +01:00
|
|
|
typedef enum {
|
|
|
|
CIRCULATE_FORWARD,
|
|
|
|
CIRCULATE_BACKWARD
|
|
|
|
} circulate_dir_t;
|
|
|
|
|
2013-10-08 13:59:17 +02:00
|
|
|
typedef enum {
|
|
|
|
HISTORY_OLDER,
|
|
|
|
HISTORY_NEWER
|
|
|
|
} history_dir_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
|
|
|
|
2013-09-19 15:02:49 +02:00
|
|
|
typedef enum {
|
|
|
|
LAYOUT_TILED,
|
|
|
|
LAYOUT_MONOCLE
|
|
|
|
} layout_t;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
FLIP_HORIZONTAL,
|
|
|
|
FLIP_VERTICAL
|
|
|
|
} flip_t;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
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;
|
2013-10-08 17:47:00 +02:00
|
|
|
bool urgent;
|
|
|
|
bool local;
|
2013-09-19 15:02:49 +02:00
|
|
|
} desktop_select_t;
|
|
|
|
|
2012-07-30 10:29:21 +02:00
|
|
|
typedef struct {
|
2012-08-18 22:36:46 +02:00
|
|
|
xcb_window_t window;
|
2013-09-21 12:39:59 +02:00
|
|
|
char class_name[SMALEN];
|
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 */
|
2013-10-01 18:04:18 +02:00
|
|
|
bool sticky;
|
2012-09-20 23:32:32 +02:00
|
|
|
bool urgent;
|
2013-10-10 18:24:21 +02:00
|
|
|
bool frame;
|
2013-10-12 21:16:51 +02:00
|
|
|
bool private;
|
2013-09-15 22:33:40 +02:00
|
|
|
bool icccm_focus;
|
2012-09-21 17:39:22 +02:00
|
|
|
xcb_rectangle_t floating_rectangle;
|
|
|
|
xcb_rectangle_t tiled_rectangle;
|
2013-10-07 11:41:54 +02:00
|
|
|
xcb_atom_t wm_state[MAX_STATE];
|
|
|
|
int num_states;
|
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 */
|
2013-10-12 21:16:51 +02:00
|
|
|
int privacy_level;
|
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 {
|
2013-09-21 12:39:59 +02:00
|
|
|
char name[SMALEN];
|
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;
|
|
|
|
desktop_t *prev;
|
|
|
|
desktop_t *next;
|
2013-09-11 21:19:59 +02:00
|
|
|
int window_gap;
|
2013-10-01 14:15:50 +02:00
|
|
|
unsigned int border_width;
|
2013-11-03 23:01:31 +01:00
|
|
|
bool floating;
|
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 {
|
2013-09-21 12:39:59 +02:00
|
|
|
char name[SMALEN];
|
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-09-22 11:16:06 +02:00
|
|
|
xcb_window_t root;
|
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 *desk_head;
|
|
|
|
desktop_t *desk_tail;
|
|
|
|
monitor_t *prev;
|
|
|
|
monitor_t *next;
|
2013-10-06 16:58:02 +02:00
|
|
|
int num_sticky;
|
2012-10-17 16:18:40 +02:00
|
|
|
};
|
|
|
|
|
2013-07-08 11:42:05 +02:00
|
|
|
typedef struct {
|
|
|
|
monitor_t *monitor;
|
|
|
|
desktop_t *desktop;
|
|
|
|
node_t *node;
|
|
|
|
} coordinates_t;
|
|
|
|
|
2013-10-01 10:48:03 +02:00
|
|
|
typedef struct history_t history_t;
|
|
|
|
struct history_t {
|
|
|
|
coordinates_t loc;
|
|
|
|
bool latest;
|
|
|
|
history_t *prev;
|
|
|
|
history_t *next;
|
|
|
|
};
|
|
|
|
|
2013-10-07 10:22:07 +02:00
|
|
|
typedef struct stacking_list_t stacking_list_t;
|
|
|
|
struct stacking_list_t {
|
2013-10-01 10:48:03 +02:00
|
|
|
node_t *node;
|
2013-10-07 10:22:07 +02:00
|
|
|
stacking_list_t *prev;
|
|
|
|
stacking_list_t *next;
|
2013-10-01 10:48:03 +02:00
|
|
|
};
|
|
|
|
|
2013-11-07 14:28:39 +01:00
|
|
|
typedef struct subscriber_list_t subscriber_list_t;
|
|
|
|
struct subscriber_list_t {
|
|
|
|
int fd;
|
|
|
|
FILE *stream;
|
|
|
|
subscriber_list_t *prev;
|
|
|
|
subscriber_list_t *next;
|
|
|
|
};
|
|
|
|
|
2012-09-11 13:12:53 +02:00
|
|
|
typedef struct {
|
2013-11-05 20:09:24 +01:00
|
|
|
char desktop_desc[MAXLEN];
|
|
|
|
char monitor_desc[MAXLEN];
|
2012-09-01 21:55:35 +02:00
|
|
|
bool floating;
|
2013-11-05 20:09:24 +01:00
|
|
|
bool transient;
|
2013-09-18 11:42:20 +02:00
|
|
|
bool fullscreen;
|
|
|
|
bool locked;
|
2013-10-01 18:04:18 +02:00
|
|
|
bool sticky;
|
2013-10-12 21:16:51 +02:00
|
|
|
bool private;
|
2013-11-05 20:09:24 +01:00
|
|
|
bool frame;
|
2013-10-27 11:25:34 +01:00
|
|
|
bool center;
|
2013-11-05 20:09:24 +01:00
|
|
|
bool lower;
|
|
|
|
bool follow;
|
|
|
|
bool manage;
|
|
|
|
bool focus;
|
|
|
|
} rule_consequence_t;
|
2012-09-01 21:55:35 +02:00
|
|
|
|
2013-11-08 20:31:23 +01:00
|
|
|
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-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-07-31 14:32:13 +02:00
|
|
|
#endif
|