X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=types.h;h=0d3d1ef5329882fbc53d579684401d2e27437a17;hb=e0b6cd3cd42863addcc9a719ea6fe2e44883c72d;hp=038bf8b771acb517a16e36c6593a1008fcd068b0;hpb=1b5b633e7a957edeecad7bf64c2c56c98f39cf46;p=bspwm.git diff --git a/types.h b/types.h index 038bf8b..0d3d1ef 100644 --- a/types.h +++ b/types.h @@ -1,5 +1,29 @@ -#ifndef _TYPES_H -#define _TYPES_H +/* * 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. + */ + +#ifndef BSPWM_TYPES_H +#define BSPWM_TYPES_H #include #include @@ -7,9 +31,8 @@ #include #include "helpers.h" -#define DEFAULT_DESK_NAME "Desktop" -#define DEFAULT_MON_NAME "Monitor" #define MISSING_VALUE "N/A" +#define MAX_STATE 4 typedef enum { TYPE_HORIZONTAL, @@ -21,11 +44,6 @@ typedef enum { MODE_MANUAL } split_mode_t; -typedef enum { - LAYOUT_TILED, - LAYOUT_MONOCLE -} layout_t; - typedef enum { MOVE_PULL, MOVE_PUSH @@ -48,47 +66,18 @@ typedef enum { CLIENT_CLASS_DIFFER } client_class_t; -typedef enum { - CLIENT_MODE_ALL, - CLIENT_MODE_AUTOMATIC, - CLIENT_MODE_MANUAL -} client_mode_t; - -typedef enum { - CLIENT_URGENCY_ALL, - CLIENT_URGENCY_ON, - CLIENT_URGENCY_OFF -} client_urgency_t; - typedef struct { client_type_t type; client_class_t class; - client_mode_t mode; - client_urgency_t urgency; + bool urgent; + bool manual; + bool local; } client_select_t; typedef enum { - ALTER_NONE, ALTER_TOGGLE, ALTER_SET -} state_alter_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; - desktop_urgency_t urgency; -} desktop_select_t; +} alter_state_t; typedef enum { CYCLE_NEXT, @@ -101,9 +90,9 @@ typedef enum { } circulate_dir_t; typedef enum { - FLIP_HORIZONTAL, - FLIP_VERTICAL -} flip_t; + HISTORY_OLDER, + HISTORY_NEWER +} history_dir_t; typedef enum { DIR_RIGHT, @@ -134,18 +123,50 @@ typedef enum { ACTION_RESIZE_CORNER } pointer_action_t; +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; + bool urgent; + bool local; +} desktop_select_t; + typedef struct { xcb_window_t window; - char class_name[MAXLEN]; + char class_name[SMALEN]; unsigned int border_width; bool floating; bool transient; /* transient window are always floating */ bool fullscreen; bool locked; /* protects window from being closed */ + bool sticky; bool urgent; - bool icccm_focus; /* send an event to request input focus */ + bool private; + bool icccm_focus; xcb_rectangle_t floating_rectangle; xcb_rectangle_t tiled_rectangle; + xcb_atom_t wm_state[MAX_STATE]; + int num_states; } client_t; typedef struct node_t node_t; @@ -157,52 +178,43 @@ struct node_t { int birth_rotation; xcb_rectangle_t rectangle; bool vacant; /* vacant nodes only hold floating clients */ + int privacy_level; node_t *first_child; node_t *second_child; node_t *parent; client_t *client; /* NULL except for leaves */ }; -typedef struct node_list_t node_list_t; -struct node_list_t { - node_t *node; - bool latest; /* used for z-ordering tiled windows */ - node_list_t *prev; - node_list_t *next; -}; - -typedef struct { - node_list_t *head; - node_list_t *tail; -} focus_history_t; - typedef struct desktop_t desktop_t; struct desktop_t { - char name[MAXLEN]; + char name[SMALEN]; layout_t layout; node_t *root; node_t *focus; - focus_history_t *history; desktop_t *prev; desktop_t *next; + int top_padding; + int right_padding; + int bottom_padding; + int left_padding; + int window_gap; + unsigned int border_width; + bool floating; }; typedef struct monitor_t monitor_t; struct monitor_t { - char name[MAXLEN]; + char name[SMALEN]; xcb_randr_output_t id; xcb_rectangle_t rectangle; + xcb_window_t root; bool wired; - int top_padding; - int right_padding; - int bottom_padding; - int left_padding; desktop_t *desk; - desktop_t *last_desk; desktop_t *desk_head; desktop_t *desk_tail; monitor_t *prev; monitor_t *next; + int num_sticky; }; typedef struct { @@ -211,26 +223,65 @@ typedef struct { node_t *node; } coordinates_t; -typedef struct { - char name[MAXLEN]; -} rule_cause_t; +typedef struct history_t history_t; +struct history_t { + coordinates_t loc; + bool latest; + history_t *prev; + history_t *next; +}; -typedef struct { - bool floating; - bool follow; - bool focus; - char desc[MAXLEN]; -} rule_effect_t; +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; + subscriber_list_t *prev; + subscriber_list_t *next; +}; typedef struct rule_t rule_t; struct rule_t { - unsigned int uid; - rule_cause_t cause; - rule_effect_t effect; + char cause[MAXLEN]; + char effect[MAXLEN]; + bool one_shot; rule_t *prev; rule_t *next; }; +typedef struct { + char class_name[SMALEN]; + char instance_name[SMALEN]; + char desktop_desc[MAXLEN]; + char monitor_desc[MAXLEN]; + bool floating; + bool transient; + bool fullscreen; + bool locked; + bool sticky; + bool private; + bool center; + bool lower; + bool follow; + bool manage; + bool focus; +} 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; +}; + typedef struct { xcb_point_t position; pointer_action_t action; @@ -254,32 +305,4 @@ typedef struct { unsigned int distance; } fence_distance_t; -node_t *make_node(void); -monitor_t *make_monitor(xcb_rectangle_t); -monitor_t *find_monitor(char *); -monitor_t *get_monitor_by_id(xcb_randr_output_t); -monitor_t *add_monitor(xcb_rectangle_t); -void remove_monitor(monitor_t *); -void merge_monitors(monitor_t *, monitor_t *); -void swap_monitors(monitor_t *, monitor_t *); -desktop_t *make_desktop(const char *); -void insert_desktop(monitor_t *, desktop_t *); -void add_desktop(monitor_t *, desktop_t *); -void empty_desktop(desktop_t *); -void unlink_desktop(monitor_t *, desktop_t *); -void remove_desktop(monitor_t *, desktop_t *); -void swap_desktops(monitor_t *, desktop_t *, desktop_t *); -void transfer_desktop(monitor_t *, monitor_t *, desktop_t *); -rule_t *make_rule(void); -pointer_state_t *make_pointer_state(void); -client_t *make_client(xcb_window_t); -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 *); -void empty_history(focus_history_t *); -node_t *history_get(focus_history_t *, int); -node_t *history_last(focus_history_t *, node_t *, client_select_t); -int history_rank(focus_history_t *, node_t *); - #endif