trunk: changeset 1925
[notion/jeffpc.git] / ioncore / binding.h
blob7d8eea3c6734063fd95420469b62994a7f652671
1 /*
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>
16 #include <libtu/rb.h>
17 #include <libtu/map.h>
18 #include "common.h"
19 #include "region.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)
34 INTRSTRUCT(WBinding);
35 INTRSTRUCT(WBindmap);
36 INTRSTRUCT(WRegBindingInfo);
39 DECLSTRUCT(WBinding){
40 uint kcb; /* keycode or button */
41 uint ksb; /* keysym or button */
42 uint state;
43 uint act;
44 int area;
45 bool waitrel;
46 WBindmap *submap;
47 ExtlFn func;
52 DECLSTRUCT(WRegBindingInfo){
53 WBindmap *bindmap;
54 WRegBindingInfo *next, *prev;
55 WRegBindingInfo *bm_next, *bm_prev;
56 WRegion *reg;
57 WRegion *owner;
62 DECLSTRUCT(WBindmap){
63 int nbindings;
64 Rb_node bindings;
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 */