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-06-17 00:30:53 +02:00
|
|
|
#include <ev.h>
|
2008-03-21 16:50:17 +01:00
|
|
|
|
2008-05-20 15:39:47 +02:00
|
|
|
#include "lua.h"
|
2008-01-13 15:44:01 +01:00
|
|
|
#include "layout.h"
|
2008-05-30 12:30:20 +02:00
|
|
|
#include "common/xutil.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-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-05-20 19:47:29 +02:00
|
|
|
/** Stacking layout layers */
|
2008-04-08 19:52:59 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
2008-05-25 19:30:54 +02:00
|
|
|
LAYER_DESKTOP = 1,
|
2008-04-08 19:52:59 +02:00
|
|
|
LAYER_BELOW,
|
|
|
|
LAYER_TILE,
|
|
|
|
LAYER_FLOAT,
|
|
|
|
LAYER_ABOVE,
|
2008-06-13 14:41:10 +02:00
|
|
|
LAYER_FULLSCREEN,
|
|
|
|
LAYER_MODAL,
|
|
|
|
LAYER_OUTOFSPACE
|
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
|
2008-06-07 23:37:24 +02:00
|
|
|
{
|
|
|
|
CurNormal, CurResize, CurResizeH, CurResizeV, CurMove,
|
|
|
|
CurTopLeft, CurTopRight, CurBotLeft, CurBotRight, CurLast
|
|
|
|
};
|
2008-01-13 15:44:01 +01:00
|
|
|
|
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 statusbar_t statusbar_t;
|
|
|
|
typedef struct client_t client_t;
|
|
|
|
typedef struct titlebar_t titlebar_t;
|
2008-04-28 15:40:49 +02:00
|
|
|
typedef struct keybinding_t keybinding_t;
|
2008-06-03 18:41:54 +02:00
|
|
|
typedef struct client_node_t client_node_t;
|
2008-06-09 21:43:09 +02:00
|
|
|
typedef struct _tag_t tag_t;
|
|
|
|
typedef struct tag_client_node_t tag_client_node_t;
|
2008-06-15 10:55:07 +02:00
|
|
|
typedef area_t (floating_placement_t)(client_t *);
|
2008-06-14 18:12:16 +02:00
|
|
|
typedef widget_t *(widget_constructor_t)(alignment_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
|
|
|
|
|
|
|
/** Mouse buttons bindings */
|
2008-05-23 13:35:46 +02:00
|
|
|
struct button_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
2008-06-13 15:35:47 +02:00
|
|
|
/** Ref count */
|
|
|
|
int refcount;
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Key modifiers */
|
2008-01-13 15:44:01 +01:00
|
|
|
unsigned long mod;
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Mouse button number */
|
2008-01-13 15:44:01 +01:00
|
|
|
unsigned int button;
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Lua function to execute. */
|
|
|
|
luaA_function fct;
|
2008-03-10 10:37:23 +01:00
|
|
|
/** Next and previous buttons */
|
2008-05-23 13:35:46 +02:00
|
|
|
button_t *prev, *next;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
2008-05-23 13:35:46 +02:00
|
|
|
DO_SLIST(button_t, button, p_delete)
|
2008-06-13 15:35:47 +02:00
|
|
|
DO_RCNT(button_t, button, p_delete)
|
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-04-11 11:26:37 +02:00
|
|
|
/** widget_t name */
|
2008-01-13 15:44:01 +01:00
|
|
|
char *name;
|
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-01-13 15:44:01 +01:00
|
|
|
/** Draw function */
|
2008-06-03 16:08:33 +02:00
|
|
|
int (*draw)(draw_context_t *, int, widget_node_t *, int, int, void *);
|
2008-06-25 17:47:51 +02:00
|
|
|
/** Index function */
|
|
|
|
int (*index)(lua_State *);
|
2008-01-13 15:44:01 +01:00
|
|
|
/** ButtonPressedEvent handler */
|
2008-06-04 19:21:21 +02:00
|
|
|
void (*button_press)(widget_node_t *, xcb_button_press_event_t *, int, void *, awesome_type_t);
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Alignement */
|
2008-05-20 15:39:47 +02:00
|
|
|
alignment_t align;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Misc private data */
|
|
|
|
void *data;
|
2008-05-23 13:35:46 +02:00
|
|
|
/** Button bindings */
|
|
|
|
button_t *buttons;
|
2008-05-13 16:48:33 +02:00
|
|
|
/** Cache flags */
|
|
|
|
int cache_flags;
|
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-05-20 19:47:29 +02:00
|
|
|
/** Delete a widget structure.
|
|
|
|
* \param widget The widget to destroy.
|
|
|
|
*/
|
2008-05-20 15:39:47 +02:00
|
|
|
static inline void
|
|
|
|
widget_delete(widget_t **widget)
|
|
|
|
{
|
2008-06-14 22:38:40 +02:00
|
|
|
if((*widget)->destructor)
|
|
|
|
(*widget)->destructor(*widget);
|
2008-05-20 15:39:47 +02:00
|
|
|
button_list_wipe(&(*widget)->buttons);
|
|
|
|
p_delete(&(*widget)->name);
|
|
|
|
p_delete(widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
DO_RCNT(widget_t, widget, widget_delete)
|
|
|
|
|
2008-06-03 18:41:54 +02:00
|
|
|
struct widget_node_t
|
|
|
|
{
|
|
|
|
/** The widget */
|
|
|
|
widget_t *widget;
|
|
|
|
/** The area where the widget was drawn */
|
|
|
|
area_t area;
|
|
|
|
/** Next and previous widget in the list */
|
|
|
|
widget_node_t *prev, *next;
|
|
|
|
};
|
|
|
|
|
2008-05-20 19:47:29 +02:00
|
|
|
/** Delete a widget node structure.
|
|
|
|
* \param node The node to destroy.
|
|
|
|
*/
|
2008-05-20 15:39:47 +02:00
|
|
|
static inline void
|
|
|
|
widget_node_delete(widget_node_t **node)
|
|
|
|
{
|
|
|
|
widget_unref(&(*node)->widget);
|
|
|
|
p_delete(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
DO_SLIST(widget_node_t, widget_node, widget_node_delete)
|
|
|
|
|
2008-06-03 18:41:54 +02:00
|
|
|
/** Titlebar template structure */
|
|
|
|
struct titlebar_t
|
|
|
|
{
|
|
|
|
/** Ref count */
|
|
|
|
int refcount;
|
|
|
|
/** Position */
|
|
|
|
position_t position, oldposition;
|
|
|
|
/** Alignment on window */
|
|
|
|
alignment_t align;
|
|
|
|
/** Widgets */
|
|
|
|
widget_node_t *widgets;
|
|
|
|
/** Width and height */
|
|
|
|
int width, height;
|
|
|
|
/** Titlebar window */
|
|
|
|
simple_window_t *sw;
|
|
|
|
/** Default colors */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
xcolor_t fg, bg;
|
|
|
|
} colors;
|
2008-06-18 11:22:54 +02:00
|
|
|
/** Border */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
xcolor_t color;
|
|
|
|
int width;
|
|
|
|
} border;
|
2008-06-03 18:41:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Delete a titlebar structure.
|
|
|
|
* \param t The titlebar to destroy.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
titlebar_delete(titlebar_t **t)
|
|
|
|
{
|
|
|
|
widget_node_list_wipe(&(*t)->widgets);
|
|
|
|
p_delete(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
DO_RCNT(titlebar_t, titlebar, titlebar_delete)
|
|
|
|
|
|
|
|
/** Keys bindings */
|
2008-06-25 00:08:40 +02:00
|
|
|
ARRAY_TYPE(struct keybinding_t *, keybinding);
|
Put keybindings in binary searchable arrays.
This patch sorts keybindings in arrays by keycode or keysym to speed up look
up using binary searches. This is a preliminary work to enable more powerful
keybindings stuff, where keybindings can be cascaded or why not, attached to
specific clients.
Interstingly enough, this patch saves 100ko of initial memory (Heap) usage here.
The underlying idea is that we should be able to define keybindings_t as
trees of keybindings_t which would then define key sequences.
The OO approach kind of make sense in fact, since you create a base
keybinding (e.g. reacting on Mod4-w) and then you will probably (with
appropriate apis) be able to populate new submaps from that point more or
less dynamically.
And if you have two keybindings on Mod4-w, then adding them will replace the
previous one. This means that you can fake per-client bindings with e.g.:
k_default = keybindings.new({"Mod4"}, "w", something);
k_mplayer = keybindings.new({"Mod4"}, "w", something_else);
k_default:add()
and in your focus hook:
if /* code for testing if it's mplayer */ then
k_mplayer:add()
else
k_default:add()
end
This would not work before, it does now.
It will take way more sense with submaps of course.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-25 01:00:25 +02:00
|
|
|
|
|
|
|
typedef struct keybinding_idx_t {
|
|
|
|
keybinding_array_t by_code;
|
|
|
|
keybinding_array_t by_sym;
|
|
|
|
} keybinding_idx_t;
|
|
|
|
|
2008-06-03 18:41:54 +02:00
|
|
|
struct keybinding_t
|
|
|
|
{
|
|
|
|
/** Ref count */
|
|
|
|
int refcount;
|
|
|
|
/** Key modifier */
|
|
|
|
unsigned long mod;
|
|
|
|
/** Keysym */
|
|
|
|
xcb_keysym_t keysym;
|
|
|
|
/** Keycode */
|
|
|
|
xcb_keycode_t keycode;
|
|
|
|
/** Lua function to execute. */
|
|
|
|
luaA_function fct;
|
|
|
|
};
|
|
|
|
|
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-05-20 15:39:47 +02:00
|
|
|
/** Ref count */
|
|
|
|
int refcount;
|
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;
|
2008-06-03 11:47:05 +02:00
|
|
|
/** True if user specified width */
|
|
|
|
bool width_user;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Bar position */
|
2008-04-11 11:19:23 +02:00
|
|
|
position_t position;
|
2008-05-24 11:08:34 +02:00
|
|
|
/** Alignment */
|
|
|
|
alignment_t align;
|
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-05-20 15:39:47 +02:00
|
|
|
/** Widget list */
|
|
|
|
widget_node_t *widgets;
|
2008-03-20 09:08:15 +01:00
|
|
|
/** Draw context */
|
2008-04-28 15:32:30 +02:00
|
|
|
draw_context_t *ctx;
|
2008-05-13 16:48:33 +02:00
|
|
|
/** Need update */
|
2008-05-31 16:04:46 +02:00
|
|
|
bool need_update;
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Default colors */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
xcolor_t fg, bg;
|
|
|
|
} colors;
|
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 */
|
|
|
|
struct client_t
|
2008-01-13 15:44:01 +01:00
|
|
|
{
|
|
|
|
/** Client name */
|
2008-04-23 13:22:58 +02:00
|
|
|
char *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-06-18 13:56:03 +02:00
|
|
|
bool hassizehints;
|
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-05-28 14:33:45 +02:00
|
|
|
/** True if the client does not want any border */
|
|
|
|
bool noborder;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** 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;
|
2008-05-25 17:42:20 +02:00
|
|
|
/** true if the window is maximized */
|
|
|
|
bool ismax;
|
2008-03-21 16:50:17 +01:00
|
|
|
/** true if the client must be skipped from client list */
|
|
|
|
bool skip;
|
|
|
|
/** true if the client is moving */
|
|
|
|
bool ismoving;
|
2008-06-09 18:24:12 +02:00
|
|
|
/** True if the client is hidden */
|
|
|
|
bool ishidden;
|
2008-03-21 16:50:17 +01:00
|
|
|
/** true if the client must be skipped from task bar client list */
|
|
|
|
bool skiptb;
|
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 15:39:47 +02:00
|
|
|
/** Layer in the stacking order */
|
|
|
|
layer_t layer, oldlayer;
|
2008-05-20 22:37:08 +02:00
|
|
|
/** Path to an icon */
|
|
|
|
char *icon_path;
|
2008-06-04 11:50:21 +02:00
|
|
|
/** Titlebar */
|
|
|
|
titlebar_t *titlebar;
|
2008-06-13 15:35:47 +02:00
|
|
|
/** Button bindings */
|
|
|
|
button_t *buttons;
|
2008-06-23 11:41:16 +02:00
|
|
|
/** Floating window placement algo */
|
|
|
|
floating_placement_t *floating_placement;
|
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-06-24 14:16:37 +02:00
|
|
|
DO_ARRAY(client_t *, client, DO_NOTHING);
|
2008-01-13 15:44:01 +01:00
|
|
|
|
|
|
|
struct client_node_t
|
|
|
|
{
|
2008-05-20 19:47:29 +02:00
|
|
|
/** The client */
|
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
|
|
|
};
|
|
|
|
|
2008-06-09 21:43:09 +02:00
|
|
|
/** Tag type */
|
|
|
|
struct _tag_t
|
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-06-23 17:37:19 +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-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-01-13 15:44:01 +01:00
|
|
|
/** Status bar */
|
2008-04-11 11:27:36 +02:00
|
|
|
statusbar_t *statusbar;
|
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;
|
|
|
|
bool has_systray_widget;
|
|
|
|
} systray;
|
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 */
|
|
|
|
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 */
|
2008-05-24 09:01:49 +02:00
|
|
|
screen_t *screens;
|
2008-03-13 09:28:21 +01:00
|
|
|
/** Screens info */
|
2008-04-28 15:33:49 +02:00
|
|
|
screens_info_t *screens_info;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Keys bindings list */
|
Put keybindings in binary searchable arrays.
This patch sorts keybindings in arrays by keycode or keysym to speed up look
up using binary searches. This is a preliminary work to enable more powerful
keybindings stuff, where keybindings can be cascaded or why not, attached to
specific clients.
Interstingly enough, this patch saves 100ko of initial memory (Heap) usage here.
The underlying idea is that we should be able to define keybindings_t as
trees of keybindings_t which would then define key sequences.
The OO approach kind of make sense in fact, since you create a base
keybinding (e.g. reacting on Mod4-w) and then you will probably (with
appropriate apis) be able to populate new submaps from that point more or
less dynamically.
And if you have two keybindings on Mod4-w, then adding them will replace the
previous one. This means that you can fake per-client bindings with e.g.:
k_default = keybindings.new({"Mod4"}, "w", something);
k_mplayer = keybindings.new({"Mod4"}, "w", something_else);
k_default:add()
and in your focus hook:
if /* code for testing if it's mplayer */ then
k_mplayer:add()
else
k_default:add()
end
This would not work before, it does now.
It will take way more sense with submaps of course.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-25 01:00:25 +02:00
|
|
|
keybinding_idx_t keys;
|
2008-01-13 15:44:01 +01:00
|
|
|
/** Mouse bindings list */
|
|
|
|
struct
|
|
|
|
{
|
2008-05-23 13:35:46 +02:00
|
|
|
button_t *root;
|
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 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-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 */
|
|
|
|
char *configpath;
|
|
|
|
/** Selected clients history */
|
|
|
|
client_node_t *focus;
|
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-11 00:30:20 +02:00
|
|
|
/** Atoms cache */
|
2008-06-27 12:08:19 +02:00
|
|
|
xutil_atom_cache_array_t atoms;
|
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-06-10 19:03:10 +02:00
|
|
|
luaA_function manage;
|
|
|
|
/** Command to execute when unmanaging client */
|
|
|
|
luaA_function unmanage;
|
2008-05-20 15:39:47 +02:00
|
|
|
/** Command to execute when giving focus to a client */
|
|
|
|
luaA_function focus;
|
|
|
|
/** Command to execute when removing focus to a client */
|
|
|
|
luaA_function unfocus;
|
|
|
|
/** Command to run when mouse is over */
|
|
|
|
luaA_function mouseover;
|
2008-05-23 17:09:34 +02:00
|
|
|
/** Command to run on arrange */
|
|
|
|
luaA_function arrange;
|
2008-05-25 17:51:45 +02:00
|
|
|
/** Command to run on title change */
|
|
|
|
luaA_function titleupdate;
|
2008-05-28 11:08:48 +02:00
|
|
|
/** Command to run on urgent flag */
|
|
|
|
luaA_function urgent;
|
2008-05-29 13:47:11 +02:00
|
|
|
/** Command to run on time */
|
|
|
|
luaA_function timer;
|
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 */
|
|
|
|
luaA_function keygrabber;
|
2008-01-13 15:44:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|