2 * ion/ioncore/binding.h
4 * Copyright (c) Tuomo Valkonen 1999-2005.
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
;
65 WRegBindingInfo
*rbind_list
;
66 const StringIntMap
*areamap
;
70 extern void ioncore_init_bindings();
71 extern void ioncore_update_modmap();
72 extern int ioncore_unmod(int state
, int keycode
);
73 extern bool ioncore_ismod(int keycode
);
74 extern int ioncore_modstate();
76 extern WBindmap
*create_bindmap();
78 extern void bindmap_destroy(WBindmap
*bindmap
);
79 extern void bindmap_refresh(WBindmap
*bindmap
);
80 extern bool bindmap_add_binding(WBindmap
*bindmap
, const WBinding
*binding
);
81 extern bool bindmap_remove_binding(WBindmap
*bindmap
, const WBinding
*binding
);
82 extern WBinding
*bindmap_lookup_binding(WBindmap
*bindmap
, int act
,
83 uint state
, uint kcb
);
84 extern WBinding
*bindmap_lookup_binding_area(WBindmap
*bindmap
, int act
,
85 uint state
, uint kcb
, int area
);
87 extern void binding_deinit(WBinding
*binding
);
88 extern void binding_grab_on(const WBinding
*binding
, Window win
);
89 extern void binding_ungrab_on(const WBinding
*binding
, Window win
);
91 #endif /* ION_IONCORE_BINDING_H */