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-09-03 12:07:53 +02:00
|
|
|
#include <xcb/xcb_icccm.h>
|
2008-09-16 14:09:56 +02:00
|
|
|
#include <xcb/xcb_property.h>
|
2008-03-21 16:50:17 +01:00
|
|
|
|
2008-11-19 02:22:05 +01:00
|
|
|
#include "config.h"
|
2008-09-17 16:38:38 +02:00
|
|
|
#include "luaa.h"
|
2008-01-13 15:44:01 +01:00
|
|
|
#include "layout.h"
|
2008-09-11 14:11:13 +02:00
|
|
|
#include "swindow.h"
|
2008-10-31 17:08:32 +01:00
|
|
|
#include "keybinding.h"
|
2008-05-30 12:30:20 +02:00
|
|
|
#include "common/xutil.h"
|
2008-06-14 18:12:16 +02:00
|
|
|
#include "common/xembed.h"
|
2008-05-20 15:39:47 +02:00
|
|
|
#include "common/refcount.h"
|
2008-01-13 15:44:01 +01:00
|
|
|
|
2008-09-03 14:59:18 +02:00
|
|
|
/** Windows type */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
WINDOW_TYPE_NORMAL = 0,
|
|
|
|
WINDOW_TYPE_DESKTOP,
|
|
|
|
WINDOW_TYPE_DOCK,
|
|
|
|
WINDOW_TYPE_SPLASH,
|
|
|
|
WINDOW_TYPE_DIALOG,
|
|
|
|
} window_type_t;
|
|
|
|
|
2008-09-21 20:39:23 +02:00
|
|
|
/** Wibox types */
|
|
|
|
typedef enum
|
|
|
|
{
|
2008-09-24 12:13:21 +02:00
|
|
|
WIBOX_TYPE_NORMAL = 0,
|
2008-09-21 20:39:23 +02:00
|
|
|
WIBOX_TYPE_TITLEBAR
|
|
|
|
} wibox_type_t;
|
|
|
|
|
2008-06-03 18:41:54 +02:00
|
|
|
typedef struct button_t button_t;
|
|
|
|
typedef struct widget_t widget_t;
|
|
|
|
typedef struct widget_node_t widget_node_t;
|
|
|
|
typedef struct client_t client_t;
|
2008-10-24 20:40:02 +02:00
|
|
|
typedef struct client_node client_node_t;
|
2008-10-21 17:33:16 +02:00
|
|
|
typedef struct tag tag_t;
|
2008-06-09 21:43:09 +02:00
|
|
|
typedef struct tag_client_node_t tag_client_node_t;
|
2008-11-12 14:55:30 +01:00
|
|
|
typedef widget_t *(widget_constructor_t)(widget_t *);
|
2008-06-14 22:38:40 +02:00
|
|
|
typedef void (widget_destructor_t)(widget_t *);
|
2008-06-03 18:41:54 +02:00
|
|
|
typedef struct awesome_t awesome_t;
|
2008-01-13 15:44:01 +01:00
|
|
|
|
2008-10-21 17:21:21 +02:00
|
|
|
ARRAY_TYPE(widget_node_t, widget_node)
|
2008-10-24 20:38:29 +02:00
|
|
|
ARRAY_TYPE(button_t *, button)
|
2008-10-21 17:21:21 +02:00
|
|
|
|
2008-09-21 10:13:21 +02:00
|
|
|
/** Wibox type */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** Ref count */
|
|
|
|
int refcount;
|
2008-09-22 19:23:28 +02:00
|
|
|
/** Ontop */
|
|
|
|
bool ontop;
|
2008-09-23 17:20:07 +02:00
|
|
|
/** Visible */
|
|
|
|
bool isvisible;
|
2008-09-24 12:13:21 +02:00
|
|
|
/** Position */
|
|
|
|
position_t position;
|
2008-09-21 20:39:23 +02:00
|
|
|
/** Wibox type */
|
|
|
|
wibox_type_t type;
|
2008-09-21 10:13:21 +02:00
|
|
|
/** Window */
|
|
|
|
simple_window_t sw;
|
|
|
|
/** Alignment */
|
|
|
|
alignment_t align;
|
|
|
|
/** Screen */
|
|
|
|
int screen;
|
|
|
|
/** Widget list */
|
2008-10-21 17:21:21 +02:00
|
|
|
widget_node_array_t widgets;
|
2008-10-19 19:14:55 +02:00
|
|
|
luaA_ref widgets_table;
|
2008-09-21 10:13:21 +02:00
|
|
|
/** Widget the mouse is over */
|
2008-10-21 17:21:21 +02:00
|
|
|
widget_t *mouse_over;
|
2008-09-21 10:13:21 +02:00
|
|
|
/** Need update */
|
|
|
|
bool need_update;
|
2008-11-13 11:04:07 +01:00
|
|
|
/** Cursor */
|
|
|
|
char *cursor;
|
2008-09-21 10:13:21 +02:00
|
|
|
} wibox_t;
|
|
|
|
ARRAY_TYPE(wibox_t *, wibox)
|
|
|
|
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Widget */
|
2008-04-11 11:26:37 +02:00
|
|
|
struct widget_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Ref count */
|
|
|
|
int refcount;
|
2008-06-14 18:12:16 +02:00
|
|
|
/** Widget type is constructor */
|
|
|
|
widget_constructor_t *type;
|
2008-06-14 22:38:40 +02:00
|
|
|
/** Widget destructor */
|
|
|
|
widget_destructor_t *destructor;
|
2008-10-22 17:32:17 +02:00
|
|
|
/** Geometry function */
|
|
|
|
area_t (*geometry)(widget_t *, int, int, int);
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Draw function */
|
2008-10-22 17:32:17 +02:00
|
|
|
void (*draw)(widget_t *, draw_context_t *, area_t, int, wibox_t *);
|
2008-06-25 17:47:51 +02:00
|
|
|
/** Index function */
|
2008-07-01 15:27:41 +02:00
|
|
|
int (*index)(lua_State *, awesome_token_t);
|
2008-06-27 12:43:39 +02:00
|
|
|
/** Newindex function */
|
2008-07-01 15:27:41 +02:00
|
|
|
int (*newindex)(lua_State *, awesome_token_t);
|
2008-08-25 14:34:56 +02:00
|
|
|
/** Mouse over event handler */
|
|
|
|
luaA_ref mouse_enter, mouse_leave;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Alignement */
|
2008-05-20 15:39:47 +02:00
|
|
|
alignment_t align;
|
2008-10-23 17:28:07 +02:00
|
|
|
/** Supported alignment */
|
|
|
|
alignment_t align_supported;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Misc private data */
|
|
|
|
void *data;
|
2008-05-23 13:35:46 +02:00
|
|
|
/** Button bindings */
|
2008-08-12 13:23:10 +02:00
|
|
|
button_array_t buttons;
|
2008-05-23 19:29:55 +02:00
|
|
|
/** True if the widget is visible */
|
|
|
|
bool isvisible;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
2008-09-03 22:15:14 +02:00
|
|
|
/* Strut */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint16_t left, right, top, bottom;
|
|
|
|
uint16_t left_start_y, left_end_y;
|
|
|
|
uint16_t right_start_y, right_end_y;
|
|
|
|
uint16_t top_start_x, top_end_x;
|
|
|
|
uint16_t bottom_start_x, bottom_end_x;
|
|
|
|
} strut_t;
|
|
|
|
|
2008-04-11 11:35:11 +02:00
|
|
|
/** client_t type */
|
|
|
|
struct client_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
2008-07-31 17:29:05 +02:00
|
|
|
/** Ref counter */
|
|
|
|
int refcount;
|
|
|
|
/** Valid, or not ? */
|
|
|
|
bool invalid;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Client name */
|
2008-10-21 15:12:55 +02:00
|
|
|
char *name, *icon_name;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** 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-06-18 13:56:03 +02:00
|
|
|
/* Size hints */
|
2008-01-13 15:44:01 +01:00
|
|
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
|
|
|
int minax, maxax, minay, maxay;
|
2008-09-03 22:15:14 +02:00
|
|
|
/** Strut */
|
|
|
|
strut_t strut;
|
2008-06-25 15:42:07 +02:00
|
|
|
/** Respect resize hints */
|
|
|
|
bool honorsizehints;
|
2008-01-13 15:44:01 +01:00
|
|
|
int border, oldborder;
|
2008-07-01 20:07:21 +02:00
|
|
|
xcolor_t border_color;
|
2008-08-21 16:29:53 +02:00
|
|
|
/** True if the client is sticky */
|
|
|
|
bool issticky;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Has urgency hint */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool isurgent;
|
|
|
|
/** true if the window is floating */
|
|
|
|
bool isfloating;
|
2008-06-09 18:24:12 +02:00
|
|
|
/** True if the client is hidden */
|
|
|
|
bool ishidden;
|
2008-09-06 13:52:05 +02:00
|
|
|
/** True if the client is minimized */
|
|
|
|
bool isminimized;
|
2008-08-21 17:52:44 +02:00
|
|
|
/** True if the client is fullscreen */
|
|
|
|
bool isfullscreen;
|
|
|
|
/** True if the client is above others */
|
|
|
|
bool isabove;
|
|
|
|
/** True if the client is below others */
|
|
|
|
bool isbelow;
|
|
|
|
/** True if the client is modal */
|
|
|
|
bool ismodal;
|
|
|
|
/** True if the client is on top */
|
|
|
|
bool isontop;
|
2008-11-20 22:11:13 +01:00
|
|
|
/** True if a client is banned to a position outside the viewport.
|
|
|
|
* Note that the geometry remains unchanged and that the window is still mapped.
|
|
|
|
*/
|
|
|
|
bool isbanned;
|
2008-03-21 16:50:17 +01:00
|
|
|
/** true if the client must be skipped from task bar client list */
|
|
|
|
bool skiptb;
|
2008-09-03 16:51:46 +02:00
|
|
|
/** True if the client cannot have focus */
|
|
|
|
bool nofocus;
|
2008-09-03 14:59:18 +02:00
|
|
|
/** The window type */
|
|
|
|
window_type_t type;
|
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-06-09 21:43:09 +02:00
|
|
|
/** Client logical screen */
|
|
|
|
int screen;
|
2008-03-21 10:53:17 +01:00
|
|
|
/** Client physical screen */
|
|
|
|
int phys_screen;
|
2008-05-20 22:37:08 +02:00
|
|
|
/** Path to an icon */
|
|
|
|
char *icon_path;
|
2008-06-04 11:50:21 +02:00
|
|
|
/** Titlebar */
|
2008-09-21 10:13:21 +02:00
|
|
|
wibox_t *titlebar;
|
2008-06-13 15:35:47 +02:00
|
|
|
/** Button bindings */
|
2008-08-12 13:23:10 +02:00
|
|
|
button_array_t buttons;
|
2008-08-11 23:10:02 +02:00
|
|
|
/** Icon */
|
2008-09-11 15:26:56 +02:00
|
|
|
image_t *icon;
|
2008-09-03 12:07:53 +02:00
|
|
|
/** Size hints */
|
|
|
|
xcb_size_hints_t size_hints;
|
2008-09-16 18:07:42 +02:00
|
|
|
/** Window it is transient for */
|
|
|
|
client_t *transient_for;
|
2008-06-09 18:24:12 +02:00
|
|
|
/** Next and previous clients */
|
|
|
|
client_t *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
2008-10-21 17:33:16 +02:00
|
|
|
ARRAY_TYPE(client_t *, client)
|
2008-01-13 15:44:01 +01:00
|
|
|
|
2008-06-09 21:43:09 +02:00
|
|
|
/** Tag type */
|
2008-10-21 17:33:16 +02:00
|
|
|
struct tag
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Ref count */
|
|
|
|
int refcount;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Tag name */
|
|
|
|
char *name;
|
2008-06-09 21:43:09 +02:00
|
|
|
/** Screen */
|
|
|
|
int screen;
|
|
|
|
/** true if selected */
|
|
|
|
bool selected;
|
|
|
|
/** Current tag layout */
|
2008-05-23 13:33:57 +02:00
|
|
|
layout_t *layout;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Master width factor */
|
|
|
|
double mwfact;
|
|
|
|
/** Number of master windows */
|
|
|
|
int nmaster;
|
|
|
|
/** Number of columns in tile layout */
|
|
|
|
int ncol;
|
2008-06-24 14:16:37 +02:00
|
|
|
/** clients in this tag */
|
|
|
|
client_array_t clients;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
2008-07-24 15:23:18 +02:00
|
|
|
ARRAY_TYPE(tag_t *, tag)
|
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;
|
2008-06-04 15:30:47 +02:00
|
|
|
} padding_t;
|
2008-01-13 15:44:01 +01:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2008-08-11 17:14:02 +02:00
|
|
|
/** Screen index */
|
|
|
|
int index;
|
|
|
|
/** Screen geometry */
|
|
|
|
area_t geometry;
|
2008-06-09 21:43:09 +02:00
|
|
|
/** true if we need to arrange() */
|
|
|
|
bool need_arrange;
|
|
|
|
/** Tag list */
|
2008-06-23 17:37:19 +02:00
|
|
|
tag_array_t tags;
|
2008-09-24 12:13:21 +02:00
|
|
|
/** Wiboxes */
|
|
|
|
wibox_array_t wiboxes;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Padding */
|
2008-06-04 15:30:47 +02:00
|
|
|
padding_t padding;
|
2008-06-15 10:25:26 +02:00
|
|
|
/** Window that contains the systray */
|
2008-06-23 11:41:16 +02:00
|
|
|
struct
|
|
|
|
{
|
2008-06-17 13:33:17 +02:00
|
|
|
xcb_window_t window;
|
2008-09-01 17:54:53 +02:00
|
|
|
/** Systray window parent */
|
|
|
|
xcb_window_t parent;
|
2008-06-17 13:33:17 +02:00
|
|
|
} systray;
|
2008-07-31 15:51:28 +02:00
|
|
|
/** Focused client */
|
|
|
|
client_t *client_focus;
|
2008-05-24 09:01:49 +02:00
|
|
|
} screen_t;
|
2008-01-13 15:44:01 +01:00
|
|
|
|
|
|
|
/** Main configuration structure */
|
2008-05-24 08:59:27 +02:00
|
|
|
struct awesome_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
2008-03-21 16:50:17 +01:00
|
|
|
/** Connection ref */
|
|
|
|
xcb_connection_t *connection;
|
|
|
|
/** Event and error handlers */
|
2008-09-16 15:36:44 +02:00
|
|
|
xcb_event_handlers_t evenths;
|
2008-09-16 14:09:56 +02:00
|
|
|
/** Property change handler */
|
|
|
|
xcb_property_handlers_t prophs;
|
2008-03-21 16:50:17 +01:00
|
|
|
/** 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 */
|
2008-05-24 09:01:49 +02:00
|
|
|
screen_t *screens;
|
2008-09-18 16:03:05 +02:00
|
|
|
/** Number of screens */
|
|
|
|
int nscreen;
|
|
|
|
/** True if xinerama is active */
|
|
|
|
bool xinerama_is_active;
|
2008-10-31 17:08:32 +01:00
|
|
|
/** Key bindings */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
keybinding_array_t by_code;
|
|
|
|
keybinding_array_t by_sym;
|
|
|
|
} keys;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Mouse bindings list */
|
2008-08-12 13:23:10 +02:00
|
|
|
button_array_t buttons;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** 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 XRandR extension */
|
2008-03-21 16:50:17 +01:00
|
|
|
bool have_randr;
|
2008-06-03 18:41:54 +02:00
|
|
|
/** Clients list */
|
2008-04-11 11:35:11 +02:00
|
|
|
client_t *clients;
|
2008-06-14 18:12:16 +02:00
|
|
|
/** Embedded windows */
|
|
|
|
xembed_window_t *embedded;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Path to config file */
|
2008-09-30 15:35:47 +02:00
|
|
|
char *conffile;
|
2008-05-25 19:30:54 +02:00
|
|
|
/** Stack client history */
|
|
|
|
client_node_t *stack;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Command line passed to awesome */
|
|
|
|
char *argv;
|
2008-03-04 10:14:13 +01:00
|
|
|
/** Last XMotionEvent coords */
|
|
|
|
int pointer_x, pointer_y;
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Lua VM state */
|
|
|
|
lua_State *L;
|
|
|
|
/** Default colors */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
xcolor_t fg, bg;
|
|
|
|
} colors;
|
|
|
|
/** Default font */
|
|
|
|
font_t *font;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
/** Command to execute when spawning a new client */
|
2008-08-11 10:12:12 +02:00
|
|
|
luaA_ref manage;
|
2008-06-10 19:03:10 +02:00
|
|
|
/** Command to execute when unmanaging client */
|
2008-08-11 10:12:12 +02:00
|
|
|
luaA_ref unmanage;
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Command to execute when giving focus to a client */
|
2008-08-11 10:12:12 +02:00
|
|
|
luaA_ref focus;
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Command to execute when removing focus to a client */
|
2008-08-11 10:12:12 +02:00
|
|
|
luaA_ref unfocus;
|
2008-09-22 17:54:48 +02:00
|
|
|
/** Command to run when mouse enter a client */
|
|
|
|
luaA_ref mouse_enter;
|
2008-05-23 17:09:34 +02:00
|
|
|
/** Command to run on arrange */
|
2008-08-11 10:12:12 +02:00
|
|
|
luaA_ref arrange;
|
2008-10-20 15:01:16 +02:00
|
|
|
/** Command to run when client list changes */
|
|
|
|
luaA_ref clients;
|
2008-10-19 19:14:55 +02:00
|
|
|
/** Command to run on numbers of tag changes */
|
|
|
|
luaA_ref tags;
|
|
|
|
/** Command to run when client gets (un)tagged */
|
|
|
|
luaA_ref tagged;
|
2008-09-22 17:54:48 +02:00
|
|
|
/** Command to run on property change */
|
|
|
|
luaA_ref property;
|
2008-05-29 13:47:11 +02:00
|
|
|
/** Command to run on time */
|
2008-08-11 10:12:12 +02:00
|
|
|
luaA_ref timer;
|
2008-11-19 02:22:05 +01:00
|
|
|
#ifdef WITH_DBUS
|
|
|
|
/** Command to run on dbus events */
|
|
|
|
luaA_ref dbus;
|
|
|
|
#endif
|
2008-05-20 15:39:47 +02:00
|
|
|
} hooks;
|
2008-06-17 00:30:53 +02:00
|
|
|
/** The event loop */
|
|
|
|
struct ev_loop *loop;
|
2008-05-29 13:47:11 +02:00
|
|
|
/** The timeout after which we need to stop select() */
|
2008-06-17 00:30:53 +02:00
|
|
|
struct ev_timer timer;
|
2008-06-10 16:50:55 +02:00
|
|
|
/** The key grabber function */
|
2008-08-11 10:12:12 +02:00
|
|
|
luaA_ref keygrabber;
|
2008-11-13 16:08:34 +01:00
|
|
|
/** The mouse pointer grabber function */
|
|
|
|
luaA_ref mousegrabber;
|
2008-07-31 15:51:28 +02:00
|
|
|
/** Focused screen */
|
|
|
|
screen_t *screen_focus;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|