]> Dogcows Code - chaz/openbox/blob - src/python.hh
add a -single argument which only runs on a single screen
[chaz/openbox] / 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 #include "otk/point.hh"
10 #include "otk/rect.hh"
11 #include "otk/property.hh"
12
13 extern "C" {
14 #include <X11/Xlib.h>
15 #include <Python.h>
16 }
17
18 #include <string>
19 #include <vector>
20
21 namespace ob {
22
23 enum MouseContext {
24 MC_Frame,
25 MC_Titlebar,
26 MC_Handle,
27 MC_Window,
28 MC_MaximizeButton,
29 MC_CloseButton,
30 MC_IconifyButton,
31 MC_StickyButton,
32 MC_Grip,
33 MC_Root,
34 MC_MenuItem,
35 NUM_MOUSE_CONTEXT
36 };
37
38 enum MouseAction {
39 MousePress,
40 MouseClick,
41 MouseDoubleClick,
42 MouseMotion,
43 NUM_MOUSE_ACTION
44 };
45
46 enum KeyContext {
47 KC_Menu,
48 KC_All,
49 NUM_KEY_CONTEXT
50 };
51
52 enum EventAction {
53 EventEnterWindow,
54 EventLeaveWindow,
55 EventPlaceWindow,
56 EventNewWindow,
57 EventCloseWindow,
58 EventStartup,
59 EventShutdown,
60 EventFocus,
61 NUM_EVENTS
62 };
63
64 #ifndef SWIG
65
66 // *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** //
67 typedef struct {
68 PyObject_HEAD;
69 int screen;
70 Window window;
71 Time time;
72 unsigned int state;
73 unsigned int button;
74 MouseContext context;
75 MouseAction action;
76 int xroot;
77 int yroot;
78 int pressx;
79 int pressy;
80 int press_clientx;
81 int press_clienty;
82 int press_clientwidth;
83 int press_clientheight;
84 } MotionData;
85
86 // *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** //
87 typedef struct {
88 PyObject_HEAD;
89 int screen;
90 Window window;
91 Time time;
92 unsigned int state;
93 unsigned int button;
94 MouseContext context;
95 MouseAction action;
96 } ButtonData;
97
98 typedef struct {
99 PyObject_HEAD;
100 int screen;
101 Window window;
102 unsigned int state;
103 EventAction action;
104 } EventData;
105
106 typedef struct {
107 PyObject_HEAD;
108 int screen;
109 Window window;
110 Time time;
111 unsigned int state;
112 unsigned int key;
113 } KeyData;
114
115 void python_init(char *argv0);
116 void python_destroy();
117 bool python_exec(const std::string &path);
118
119 MotionData *new_motion_data(int screen, Window window, Time time,
120 unsigned int state, unsigned int button,
121 MouseContext context, MouseAction action,
122 int xroot, int yroot, const otk::Point &initpos,
123 const otk::Rect &initarea);
124 ButtonData *new_button_data(int screen, Window window, Time time,
125 unsigned int state, unsigned int button,
126 MouseContext context, MouseAction action);
127 EventData *new_event_data(int screen, Window window, EventAction action,
128 unsigned int state);
129 KeyData *new_key_data(int screen, Window window, Time time, unsigned int state,
130 unsigned int key);
131
132 void python_callback(PyObject *func, PyObject *data);
133
134 bool python_get_long(const char *name, long *value);
135 bool python_get_string(const char *name, std::string *value);
136 bool python_get_stringlist(const char *name, std::vector<std::string> *value);
137 #endif
138
139 PyObject *mbind(const std::string &button, ob::MouseContext context,
140 ob::MouseAction action, PyObject *func);
141
142 PyObject *kbind(PyObject *keylist, ob::KeyContext context, PyObject *func);
143
144 PyObject *ebind(ob::EventAction action, PyObject *func);
145
146 void set_reset_key(const std::string &key);
147
148 PyObject *send_client_msg(Window target, int type, Window about,
149 long data, long data1 = 0, long data2 = 0,
150 long data3 = 0, long data4 = 0);
151
152 }
153
154 #endif // __python_hh
This page took 0.039664 seconds and 4 git commands to generate.