-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathbinding.h
94 lines (73 loc) · 2.35 KB
/
binding.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* ion/ioncore/binding.h
*
* Copyright (c) Tuomo Valkonen 1999-2007.
*
* See the included file LICENSE for details.
*/
#ifndef ION_IONCORE_BINDING_H
#define ION_IONCORE_BINDING_H
#include <libtu/obj.h>
#include <libtu/rb.h>
#include <libtu/map.h>
#include "common.h"
#include "region.h"
#include <libextl/extl.h>
#define BINDING_KEYPRESS 0
#define BINDING_BUTTONPRESS 1
#define BINDING_BUTTONMOTION 2
#define BINDING_BUTTONCLICK 3
#define BINDING_BUTTONDBLCLICK 4
#define BINDING_SUBMAP 5
#define BINDMAP_INIT {0, NULL, NULL, NULL, NULL}
#define FOR_ALL_BINDINGS(B, NODE, MAP) \
rb_traverse(NODE, MAP) if(((B)=(WBinding*)rb_val(NODE))!=NULL)
INTRSTRUCT(WBinding);
INTRSTRUCT(WBindmap);
INTRSTRUCT(WRegBindingInfo);
DECLSTRUCT(WBinding){
uint kcb; /* keycode or button */
uint ksb; /* keysym or button */
uint state;
uint act;
int area;
bool wait;
WBindmap *submap;
ExtlFn func;
const char *doc;
const char *label;
};
DECLSTRUCT(WRegBindingInfo){
WBindmap *bindmap;
WRegBindingInfo *next, *prev;
WRegBindingInfo *bm_next, *bm_prev;
WRegion *reg;
WRegion *owner;
int tmp;
};
DECLSTRUCT(WBindmap){
int nbindings;
Rb_node bindings;
WRegBindingInfo *rbind_list;
const StringIntMap *areamap;
};
extern void ioncore_init_bindings();
extern void ioncore_update_modmap();
extern int ioncore_unmod(int state, int keycode);
extern bool ioncore_ismod(int keycode);
extern int ioncore_modstate();
extern int ioncore_ksb(unsigned long serial);
extern uint ioncore_modifiers(unsigned long serial);
extern WBindmap *create_bindmap();
extern void bindmap_destroy(WBindmap *bindmap);
extern void bindmap_refresh(WBindmap *bindmap);
extern bool bindmap_add_binding(WBindmap *bindmap, const WBinding *binding);
extern bool bindmap_remove_binding(WBindmap *bindmap, const WBinding *binding);
extern WBinding *bindmap_lookup_binding(WBindmap *bindmap, int act,
uint state, uint kcb);
extern WBinding *bindmap_lookup_binding_area(WBindmap *bindmap, int act,
uint state, uint kcb, int area);
extern void binding_deinit(WBinding *binding);
extern void binding_grab_on(const WBinding *binding, Window win);
extern void binding_ungrab_on(const WBinding *binding, Window win);
#endif /* ION_IONCORE_BINDING_H */