]> icculus.org git repositories - mikachu/openbox.git/blob - src/python.hh
new mouse button code is seeming to work. you can move windows
[mikachu/openbox.git] / src / python.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef   __python_hh
3 #define   __python_hh
4
5 /*! @file python.hh
6   @brief wee
7 */
8
9 extern "C" {
10 #include <X11/Xlib.h>
11 #include <Python.h>
12 }
13
14 #include <string>
15 #include <vector>
16
17 namespace ob {
18
19 enum MouseContext {
20   MC_Frame,
21   MC_Titlebar,
22   MC_Window,
23   MC_MaximizeButton,
24   MC_CloseButton,
25   MC_IconifyButton,
26   MC_StickyButton,
27   MC_Grip,
28   MC_Root,
29   MC_MenuItem,
30   NUM_MOUSE_CONTEXT
31 };
32
33 enum MouseAction {
34   MousePress,
35   MouseClick,
36   MouseDoubleClick,
37   MouseMotion,
38   NUM_MOUSE_ACTION
39 };
40
41 enum KeyContext {
42   KC_Menu,
43   KC_All,
44   NUM_KEY_CONTEXT
45 };
46
47 #ifndef SWIG
48 void python_init(char *argv0);
49 void python_destroy();
50 bool python_exec(const std::string &path);
51                  
52 void python_callback(PyObject *func, MouseAction action,
53                      Window window, MouseContext context,
54                      unsigned int state, unsigned int button,
55                      int xroot, int yroot, Time time);
56
57 void python_callback(PyObject *func, Window window, unsigned int state,
58                      unsigned int key, Time time);
59
60
61 bool python_get_string(const char *name, std::string *value);
62 bool python_get_stringlist(const char *name, std::vector<std::string> *value);
63 #endif
64
65 PyObject * mbind(const std::string &button, ob::MouseContext context,
66                  ob::MouseAction action, PyObject *func);
67
68 PyObject * kbind(PyObject *keylist, ob::KeyContext context, PyObject *func);
69 PyObject * kunbind(PyObject *keylist);
70 void kunbind_all();
71 void set_reset_key(const std::string &key);
72
73 }
74
75 #endif // __python_hh