]> Dogcows Code - chaz/openbox/blob - c/obexport.c
d92e319407ec23ef5c5202c50880e83703096b23
[chaz/openbox] / c / obexport.c
1 #include "obexport.h"
2 #include <Python.h>
3 #include <glib.h>
4
5 static PyMethodDef obMethods[] = {
6 { NULL, NULL, 0, NULL }
7 };
8
9 #define ADD_INT_CONST(n) (PyModule_AddIntConstant(ob, #n, n))
10
11 void obexport_startup()
12 {
13 PyObject *ob, *obdict;
14
15 Py_InitModule("ob", obMethods);
16
17 /* get the ob module/dict */
18 ob = PyImport_ImportModule("ob"); /* new */
19 g_assert(ob != NULL);
20 obdict = PyModule_GetDict(ob); /* borrowed */
21 g_assert(obdict != NULL);
22
23 /* define all the constants! */
24
25 /* State */
26 ADD_INT_CONST(State_Starting);
27 ADD_INT_CONST(State_Exiting);
28 ADD_INT_CONST(State_Running);
29
30 /* Corner */
31 ADD_INT_CONST(Corner_TopLeft);
32 ADD_INT_CONST(Corner_TopRight);
33 ADD_INT_CONST(Corner_BottomLeft);
34 ADD_INT_CONST(Corner_BottomRight);
35
36 /* Orientation */
37 ADD_INT_CONST(Orientation_Horz);
38 ADD_INT_CONST(Orientation_Vert);
39
40 /* Gravity */
41 ADD_INT_CONST(Gravity_Forget);
42 ADD_INT_CONST(Gravity_NE);
43 ADD_INT_CONST(Gravity_N);
44 ADD_INT_CONST(Gravity_NW);
45 ADD_INT_CONST(Gravity_W);
46 ADD_INT_CONST(Gravity_SW);
47 ADD_INT_CONST(Gravity_S);
48 ADD_INT_CONST(Gravity_SE);
49 ADD_INT_CONST(Gravity_E);
50 ADD_INT_CONST(Gravity_Center);
51 ADD_INT_CONST(Gravity_Static);
52
53 /* WindowType */
54 ADD_INT_CONST(Type_Desktop);
55 ADD_INT_CONST(Type_Dock);
56 ADD_INT_CONST(Type_Toolbar);
57 ADD_INT_CONST(Type_Menu);
58 ADD_INT_CONST(Type_Utility);
59 ADD_INT_CONST(Type_Splash);
60 ADD_INT_CONST(Type_Dialog);
61 ADD_INT_CONST(Type_Normal);
62
63 /* Function */
64 ADD_INT_CONST(Func_Resize);
65 ADD_INT_CONST(Func_Move);
66 ADD_INT_CONST(Func_Iconify);
67 ADD_INT_CONST(Func_Maximize);
68 ADD_INT_CONST(Func_Shade);
69 ADD_INT_CONST(Func_Fullscreen);
70 ADD_INT_CONST(Func_Close);
71
72 /* Decoration */
73 ADD_INT_CONST(Decor_Titlebar);
74 ADD_INT_CONST(Decor_Handle);
75 ADD_INT_CONST(Decor_Border);
76 ADD_INT_CONST(Decor_Icon);
77 ADD_INT_CONST(Decor_Iconify);
78 ADD_INT_CONST(Decor_Maximize);
79 ADD_INT_CONST(Decor_AllDesktops);
80 ADD_INT_CONST(Decor_Close);
81
82 /* StackLayer */
83 ADD_INT_CONST(Layer_Icon);
84 ADD_INT_CONST(Layer_Desktop);
85 ADD_INT_CONST(Layer_Below);
86 ADD_INT_CONST(Layer_Normal);
87 ADD_INT_CONST(Layer_Above);
88 ADD_INT_CONST(Layer_Top);
89 ADD_INT_CONST(Layer_Fullscreen);
90 ADD_INT_CONST(Layer_Internal);
91
92 /* EventType */
93 ADD_INT_CONST(Logical_EnterWindow);
94 ADD_INT_CONST(Logical_LeaveWindow);
95 ADD_INT_CONST(Logical_NewWindow);
96 ADD_INT_CONST(Logical_CloseWindow);
97 ADD_INT_CONST(Logical_Startup);
98 ADD_INT_CONST(Logical_Shutdown);
99 ADD_INT_CONST(Logical_RequestActivate);
100 ADD_INT_CONST(Logical_Focus);
101 ADD_INT_CONST(Logical_Bell);
102 ADD_INT_CONST(Logical_UrgentWindow);
103 ADD_INT_CONST(Logical_WindowShow);
104 ADD_INT_CONST(Logical_WindowHide);
105 ADD_INT_CONST(Pointer_Press);
106 ADD_INT_CONST(Pointer_Release);
107 ADD_INT_CONST(Pointer_Motion);
108 ADD_INT_CONST(Key_Press);
109 ADD_INT_CONST(Key_Release);
110
111 Py_DECREF(ob);
112 }
113
114 void obexport_shutdown()
115 {
116 }
This page took 0.038327 seconds and 4 git commands to generate.