diff options
author | Philippe Brochard <pbrochard@common-lisp.net> | 2009-05-18 15:28:11 +0200 |
---|---|---|
committer | Philippe Brochard <pbrochard@common-lisp.net> | 2009-05-18 15:28:11 +0200 |
commit | 0d5a90f36acc602d993075bbccaebb44e671dca6 (patch) | |
tree | 71f73266ef446b8f030f7182544ef21593318fb1 /keys.h | |
parent | be5b5354a2af10580bde41d3cbf6d2c9db72bb9b (diff) | |
download | xbindkeys-0d5a90f36acc602d993075bbccaebb44e671dca6.tar.gz |
Initial import
Diffstat (limited to 'keys.h')
-rw-r--r-- | keys.h | 94 |
1 files changed, 94 insertions, 0 deletions
@@ -0,0 +1,94 @@ +/*************************************************************************** + xbindkeys : a program to bind keys to commands under X11. + ------------------- + begin : Sat Oct 13 14:11:34 CEST 2001 + copyright : (C) 2001 by Philippe Brochard + email : hocwp@free.fr + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef __KEYS_H +#define __KEYS_H + +#include <X11/Xlib.h> +#ifdef GUILE_FLAG +#include <libguile.h> +#endif + +typedef enum + { SYM, CODE, BUTTON } +KeyType_t; + +typedef enum + { PRESS, RELEASE} +EventType_t; + +#ifndef GUILE_FLAG +typedef int SCM; +#endif + +typedef struct +{ + KeyType_t type; + + EventType_t event_type; + + union + { + KeySym sym; + KeyCode code; + unsigned int button; + } + key; + + unsigned int modifier; + char *command; + SCM function; // This is to call a scheme function instead of a shell command + // when command == NULL (not used when guile is not used). +} +Keys_t; + + +extern int init_keys (void); +extern void close_keys (void); + +extern int add_key (KeyType_t type, EventType_t event_type, KeySym keysym, KeyCode keycode, + unsigned int button, unsigned int modifier, + char *command, SCM function); + +extern int remove_key (KeyType_t type, EventType_t event_type, KeySym keysym, KeyCode keycode, + unsigned int button, unsigned int modifier); + + +extern void show_key_binding (Display * d); + +extern void print_key (Display * d, Keys_t * key); + +extern void set_keysym (Keys_t * key, EventType_t event_type, KeySym keysym, + unsigned int modifier, char *command, SCM function); +extern void set_keycode (Keys_t * key, EventType_t event_type, KeyCode keycode, + unsigned int modifier, char *command, SCM function); +extern void set_button (Keys_t * key, EventType_t event_type, unsigned int button, + unsigned int modifier, char *command, SCM function); + +extern void free_key (Keys_t * key); + +extern void start_command_key (Keys_t * key); + +extern void modifier_to_string (unsigned int modifier, char *str); + +extern void run_command (char * command); + + +extern int nb_keys; +extern Keys_t *keys; + +#endif /* __KEYS_H */ |