]> Dogcows Code - chaz/openbox/blob - src/python.hh
use client messages to switch desktops/move windows between desktops
[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 EventNewWindow,
56 EventCloseWindow,
57 EventStartup,
58 EventShutdown,
59 EventFocus,
60 NUM_EVENTS
61 };
62
63 #ifndef SWIG
64
65 // *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** //
66 typedef struct {
67 PyObject_HEAD;
68 int screen;
69 Window window;
70 Time time;
71 unsigned int state;
72 unsigned int button;
73 MouseContext context;
74 MouseAction action;
75 int xroot;
76 int yroot;
77 int pressx;
78 int pressy;
79 int press_clientx;
80 int press_clienty;
81 int press_clientwidth;
82 int press_clientheight;
83 } MotionData;
84
85 // *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** //
86 typedef struct {
87 PyObject_HEAD;
88 int screen;
89 Window window;
90 Time time;
91 unsigned int state;
92 unsigned int button;
93 MouseContext context;
94 MouseAction action;
95 } ButtonData;
96
97 typedef struct {
98 PyObject_HEAD;
99 int screen;
100 Window window;
101 unsigned int state;
102 EventAction action;
103 } EventData;
104
105 typedef struct {
106 PyObject_HEAD;
107 int screen;
108 Window window;
109 Time time;
110 unsigned int state;
111 unsigned int key;
112 } KeyData;
113
114 void python_init(char *argv0);
115 void python_destroy();
116 bool python_exec(const std::string &path);
117
118 MotionData *new_motion_data(int screen, Window window, Time time,
119 unsigned int state, unsigned int button,
120 MouseContext context, MouseAction action,
121 int xroot, int yroot, const otk::Point &initpos,
122 const otk::Rect &initarea);
123 ButtonData *new_button_data(int screen, Window window, Time time,
124 unsigned int state, unsigned int button,
125 MouseContext context, MouseAction action);
126 EventData *new_event_data(int screen, Window window, EventAction action,
127 unsigned int state);
128 KeyData *new_key_data(int screen, Window window, Time time, unsigned int state,
129 unsigned int key);
130
131 void python_callback(PyObject *func, PyObject *data);
132
133 bool python_get_long(const char *name, long *value);
134 bool python_get_string(const char *name, std::string *value);
135 bool python_get_stringlist(const char *name, std::vector<std::string> *value);
136 #endif
137
138 PyObject *mbind(const std::string &button, ob::MouseContext context,
139 ob::MouseAction action, PyObject *func);
140
141 PyObject *kbind(PyObject *keylist, ob::KeyContext context, PyObject *func);
142
143 PyObject *ebind(ob::EventAction action, PyObject *func);
144
145 void set_reset_key(const std::string &key);
146
147 PyObject *send_client_msg(Window target, int type, Window about,
148 long data, long data1 = 0, long data2 = 0,
149 long data3 = 0, long data4 = 0);
150
151 }
152
153 #endif // __python_hh
This page took 0.041226 seconds and 5 git commands to generate.