From 9492fe7611d0b982c7a985808038933c0e5e8970 Mon Sep 17 00:00:00 2001 From: QC Date: Sat, 2 May 2015 12:21:54 +0200 Subject: [PATCH] Cleanup keyb.h file. --- include/keyb.h | 32 ++++++++++++++++---------------- source/keyb.c | 28 ++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/include/keyb.h b/include/keyb.h index 1ef4a20e..0aa8b860 100644 --- a/include/keyb.h +++ b/include/keyb.h @@ -27,26 +27,26 @@ typedef enum _KeyBindingAction } KeyBindingAction; -typedef struct _KeyBinding -{ - unsigned int modmask; - KeySym keysym; -} KeyBinding; - -typedef struct _ActionBindingEntry -{ - const char *name; - char *keystr; - int num_bindings; - KeyBinding *kb; -} ActionBindingEntry; - - +/** + * Parse the keybindings. + * This should be called after the setting system is initialized. + */ void parse_keys_abe ( void ); + +/** + * Setup the keybindings + * This adds all the entries to the settings system. + */ void setup_abe ( void ); +/** + * Cleanup. + */ void cleanup_abe ( void ); -extern ActionBindingEntry abe[NUM_ABE]; +/** + * Check if this key has been triggered. + * @returns TRUE if key combo matches, FALSE otherwise. + */ int abe_test_action ( KeyBindingAction action, unsigned int mask, KeySym key ); #endif // __KEYB_H__ diff --git a/source/keyb.c b/source/keyb.c index 5836a7b9..fd94d31e 100644 --- a/source/keyb.c +++ b/source/keyb.c @@ -3,10 +3,22 @@ #include "x11-helper.h" #include "xrmoptions.h" -ActionBindingEntry abe[NUM_ABE]; -// Use this so we can ignore numlock mask. -// TODO: maybe use something smarter here.. -extern unsigned int NumlockMask; + + + +typedef struct _KeyBinding +{ + unsigned int modmask; + KeySym keysym; +} KeyBinding; + +typedef struct _ActionBindingEntry +{ + const char *name; + char *keystr; + int num_bindings; + KeyBinding *kb; +} ActionBindingEntry; typedef struct _DefaultBinding { @@ -15,6 +27,14 @@ typedef struct _DefaultBinding char *keybinding; } DefaultBinding; +ActionBindingEntry abe[NUM_ABE]; +// Use this so we can ignore numlock mask. +// TODO: maybe use something smarter here.. +extern unsigned int NumlockMask; + +/** + * LIST OF DEFAULT SETTINGS + */ DefaultBinding bindings[NUM_ABE] = { {