merge the C branch into HEAD
[mikachu/openbox.git] / openbox / hooks.h
1 #ifndef __hooks_h
2 #define __hooks_h
3
4 #include "clientwrap.h"
5 #include <Python.h>
6
7 void hooks_startup();
8 void hooks_shutdown();
9
10 struct HookObject;
11
12 struct HookObject *hooks_create(char *name);
13
14 struct HookObject *hook_startup;
15 struct HookObject *hook_shutdown;
16 struct HookObject *hook_visibledesktop;
17 struct HookObject *hook_numdesktops;
18 struct HookObject *hook_desktopnames;
19 struct HookObject *hook_showdesktop;
20 struct HookObject *hook_screenconfiguration;
21 struct HookObject *hook_screenarea;
22 struct HookObject *hook_managed;
23 struct HookObject *hook_closed;
24 struct HookObject *hook_bell;
25 struct HookObject *hook_urgent;
26 struct HookObject *hook_pointerenter;
27 struct HookObject *hook_pointerleave;
28 struct HookObject *hook_focused;
29 struct HookObject *hook_requestactivate;
30 struct HookObject *hook_title;
31 struct HookObject *hook_desktop;
32 struct HookObject *hook_iconic;
33 struct HookObject *hook_shaded;
34 struct HookObject *hook_maximized;
35 struct HookObject *hook_fullscreen;
36 struct HookObject *hook_visible;
37 struct HookObject *hook_configuration;
38
39 #define HOOKFIRE(hook, ...)                              \
40 {                                                        \
41     PyObject *args = Py_BuildValue(__VA_ARGS__);         \
42     g_assert(args != NULL);                              \
43     hooks_fire(hook_##hook, args);                       \
44     Py_DECREF(args);                                     \
45 }
46
47 #define HOOKFIRECLIENT(hook, client)                     \
48 {                                                        \
49     hooks_fire_client(hook_##hook, client);              \
50 }
51
52 void hooks_fire(struct HookObject *hook, PyObject *args);
53
54 void hooks_fire_client(struct HookObject *hook, struct Client *client);
55
56 #endif