Fix segfault setting MenuFace pixmap style for menus.
[fvwm.git] / libs / Bindings.h
blob726993368c590ecdde1fea96a4b92cd039aa9138
1 /* -*-c-*- */
3 #include <X11/Xutil.h> /* XClassHint */
5 #ifndef FVWMLIB_BINDINGS_H_H
6 #define FVWMLIB_BINDINGS_H_H
8 /* ---------------------------- global definitions ------------------------- */
10 #define binding_t_t unsigned char
12 /* ---------------------------- global macros ------------------------------ */
14 #define BIND_IS_KEY_PRESS(t) ((t) == BIND_KEYPRESS || (t) == BIND_PKEYPRESS)
15 #define BIND_IS_KEY_BINDING(t) ((t) == BIND_KEYPRESS || (t) == BIND_PKEYPRESS)
16 #define BIND_IS_PKEY_BINDING(t) ((t) == BIND_PKEYPRESS)
17 #define BIND_IS_MOUSE_BINDING(t) \
18 ((t) == BIND_BUTTONPRESS || (t) == BIND_BUTTONRELEASE)
19 #define BIND_IS_STROKE_BINDING(t) ((t) == BIND_STROKE)
21 /* ---------------------------- type definitions --------------------------- */
23 typedef enum
25 /* press = even number, release = press + 1 */
26 BIND_BUTTONPRESS = 0,
27 BIND_BUTTONRELEASE = 1,
28 BIND_KEYPRESS = 2,
29 BIND_PKEYPRESS = 4,
30 BIND_STROKE = 6
31 } binding_t;
33 typedef struct Binding
35 binding_t_t type; /* Is it a mouse, key, or stroke binding */
36 STROKE_CODE(void *Stroke_Seq;) /* stroke sequence */
37 int Button_Key; /* Mouse Button number or Keycode */
38 char *key_name; /* In case of keycode, give the key_name too */
39 int Context; /* Fvwm context, ie titlebar, frame, etc */
40 int Modifier; /* Modifiers for keyboard state */
41 void *Action; /* What to do? */
42 void *Action2; /* This one can be used too */
43 char *windowName; /* Name of window (regex pattern) this binding
44 applies to. NULL means all windows. */
45 struct Binding *NextBinding;
46 } Binding;
48 /* ---------------------------- interface functions ------------------------ */
50 void CollectBindingList(
51 Display *dpy, Binding **pblist_src, Binding **pblist_dest,
52 binding_t type, STROKE_ARG(void *stroke) int button, KeySym keysym,
53 int modifiers, int contexts, char *windowName);
54 int AddBinding(
55 Display *dpy, Binding **pblist, binding_t type,
56 STROKE_ARG(void *stroke) int button, KeySym keysym, char *key_name,
57 int modifiers, int contexts, void *action, void *action2, char *windowName);
58 void FreeBindingStruct(Binding *b);
59 void FreeBindingList(Binding *b);
60 void RemoveBinding(Binding **pblist, Binding *b, Binding *prev);
61 Bool RemoveMatchingBinding(
62 Display *dpy, Binding **pblist, binding_t type,
63 STROKE_ARG(char *stroke) int button, KeySym keysym, int modifiers,
64 int contexts);
65 void *CheckBinding(
66 Binding *blist, STROKE_ARG(char *stroke) int button_keycode,
67 unsigned int modifier, unsigned int dead_modifiers, int Context,
68 binding_t type, const XClassHint *win_class, const char *win_name);
69 void *CheckTwoBindings(
70 Bool *ret_is_second_binding, Binding *blist, STROKE_ARG(char *stroke)
71 int button_keycode, unsigned int modifier,unsigned int dead_modifiers,
72 int Context, binding_t type, const XClassHint *win_class,
73 const char *win_name, int Context2, binding_t type2,
74 const XClassHint *win_class2, const char *win_name2);
75 void GrabWindowKey(
76 Display *dpy, Window w, Binding *binding, unsigned int contexts,
77 unsigned int dead_modifiers, Bool fGrab);
78 void GrabAllWindowKeys(
79 Display *dpy, Window w, Binding *blist, unsigned int contexts,
80 unsigned int dead_modifiers, Bool fGrab);
81 void GrabWindowButton(
82 Display *dpy, Window w, Binding *binding, unsigned int contexts,
83 unsigned int dead_modifiers, Cursor cursor, Bool fGrab);
84 void GrabAllWindowButtons(
85 Display *dpy, Window w, Binding *blist, unsigned int contexts,
86 unsigned int dead_modifiers, Cursor cursor, Bool fGrab);
87 void GrabAllWindowKeysAndButtons(
88 Display *dpy, Window w, Binding *blist, unsigned int contexts,
89 unsigned int dead_modifiers, Cursor cursor, Bool fGrab);
90 void GrabWindowKeyOrButton(
91 Display *dpy, Window w, Binding *binding, unsigned int contexts,
92 unsigned int dead_modifiers, Cursor cursor, Bool fGrab);
93 KeySym FvwmStringToKeysym(Display *dpy, char *key);
94 Bool bindingAppliesToWindow(Binding *binding, const XClassHint *win_class,
95 const char *win_name);
96 Bool is_pass_through_action(const char *action);
99 #endif /* FVWMLIB_BINDINGS_H_H */