2 * ion/ioncore/binding.h
4 * Copyright (c) Tuomo Valkonen 1999-2007.
6 * Ion is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
12 #ifndef ION_IONCORE_BINDING_H
13 #define ION_IONCORE_BINDING_H
15 #include <libtu/obj.h>
17 #include <libtu/map.h>
20 #include <libextl/extl.h>
23 #define BINDING_KEYPRESS 0
24 #define BINDING_BUTTONPRESS 1
25 #define BINDING_BUTTONMOTION 2
26 #define BINDING_BUTTONCLICK 3
27 #define BINDING_BUTTONDBLCLICK 4
29 #define BINDMAP_INIT {0, NULL, NULL, NULL, NULL}
31 #define FOR_ALL_BINDINGS(B, NODE, MAP) \
32 rb_traverse(NODE, MAP) if(((B)=(WBinding*)rb_val(NODE))!=NULL)
36 INTRSTRUCT(WRegBindingInfo);
40 uint kcb; /* keycode or button */
41 uint ksb; /* keysym or button */
52 DECLSTRUCT(WRegBindingInfo){
54 WRegBindingInfo *next, *prev;
55 WRegBindingInfo *bm_next, *bm_prev;
66 WRegBindingInfo *rbind_list;
67 const StringIntMap *areamap;
71 extern void ioncore_init_bindings();
72 extern void ioncore_update_modmap();
73 extern int ioncore_unmod(int state, int keycode);
74 extern bool ioncore_ismod(int keycode);
75 extern int ioncore_modstate();
77 extern WBindmap *create_bindmap();
79 extern void bindmap_destroy(WBindmap *bindmap);
80 extern void bindmap_refresh(WBindmap *bindmap);
81 extern bool bindmap_add_binding(WBindmap *bindmap, const WBinding *binding);
82 extern bool bindmap_remove_binding(WBindmap *bindmap, const WBinding *binding);
83 extern WBinding *bindmap_lookup_binding(WBindmap *bindmap, int act,
84 uint state, uint kcb);
85 extern WBinding *bindmap_lookup_binding_area(WBindmap *bindmap, int act,
86 uint state, uint kcb, int area);
88 extern void binding_deinit(WBinding *binding);
89 extern void binding_grab_on(const WBinding *binding, Window win);
90 extern void binding_ungrab_on(const WBinding *binding, Window win);
92 #endif /* ION_IONCORE_BINDING_H */