1 /*
2  * pwm/binding.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2001.
5  *
6  * You may distribute and modify this program under the terms of either
7  * the Clarified Artistic License or the GNU GPL, version 2 or later.
8  */
9 
10 #ifndef INCLUDED_BINDING_H
11 #define INCLUDED_BINDING_H
12 
13 #include "common.h"
14 #include "function.h"
15 
16 #define	ACTX_ROOT		0x00001
17 #define	ACTX_TAB		0x00010
18 #define	ACTX_CORNER		0x00020
19 #define ACTX_SIDE		0x00040
20 #define ACTX_MENU		0x00100
21 #define ACTX_MENUTITLE	0x00200
22 #define ACTX_WINDOW		0x01000
23 #define ACTX_DOCKWIN	0x02000
24 #define ACTX_GLOBAL		0x10000
25 #define ACTX_MOVERES	0x20000
26 
27 #define ACTX_C_FRAME	(ACTX_TAB|ACTX_SIDE|ACTX_CORNER|ACTX_WINDOW)
28 
29 #define ACT_KEYPRESS 		0
30 #define ACT_BUTTONPRESS		1
31 #define ACT_BUTTONMOTION	2
32 #define ACT_BUTTONCLICK		3
33 #define ACT_BUTTONDBLCLICK	4
34 #define ACT_N				5
35 
36 
37 typedef struct _WBinding{
38 	uint kcb;	/* keycode or button */
39 	uint state;
40 	uint actx;
41 	WFunction *func;
42 	WFuncArg arg;
43 } WBinding;
44 
45 
46 typedef struct _WBindmap{
47 	int nbindings;
48 	WBinding *bindings;
49 } WBindmap;
50 
51 
52 extern void init_bindings();
53 extern bool add_binding(uint act, uint actx, uint state, uint kcb,
54 						const WFuncBinder *binder);
55 extern void grab_bindings(Window win, uint actx);
56 extern WBinding *lookup_binding(uint act, uint actx, uint state, uint kcb);
57 
58 extern bool add_pointer_binding(uint actx, uint state, uint kcb,
59 								const WFuncBinder *pressb,
60 								const WFuncBinder *clickb,
61 								const WFuncBinder *dblclickb,
62 								const WFuncBinder *motionb);
63 
64 #endif /* INCLUDED_BINDING_H */
65