2008-01-13 15:44:01 +01:00
|
|
|
/*
|
|
|
|
* structs.h - basic structs header
|
|
|
|
*
|
|
|
|
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AWESOME_STRUCTS_H
|
|
|
|
#define AWESOME_STRUCTS_H
|
|
|
|
|
2008-03-21 16:50:17 +01:00
|
|
|
#include <xcb/xcb_event.h>
|
|
|
|
|
2008-01-13 15:44:01 +01:00
|
|
|
#include <regex.h>
|
|
|
|
#include "layout.h"
|
2008-01-24 18:48:11 +01:00
|
|
|
#include "common/draw.h"
|
2008-01-26 17:58:01 +01:00
|
|
|
#include "common/swindow.h"
|
2008-03-13 09:28:21 +01:00
|
|
|
#include "common/xscreen.h"
|
2008-01-13 15:44:01 +01:00
|
|
|
|
2008-04-08 19:52:59 +02:00
|
|
|
/** stacking layout */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
LAYER_DESKTOP,
|
|
|
|
LAYER_BELOW,
|
|
|
|
LAYER_TILE,
|
|
|
|
LAYER_FLOAT,
|
|
|
|
LAYER_ABOVE,
|
|
|
|
LAYER_FULLSCREEN
|
2008-04-10 11:52:03 +02:00
|
|
|
} layer_t;
|
2008-04-08 19:52:59 +02:00
|
|
|
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Cursors */
|
|
|
|
enum
|
|
|
|
{ CurNormal, CurResize, CurMove, CurLast };
|
|
|
|
|
2008-03-14 20:35:24 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2008-04-09 19:41:28 +02:00
|
|
|
simple_window_t *sw;
|
2008-04-11 11:19:23 +02:00
|
|
|
position_t position;
|
|
|
|
position_t dposition;
|
2008-04-11 11:18:23 +02:00
|
|
|
alignment_t align;
|
|
|
|
alignment_t text_align;
|
2008-03-24 16:31:02 +01:00
|
|
|
int width, height;
|
2008-03-20 20:45:08 +01:00
|
|
|
/** Colors */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
style_t normal;
|
|
|
|
style_t focus;
|
|
|
|
style_t urgent;
|
|
|
|
} styles;
|
2008-04-10 11:53:44 +02:00
|
|
|
} titlebar_t;
|
2008-03-14 20:35:24 +01:00
|
|
|
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Rule type */
|
2008-04-10 11:55:36 +02:00
|
|
|
typedef struct rule_t rule_t;
|
|
|
|
struct rule_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
|
|
|
char *icon;
|
|
|
|
char *xprop;
|
|
|
|
int screen;
|
2008-04-11 11:19:53 +02:00
|
|
|
fuzzy_t isfloating;
|
|
|
|
fuzzy_t ismaster;
|
2008-04-10 11:53:44 +02:00
|
|
|
titlebar_t titlebar;
|
2008-01-25 23:48:24 +01:00
|
|
|
double opacity;
|
2008-01-13 15:44:01 +01:00
|
|
|
regex_t *prop_r;
|
|
|
|
regex_t *tags_r;
|
|
|
|
regex_t *xpropval_r;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous rules */
|
2008-04-10 11:55:36 +02:00
|
|
|
rule_t *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Key bindings */
|
|
|
|
typedef struct Key Key;
|
|
|
|
struct Key
|
|
|
|
{
|
|
|
|
unsigned long mod;
|
2008-03-21 16:50:17 +01:00
|
|
|
xcb_keysym_t keysym;
|
|
|
|
xcb_keycode_t keycode;
|
2008-04-11 11:22:09 +02:00
|
|
|
uicb_t *func;
|
2008-01-13 15:44:01 +01:00
|
|
|
char *arg;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous keys */
|
|
|
|
Key *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Mouse buttons bindings */
|
|
|
|
typedef struct Button Button;
|
|
|
|
struct Button
|
|
|
|
{
|
|
|
|
unsigned long mod;
|
|
|
|
unsigned int button;
|
2008-04-11 11:22:09 +02:00
|
|
|
uicb_t *func;
|
2008-01-13 15:44:01 +01:00
|
|
|
char *arg;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous buttons */
|
|
|
|
Button *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
2008-04-11 11:26:37 +02:00
|
|
|
/** widget_t tell status code */
|
2008-03-04 19:06:04 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
WIDGET_NOERROR = 0,
|
|
|
|
WIDGET_ERROR,
|
2008-03-06 14:30:18 +01:00
|
|
|
WIDGET_ERROR_NOVALUE,
|
2008-03-04 19:06:04 +01:00
|
|
|
WIDGET_ERROR_CUSTOM,
|
|
|
|
WIDGET_ERROR_FORMAT_BOOL,
|
|
|
|
WIDGET_ERROR_FORMAT_FONT,
|
2008-03-06 14:30:18 +01:00
|
|
|
WIDGET_ERROR_FORMAT_COLOR,
|
2008-03-04 19:06:04 +01:00
|
|
|
WIDGET_ERROR_FORMAT_SECTION
|
|
|
|
} widget_tell_status_t;
|
|
|
|
|
2008-04-11 11:26:37 +02:00
|
|
|
/** widget_t */
|
|
|
|
typedef struct widget_t widget_t;
|
2008-04-11 11:27:36 +02:00
|
|
|
typedef struct statusbar_t statusbar_t;
|
2008-04-11 11:26:37 +02:00
|
|
|
struct widget_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
2008-04-11 11:26:37 +02:00
|
|
|
/** widget_t name */
|
2008-01-13 15:44:01 +01:00
|
|
|
char *name;
|
|
|
|
/** Draw function */
|
2008-04-11 11:26:37 +02:00
|
|
|
int (*draw)(widget_t *, DrawCtx *, int, int);
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Update function */
|
2008-04-11 11:26:37 +02:00
|
|
|
widget_tell_status_t (*tell)(widget_t *, char *, char *);
|
2008-01-13 15:44:01 +01:00
|
|
|
/** ButtonPressedEvent handler */
|
2008-04-11 11:26:37 +02:00
|
|
|
void (*button_press)(widget_t *, xcb_button_press_event_t *);
|
2008-04-11 11:27:36 +02:00
|
|
|
/** statusbar_t */
|
|
|
|
statusbar_t *statusbar;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Alignement */
|
2008-04-11 11:18:23 +02:00
|
|
|
alignment_t alignment;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Misc private data */
|
|
|
|
void *data;
|
2008-03-21 16:50:17 +01:00
|
|
|
/** true if user supplied coords */
|
|
|
|
bool user_supplied_x;
|
|
|
|
bool user_supplied_y;
|
2008-03-14 09:37:25 +01:00
|
|
|
/** area_t */
|
|
|
|
area_t area;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Buttons bindings */
|
|
|
|
Button *buttons;
|
|
|
|
/** Cache */
|
|
|
|
struct
|
|
|
|
{
|
2008-03-21 16:50:17 +01:00
|
|
|
bool needs_update;
|
2008-01-13 15:44:01 +01:00
|
|
|
int flags;
|
|
|
|
} cache;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous widgets */
|
2008-04-11 11:26:37 +02:00
|
|
|
widget_t *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Status bar */
|
2008-04-11 11:27:36 +02:00
|
|
|
struct statusbar_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
2008-01-23 15:54:30 +01:00
|
|
|
/** Window */
|
2008-04-09 19:41:28 +02:00
|
|
|
simple_window_t *sw;
|
2008-04-11 11:27:36 +02:00
|
|
|
/** statusbar_t name */
|
2008-01-13 15:44:01 +01:00
|
|
|
char *name;
|
|
|
|
/** Bar width */
|
|
|
|
int width;
|
|
|
|
/** Bar height */
|
|
|
|
int height;
|
|
|
|
/** Default position */
|
2008-04-11 11:19:23 +02:00
|
|
|
position_t dposition;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Bar position */
|
2008-04-11 11:19:23 +02:00
|
|
|
position_t position;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Screen */
|
|
|
|
int screen;
|
2008-03-21 10:53:17 +01:00
|
|
|
/** Physical screen id */
|
|
|
|
int phys_screen;
|
2008-04-11 11:26:37 +02:00
|
|
|
/** widget_t list */
|
|
|
|
widget_t *widgets;
|
2008-03-20 09:08:15 +01:00
|
|
|
/** Draw context */
|
|
|
|
DrawCtx *ctx;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous statusbars */
|
2008-04-11 11:27:36 +02:00
|
|
|
statusbar_t *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
2008-04-11 11:35:11 +02:00
|
|
|
/** client_t type */
|
|
|
|
typedef struct client_t client_t;
|
|
|
|
struct client_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
|
|
|
/** Client name */
|
|
|
|
char name[256];
|
|
|
|
/** Window geometry */
|
2008-03-14 09:37:25 +01:00
|
|
|
area_t geometry;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Floating window geometry */
|
2008-03-14 09:37:25 +01:00
|
|
|
area_t f_geometry;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Max window geometry */
|
2008-03-14 09:37:25 +01:00
|
|
|
area_t m_geometry;
|
2008-01-13 15:44:01 +01:00
|
|
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
|
|
|
int minax, maxax, minay, maxay;
|
|
|
|
int border, oldborder;
|
|
|
|
/** Has urgency hint */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool isurgent;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Store previous floating state before maximizing */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool wasfloating;
|
|
|
|
/** true if the window is floating */
|
|
|
|
bool isfloating;
|
|
|
|
/** true if the window is fixed */
|
|
|
|
bool isfixed;
|
|
|
|
/** true if the window is maximized */
|
|
|
|
bool ismax;
|
|
|
|
/** true if the client must be skipped from client list */
|
|
|
|
bool skip;
|
|
|
|
/** true if the client is moving */
|
|
|
|
bool ismoving;
|
|
|
|
/** true if the client must be skipped from task bar client list */
|
|
|
|
bool skiptb;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous clients */
|
2008-04-11 11:35:11 +02:00
|
|
|
client_t *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Window of the client */
|
2008-03-21 16:50:17 +01:00
|
|
|
xcb_window_t win;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Client logical screen */
|
|
|
|
int screen;
|
2008-03-21 10:53:17 +01:00
|
|
|
/** Client physical screen */
|
|
|
|
int phys_screen;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** True if the client is a new one */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool newcomer;
|
2008-04-10 11:53:44 +02:00
|
|
|
/** titlebar_t */
|
|
|
|
titlebar_t titlebar;
|
2008-04-08 19:52:59 +02:00
|
|
|
/** layer in the stacking order */
|
2008-04-10 11:52:03 +02:00
|
|
|
layer_t layer;
|
|
|
|
layer_t oldlayer;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct client_node_t client_node_t;
|
|
|
|
struct client_node_t
|
|
|
|
{
|
2008-04-11 11:35:11 +02:00
|
|
|
client_t *client;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous client_nodes */
|
|
|
|
client_node_t *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Tag type */
|
2008-04-22 14:18:09 +02:00
|
|
|
typedef struct _tag_t tag_t;
|
|
|
|
struct _tag_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
|
|
|
/** Tag name */
|
|
|
|
char *name;
|
2008-01-17 18:43:55 +01:00
|
|
|
/** Screen */
|
|
|
|
int screen;
|
2008-03-21 16:50:17 +01:00
|
|
|
/** true if selected */
|
|
|
|
bool selected;
|
|
|
|
/** true if was selected before selecting others tags */
|
|
|
|
bool was_selected;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Current tag layout */
|
|
|
|
Layout *layout;
|
|
|
|
/** Master width factor */
|
|
|
|
double mwfact;
|
|
|
|
/** Number of master windows */
|
|
|
|
int nmaster;
|
|
|
|
/** Number of columns in tile layout */
|
|
|
|
int ncol;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous tags */
|
2008-04-22 14:18:09 +02:00
|
|
|
tag_t *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/** tag_client_node type */
|
|
|
|
typedef struct tag_client_node_t tag_client_node_t;
|
|
|
|
struct tag_client_node_t
|
|
|
|
{
|
2008-04-22 14:18:09 +02:00
|
|
|
tag_t *tag;
|
2008-04-11 11:35:11 +02:00
|
|
|
client_t *client;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous tag_client_nodes */
|
|
|
|
tag_client_node_t *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Padding type */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** Padding at top */
|
|
|
|
int top;
|
|
|
|
/** Padding at bottom */
|
|
|
|
int bottom;
|
|
|
|
/** Padding at left */
|
|
|
|
int left;
|
|
|
|
/** Padding at right */
|
|
|
|
int right;
|
|
|
|
} Padding;
|
|
|
|
|
2008-04-11 11:35:11 +02:00
|
|
|
typedef area_t (FloatingPlacement)(client_t *);
|
2008-01-13 15:44:01 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2008-04-10 11:53:44 +02:00
|
|
|
/** titlebar_t default parameters */
|
|
|
|
titlebar_t titlebar_default;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Number of pixels to snap windows */
|
|
|
|
int snap;
|
|
|
|
/** Border size */
|
|
|
|
int borderpx;
|
2008-03-08 10:48:15 +01:00
|
|
|
/** Mwfact limits */
|
|
|
|
float mwfact_upper_limit, mwfact_lower_limit;
|
2008-02-13 18:04:20 +01:00
|
|
|
/** Floating window placement algo */
|
|
|
|
FloatingPlacement *floating_placement;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Respect resize hints */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool resize_hints;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Sloppy focus: focus follow mouse */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool sloppy_focus;
|
|
|
|
/** true if we should raise windows on focus */
|
|
|
|
bool sloppy_focus_raise;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Focus new clients */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool new_get_focus;
|
|
|
|
/** true if new clients should become master */
|
|
|
|
bool new_become_master;
|
|
|
|
/** true if we need to arrange() */
|
|
|
|
bool need_arrange;
|
2008-03-13 14:03:03 +01:00
|
|
|
/** Colors */
|
|
|
|
struct
|
|
|
|
{
|
2008-03-14 08:35:06 +01:00
|
|
|
style_t normal;
|
|
|
|
style_t focus;
|
|
|
|
style_t urgent;
|
|
|
|
} styles;
|
2008-02-04 14:54:50 +01:00
|
|
|
/** Transparency of unfocused clients */
|
2008-03-23 20:38:16 +01:00
|
|
|
double opacity_unfocused;
|
2008-03-23 20:36:55 +01:00
|
|
|
/** Transparency of focused clients */
|
2008-03-23 20:38:16 +01:00
|
|
|
double opacity_focused;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Tag list */
|
2008-04-22 14:18:09 +02:00
|
|
|
tag_t *tags;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Layout list */
|
|
|
|
Layout *layouts;
|
|
|
|
/** Status bar */
|
2008-04-11 11:27:36 +02:00
|
|
|
statusbar_t *statusbar;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Padding */
|
2008-01-15 16:52:30 +01:00
|
|
|
Padding padding;
|
2008-01-13 15:44:01 +01:00
|
|
|
} VirtScreen;
|
|
|
|
|
|
|
|
/** Main configuration structure */
|
|
|
|
typedef struct AwesomeConf AwesomeConf;
|
|
|
|
struct AwesomeConf
|
|
|
|
{
|
2008-03-21 16:50:17 +01:00
|
|
|
/** Connection ref */
|
|
|
|
xcb_connection_t *connection;
|
|
|
|
/** Event and error handlers */
|
|
|
|
xcb_event_handlers_t *evenths;
|
|
|
|
/** Default screen number */
|
|
|
|
int default_screen;
|
2008-03-24 00:48:42 +01:00
|
|
|
/** Keys symbol table */
|
|
|
|
xcb_key_symbols_t *keysyms;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Logical screens */
|
|
|
|
VirtScreen *screens;
|
2008-03-13 09:28:21 +01:00
|
|
|
/** Screens info */
|
|
|
|
ScreensInfo *screens_info;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Rules list */
|
2008-04-10 11:55:36 +02:00
|
|
|
rule_t *rules;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Keys bindings list */
|
|
|
|
Key *keys;
|
|
|
|
/** Mouse bindings list */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Button *root;
|
|
|
|
Button *client;
|
2008-03-19 15:34:07 +01:00
|
|
|
Button *titlebar;
|
2008-01-13 15:44:01 +01:00
|
|
|
} buttons;
|
|
|
|
/** Numlock mask */
|
|
|
|
unsigned int numlockmask;
|
2008-03-24 00:48:42 +01:00
|
|
|
/** Numlock mask */
|
|
|
|
unsigned int shiftlockmask;
|
|
|
|
/** Numlock mask */
|
|
|
|
unsigned int capslockmask;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Check for XShape extension */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool have_shape;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Check for XRandR extension */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool have_randr;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Cursors */
|
2008-03-21 16:50:17 +01:00
|
|
|
xcb_cursor_t cursor[CurLast];
|
2008-04-11 11:35:11 +02:00
|
|
|
/** client_ts list */
|
|
|
|
client_t *clients;
|
2008-02-06 08:49:31 +01:00
|
|
|
/** Scratch client */
|
|
|
|
struct
|
|
|
|
{
|
2008-04-11 11:35:11 +02:00
|
|
|
client_t *client;
|
2008-03-21 16:50:17 +01:00
|
|
|
bool isvisible;
|
2008-02-06 08:49:31 +01:00
|
|
|
} scratch;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Path to config file */
|
|
|
|
char *configpath;
|
|
|
|
/** Selected clients history */
|
|
|
|
client_node_t *focus;
|
|
|
|
/** Link between tags and clients */
|
|
|
|
tag_client_node_t *tclink;
|
|
|
|
/** Command line passed to awesome */
|
|
|
|
char *argv;
|
2008-03-04 10:14:13 +01:00
|
|
|
/** Last XMotionEvent coords */
|
|
|
|
int pointer_x, pointer_y;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|