]> Dogcows Code - chaz/openbox/blob - src/python.hh
Add the "obsetroot" tool. Use it to set the root background.
[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 #include "otk/display.hh"
13 #include "otk/ustring.hh"
14
15 extern "C" {
16 #include <X11/Xlib.h>
17 }
18
19 #include <string>
20 #include <vector>
21
22 namespace ob {
23
24 class Client;
25
26 struct MouseContext {
27 enum MC {
28 Frame,
29 Titlebar,
30 Handle,
31 Window,
32 IconButton,
33 MaximizeButton,
34 CloseButton,
35 IconifyButton,
36 AllDesktopsButton,
37 Grip,
38 Root,
39 MenuItem
40 #if ! (defined(DOXYGEN_IGNORE) || defined(SWIG))
41 , NUM_MOUSE_CONTEXT
42 #endif
43 };
44 };
45
46 struct MouseAction {
47 enum MA {
48 Press,
49 Release,
50 Click,
51 DoubleClick,
52 Motion
53 #if ! (defined(DOXYGEN_IGNORE) || defined(SWIG))
54 , NUM_MOUSE_ACTION
55 #endif
56 };
57 };
58
59 struct KeyContext {
60 enum KC {
61 Menu,
62 All
63 #if ! (defined(DOXYGEN_IGNORE) || defined(SWIG))
64 , NUM_KEY_CONTEXT
65 #endif
66 };
67 };
68
69 struct KeyAction {
70 enum KA {
71 Press,
72 Release
73 #if ! (defined(DOXYGEN_IGNORE) || defined(SWIG))
74 , NUM_KEY_ACTION
75 #endif
76 };
77 };
78
79 struct EventAction {
80 enum EA {
81 EnterWindow, //!< Occurs when the mouse enters a window
82 LeaveWindow, //!< Occurs when the mouse leaves a window
83 //! Occurs while a window is being managed. The handler should call
84 //! Client::move on the window
85 PlaceWindow,
86 //! Occurs while a window is being managed, just before the window is
87 //! displayed
88 /*!
89 Note that the window's state may not be completely stabilized by this
90 point. The NewWindow event should be used when possible.
91 */
92 DisplayingWindow,
93 //! Occurs when a window is finished being managed
94 NewWindow,
95 //! Occurs when a window has been closed and is going to be unmanaged
96 CloseWindow,
97 //! Occurs when the window manager manages a screen
98 /*!
99 This event occurs on each managed screen during startup.
100 */
101 Startup,
102 //! Occurs when the window manager unmanages a screen
103 /*!
104 This event occurs on each managed screen during shutdown.
105 */
106 Shutdown,
107 //! Occurs when the input focus target changes
108 /*!
109 The data.client will be None of no client is focused.
110 */
111 Focus,
112 //! Occurs when the system is fired through X.
113 /*!
114 The data.client will hold the client associated with the bell if
115 one has been specified, or None.
116 */
117 Bell,
118 //! Occurs when a client toggles its urgent status.
119 /*!
120 The Client::urgent method can be used to get the status.
121 */
122 UrgentWindow
123 #if ! (defined(DOXYGEN_IGNORE) || defined(SWIG))
124 , NUM_EVENT_ACTION
125 #endif
126 };
127 };
128
129 class MouseData {
130 public:
131 int screen;
132 Client *client;
133 Time time;
134 unsigned int state;
135 unsigned int button;
136 MouseContext::MC context;
137 MouseAction::MA action;
138 int xroot;
139 int yroot;
140 int pressx;
141 int pressy;
142 int press_clientx;
143 int press_clienty;
144 int press_clientwidth;
145 int press_clientheight;
146
147 MouseData(int screen, Client *client, Time time, unsigned int state,
148 unsigned int button, MouseContext::MC context,
149 MouseAction::MA action, int xroot, int yroot,
150 const otk::Point &initpos, const otk::Rect &initarea) {
151 this->screen = screen;
152 this->client = client;
153 this->time = time;
154 this->state = state;
155 this->button = button;
156 this->context= context;
157 this->action = action;
158 this->xroot = xroot;
159 this->yroot = yroot;
160 this->pressx = initpos.x();
161 this->pressy = initpos.y();
162 this->press_clientx = initarea.x();
163 this->press_clienty = initarea.y();
164 this->press_clientwidth = initarea.width();
165 this->press_clientheight = initarea.height();
166 }
167 MouseData(int screen, Client *client, Time time, unsigned int state,
168 unsigned int button, MouseContext::MC context,
169 MouseAction::MA action) {
170 this->screen = screen;
171 this->client = client;
172 this->time = time;
173 this->state = state;
174 this->button = button;
175 this->context= context;
176 this->action = action;
177 this->xroot = xroot;
178 this->yroot = yroot;
179 this->pressx = 0;
180 this->pressy = 0;
181 this->press_clientx = 0;
182 this->press_clienty = 0;
183 this->press_clientwidth = 0;
184 this->press_clientheight = 0;
185 }
186 };
187
188 class EventData {
189 public:
190 int screen;
191 Client *client;
192 unsigned int state;
193 EventAction::EA action;
194
195 EventData(int screen, Client *client, EventAction::EA action,
196 unsigned int state) {
197 this->screen = screen;
198 this->client = client;
199 this->action = action;
200 this->state = state;
201 }
202 };
203
204 class KeyData {
205 public:
206 int screen;
207 Client *client;
208 Time time;
209 unsigned int state;
210 char *key;
211 KeyAction::KA action;
212
213 KeyData(int screen, Client *client, Time time, unsigned int state,
214 unsigned int key, KeyAction::KA action) {
215 this->screen = screen;
216 this->client = client;
217 this->time = time;
218 this->state = state;
219 this->key = XKeysymToString(XKeycodeToKeysym(**otk::display,
220 key, 0));
221 this->action = action;
222 }
223 };
224
225 // The void*'s will be used to hold the native language's function pointer
226 typedef void (*MouseCallback)(MouseData*, void*);
227 typedef void (*KeyCallback)(KeyData*, void*);
228 typedef void (*EventCallback)(EventData*, void*);
229
230 #ifndef SWIG
231
232 void python_init(char *argv0);
233 void python_destroy();
234 bool python_exec(const std::string &path);
235
236 #endif // SWIG
237
238 }
239
240
241 #endif // __python_hh
This page took 0.045948 seconds and 4 git commands to generate.