From 8d1120d0961d62acd4a3a83c07e16942edcdc33a Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 31 Oct 2008 17:08:32 +0100 Subject: [PATCH] keybinding: store in globalconf Signed-off-by: Julien Danjou --- keybinding.c | 18 +++++------------- keybinding.h | 3 +++ structs.h | 7 +++++++ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/keybinding.c b/keybinding.c index a53cce5c..f6fba0f9 100644 --- a/keybinding.c +++ b/keybinding.c @@ -24,17 +24,9 @@ #include #include "structs.h" -#include "keybinding.h" - -ARRAY_TYPE(keybinding_t *, keybinding) extern awesome_t globalconf; -static struct { - keybinding_array_t by_code; - keybinding_array_t by_sym; -} keys_g; - static void keybinding_delete(keybinding_t **kbp) { @@ -136,7 +128,7 @@ window_root_ungrabkey(keybinding_t *k) static void keybinding_register_root(keybinding_t *k) { - keybinding_array_t *arr = k->keysym ? &keys_g.by_sym : &keys_g.by_code; + keybinding_array_t *arr = k->keysym ? &globalconf.keys.by_sym : &globalconf.keys.by_code; int l = 0, r = arr->len; keybinding_ref(&k); @@ -164,7 +156,7 @@ keybinding_register_root(keybinding_t *k) static void keybinding_unregister_root(keybinding_t **k) { - keybinding_array_t *arr = (*k)->keysym ? &keys_g.by_sym : &keys_g.by_code; + keybinding_array_t *arr = (*k)->keysym ? &globalconf.keys.by_sym : &globalconf.keys.by_code; int l = 0, r = arr->len; while (l < r) { @@ -261,7 +253,7 @@ key_getkeysym(xcb_keycode_t detail, uint16_t state) keybinding_t * keybinding_find(const xcb_key_press_event_t *ev) { - const keybinding_array_t *arr = &keys_g.by_sym; + const keybinding_array_t *arr = &globalconf.keys.by_sym; int l, r, mod = XUTIL_MASK_CLEAN(ev->state); xcb_keysym_t keysym; @@ -286,9 +278,9 @@ keybinding_find(const xcb_key_press_event_t *ev) break; } } - if (arr != &keys_g.by_code) + if (arr != &globalconf.keys.by_code) { - arr = &keys_g.by_code; + arr = &globalconf.keys.by_code; goto again; } return NULL; diff --git a/keybinding.h b/keybinding.h index d84866ca..78422c57 100644 --- a/keybinding.h +++ b/keybinding.h @@ -24,6 +24,7 @@ #include #include "luaa.h" +#include "common/array.h" typedef struct keybinding_t { @@ -39,6 +40,8 @@ typedef struct keybinding_t luaA_ref fct; } keybinding_t; +ARRAY_TYPE(keybinding_t *, keybinding) + keybinding_t *keybinding_find(const xcb_key_press_event_t *); xcb_keysym_t key_getkeysym(xcb_keycode_t, uint16_t); diff --git a/structs.h b/structs.h index 21861fb5..a7ea8635 100644 --- a/structs.h +++ b/structs.h @@ -28,6 +28,7 @@ #include "luaa.h" #include "layout.h" #include "swindow.h" +#include "keybinding.h" #include "common/xutil.h" #include "common/xembed.h" #include "common/refcount.h" @@ -303,6 +304,12 @@ struct awesome_t int nscreen; /** True if xinerama is active */ bool xinerama_is_active; + /** Key bindings */ + struct + { + keybinding_array_t by_code; + keybinding_array_t by_sym; + } keys; /** Mouse bindings list */ button_array_t buttons; /** Numlock mask */