Include mod_xrandr instead of using submodules
[notion/jeffpc.git] / ioncore / binding.h
blob3354b23bc81152a1bb4d6b133887a23b25c7bf0e
1 /*
2 * ion/ioncore/binding.h
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
7 */
9 #ifndef ION_IONCORE_BINDING_H
10 #define ION_IONCORE_BINDING_H
12 #include <libtu/obj.h>
13 #include <libtu/rb.h>
14 #include <libtu/map.h>
15 #include "common.h"
16 #include "region.h"
17 #include <libextl/extl.h>
20 enum{
21 BINDING_KEYPRESS,
22 BINDING_BUTTONPRESS,
23 BINDING_BUTTONMOTION,
24 BINDING_BUTTONCLICK,
25 BINDING_BUTTONDBLCLICK,
26 BINDING_SUBMAP_ENTER,
27 BINDING_SUBMAP_RELEASEMOD
28 /*BINDING_SUBMAP_LEAVE*/
31 #define BINDING_IS_PSEUDO(A) \
32 ((A)==BINDING_SUBMAP_ENTER || (A)==BINDING_SUBMAP_RELEASEMOD)
34 #define BINDMAP_INIT {0, NULL, NULL, NULL, NULL}
36 #define FOR_ALL_BINDINGS(B, NODE, MAP) \
37 rb_traverse(NODE, MAP) if(((B)=(WBinding*)rb_val(NODE))!=NULL)
39 INTRSTRUCT(WBinding);
40 INTRSTRUCT(WBindmap);
41 INTRSTRUCT(WRegBindingInfo);
44 DECLSTRUCT(WBinding){
45 uint kcb; /* keycode or button */
46 uint ksb; /* keysym or button */
47 uint state;
48 uint act;
49 int area;
50 bool wait;
51 WBindmap *submap;
52 ExtlFn func;
57 DECLSTRUCT(WRegBindingInfo){
58 WBindmap *bindmap;
59 WRegBindingInfo *next, *prev;
60 WRegBindingInfo *bm_next, *bm_prev;
61 WRegion *reg;
62 WRegion *owner;
63 int tmp;
68 DECLSTRUCT(WBindmap){
69 int nbindings;
70 Rb_node bindings;
71 WRegBindingInfo *rbind_list;
72 const StringIntMap *areamap;
76 extern void ioncore_init_bindings();
77 extern void ioncore_update_modmap();
78 extern int ioncore_unmod(int state, int keycode);
79 extern bool ioncore_ismod(int keycode);
80 extern int ioncore_modstate();
82 extern WBindmap *create_bindmap();
84 extern void bindmap_destroy(WBindmap *bindmap);
85 extern void bindmap_refresh(WBindmap *bindmap);
86 extern bool bindmap_add_binding(WBindmap *bindmap, const WBinding *binding);
87 extern bool bindmap_remove_binding(WBindmap *bindmap, const WBinding *binding);
88 extern WBinding *bindmap_lookup_binding(WBindmap *bindmap, int act,
89 uint state, uint kcb);
90 extern WBinding *bindmap_lookup_binding_area(WBindmap *bindmap, int act,
91 uint state, uint kcb, int area);
93 extern void binding_deinit(WBinding *binding);
94 extern void binding_grab_on(const WBinding *binding, Window win);
95 extern void binding_ungrab_on(const WBinding *binding, Window win);
97 #endif /* ION_IONCORE_BINDING_H */