File: Bindings.h

package info (click to toggle)
fvwm3 1.0.6a%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,408 kB
  • sloc: ansic: 141,349; perl: 4,891; sh: 4,568; makefile: 785; yacc: 688; lex: 187; sed: 11
file content (98 lines) | stat: -rw-r--r-- 3,808 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* -*-c-*- */

#ifndef FVWMLIB_BINDINGS_H_H
#define FVWMLIB_BINDINGS_H_H

#include "fvwm_x11.h"

/* ---------------------------- global definitions ------------------------- */

#define binding_t_t    unsigned char

/* ---------------------------- global macros ------------------------------ */

#define BIND_IS_KEY_PRESS(t) ((t) == BIND_KEYPRESS || (t) == BIND_PKEYPRESS)
#define BIND_IS_KEY_BINDING(t) ((t) == BIND_KEYPRESS || (t) == BIND_PKEYPRESS)
#define BIND_IS_PKEY_BINDING(t) ((t) == BIND_PKEYPRESS)
#define BIND_IS_MOUSE_BINDING(t) \
	((t) == BIND_BUTTONPRESS || (t) == BIND_BUTTONRELEASE)

/* ---------------------------- type definitions --------------------------- */

typedef enum
{
	/* press = even number, release = press + 1 */
	BIND_BUTTONPRESS = 0,
	BIND_BUTTONRELEASE = 1,
	BIND_KEYPRESS = 2,
	BIND_PKEYPRESS = 4,
} binding_t;

typedef struct Binding
{
	binding_t_t type;       /* Is it a mouse or key binding */
	int Button_Key;         /* Mouse Button number or Keycode */
	char *key_name;         /* In case of keycode, give the key_name too */
	int Context;            /* Fvwm context, ie titlebar, frame, etc */
	int Modifier;           /* Modifiers for keyboard state */
	void *Action;           /* What to do? */
	void *Action2;          /* This one can be used too */
	char *windowName;	/* Name of window (regex pattern) this binding
				   applies to. NULL means all windows. */
	struct Binding *NextBinding;
} Binding;

/* ---------------------------- interface functions ------------------------ */

void CollectBindingList(
	Display *dpy, Binding **pblist_src, Binding **pblist_dest,
	Bool *ret_are_similar_bindings_left, binding_t type,
	int button, KeySym keysym,
	int modifiers, int contexts, char *windowName);
int AddBinding(
	Display *dpy, Binding **pblist, binding_t type,
	int button, KeySym keysym, char *key_name,
	int modifiers, int contexts, void *action, void *action2,
	char *windowName);
void FreeBindingStruct(Binding *b);
void FreeBindingList(Binding *b);
void RemoveBinding(Binding **pblist, Binding *b, Binding *prev);
Bool RemoveMatchingBinding(
	Display *dpy, Binding **pblist, binding_t type,
	int button, KeySym keysym, int modifiers,
	int contexts);
void *CheckBinding(
	Binding *blist, int button_keycode,
	unsigned int modifier, unsigned int dead_modifiers, int Context,
	binding_t type, const XClassHint *win_class, const char *win_name);
void *CheckTwoBindings(
	Bool *ret_is_second_binding, Binding *blist,
	int button_keycode, unsigned int modifier,unsigned int dead_modifiers,
	int Context, binding_t type, const XClassHint *win_class,
	const char *win_name, int Context2, binding_t type2,
	const XClassHint *win_class2, const char *win_name2);
void GrabWindowKey(
	Display *dpy, Window w, Binding *binding, unsigned int contexts,
	unsigned int dead_modifiers, Bool fGrab);
void GrabAllWindowKeys(
	Display *dpy, Window w, Binding *blist, unsigned int contexts,
	unsigned int dead_modifiers, Bool fGrab);
void GrabWindowButton(
	Display *dpy, Window w, Binding *binding, unsigned int contexts,
	unsigned int dead_modifiers, Cursor cursor, Bool fGrab);
void GrabAllWindowButtons(
	Display *dpy, Window w, Binding *blist, unsigned int contexts,
	unsigned int dead_modifiers, Cursor cursor, Bool fGrab);
void GrabAllWindowKeysAndButtons(
	Display *dpy, Window w, Binding *blist, unsigned int contexts,
	unsigned int dead_modifiers, Cursor cursor, Bool fGrab);
void GrabWindowKeyOrButton(
	Display *dpy, Window w, Binding *binding, unsigned int contexts,
	unsigned int dead_modifiers, Cursor cursor, Bool fGrab);
KeySym FvwmStringToKeysym(Display *dpy, char *key);
Bool bindingAppliesToWindow(Binding *binding, const XClassHint *win_class,
	const char *win_name);
Bool is_pass_through_action(const char *action);


#endif /* FVWMLIB_BINDINGS_H_H */