This repository has been archived by the owner on Aug 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeys.h
80 lines (58 loc) · 2.8 KB
/
keys.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/***************************************************************************
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 : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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>
#include <libguile.h>
typedef enum { SYM, CODE, BUTTON } KeyType_t;
typedef enum { PRESS, RELEASE } EventType_t;
// typedef int SCM;
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, int verbose);
extern void print_key(Display *d, Keys_t *key, int verbose);
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 */