Compounds | |
| class | Actions |
| The action interface for user-available actions. More... | |
| struct | ButtonReleaseAction |
| struct | ButtonPressAction |
| class | BackgroundWidget |
| struct | Binding |
| class | Bindings |
| struct | ButtonBinding |
| class | ButtonWidget |
| class | Client |
| Maintains the state of a client window. More... | |
| struct | Cursors |
| Mouse cursors used throughout Openbox. More... | |
| struct | EventAction |
| class | EventData |
| class | Frame |
| Holds and decorates a frame around an Client (client window). More... | |
| struct | KeyAction |
| struct | KeyBindingTree |
| struct | KeyContext |
| class | KeyData |
| class | LabelWidget |
| struct | MouseAction |
| struct | MouseContext |
| class | MouseData |
| struct | MwmHints |
| The MWM Hints as retrieved from the window property. More... | |
| class | Openbox |
| The main class for the Openbox window manager. More... | |
| class | Screen |
| Manages a single screen. More... | |
| class | WidgetBase |
Typedefs | |
| typedef std::list< PyObject * > | CallbackList |
| typedef ob::Binding | Binding |
| typedef ob::KeyBindingTree | KeyBindingTree |
Functions | |
| bool | buttonvalue (const std::string &button, unsigned int *val) |
| bool | modvalue (const std::string &mod, unsigned int *val) |
| void | destroytree (KeyBindingTree *tree) |
| void | remove_branch (KeyBindingTree *first) |
| void | python_init (char *argv0) |
| void | python_destroy () |
| bool | python_exec (const std::string &path) |
| bool | python_get_long (const char *name, long *value) |
| bool | python_get_string (const char *name, otk::ustring *value) |
| bool | python_get_stringlist (const char *name, std::vector< otk::ustring > *value) |
| PyObject * | mbind (const std::string &button, ob::MouseContext::MC context, ob::MouseAction::MA action, PyObject *func) |
| PyObject * | ebind (ob::EventAction::EA action, PyObject *func) |
| PyObject * | kgrab (int screen, PyObject *func) |
| PyObject * | kungrab () |
| PyObject * | mgrab (int screen) |
| PyObject * | mungrab () |
| PyObject * | kbind (PyObject *keylist, ob::KeyContext::KC context, PyObject *func) |
| void | kunbind_all () |
| void | set_reset_key (const std::string &key) |
| PyObject * | send_client_msg (Window target, Atom type, Window about, long data, long data1, long data2, long data3, long data4) |
| void | execute (const std::string &bin, int screen) |
| void | python_callback (PyObject *func, MouseData *data) |
| void | python_callback (PyObject *func, EventData *data) |
| void | python_callback (PyObject *func, KeyData *data) |
Variables | |
| Openbox * | openbox = (Openbox *) 0 |
| The single instance of the Openbox class for the application. | |
| PyObject * | obdict = NULL |
|
|
|
|
|
Definition at line 25 of file bindings.hh. |
|
|
Referenced by ob::Bindings::buildtree(). |
|
||||||||||||
|
Definition at line 26 of file bindings.cc. Referenced by ob::Bindings::translate().
00027 {
00028 if (button == "Left" || button == "1" || button == "Button1") {
00029 *val |= Button1;
00030 } else if (button == "Middle" || button == "2" || button == "Button2") {
00031 *val |= Button2;
00032 } else if (button == "Right" || button == "3" || button == "Button3") {
00033 *val |= Button3;
00034 } else if (button == "Up" || button == "4" || button == "Button4") {
00035 *val |= Button4;
00036 } else if (button == "Down" || button == "5" || button == "Button5") {
00037 *val |= Button5;
00038 } else
00039 return false;
00040 return true;
00041 }
|
|
|
Definition at line 111 of file bindings.cc. References ob::KeyBindingTree::first_child. Referenced by ob::Bindings::addKey(), and ob::Bindings::buildtree().
00112 {
00113 while (tree) {
00114 KeyBindingTree *c = tree->first_child;
00115 delete tree;
00116 tree = c;
00117 }
00118 }
|
|
||||||||||||
|
Definition at line 121 of file python.cc.
00122 {
00123 if (!PyCallable_Check(func)) {
00124 PyErr_SetString(PyExc_TypeError, "Invalid callback function.");
00125 return NULL;
00126 }
00127
00128 if (!ob::openbox->bindings()->addEvent(action, func)) {
00129 PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
00130 return NULL;
00131 }
00132 Py_INCREF(Py_None); return Py_None;
00133 }
|
|
||||||||||||
|
Definition at line 262 of file python.cc. References otk::bexec().
00263 {
00264 if (screen >= ScreenCount(**otk::display))
00265 screen = 0;
00266 otk::bexec(bin, otk::display->screenInfo(screen)->displayString());
00267 }
|
|
||||||||||||||||
|
Definition at line 170 of file python.cc. References ob::Bindings::StringVect.
00171 {
00172 if (!PyCallable_Check(func)) {
00173 PyErr_SetString(PyExc_TypeError, "Invalid callback function.");
00174 return NULL;
00175 }
00176 if (!PyList_Check(keylist)) {
00177 PyErr_SetString(PyExc_TypeError, "Invalid keylist. Not a list.");
00178 return NULL;
00179 }
00180
00181 ob::Bindings::StringVect vectkeylist;
00182 for (int i = 0, end = PyList_Size(keylist); i < end; ++i) {
00183 PyObject *str = PyList_GetItem(keylist, i);
00184 if (!PyString_Check(str)) {
00185 PyErr_SetString(PyExc_TypeError,
00186 "Invalid keylist. It must contain only strings.");
00187 return NULL;
00188 }
00189 vectkeylist.push_back(PyString_AsString(str));
00190 }
00191
00192 (void)context; // XXX use this sometime!
00193 if (!ob::openbox->bindings()->addKey(vectkeylist, func)) {
00194 PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
00195 return NULL;
00196 }
00197 Py_INCREF(Py_None); return Py_None;
00198 }
|
|
||||||||||||
|
Definition at line 135 of file python.cc.
00136 {
00137 if (!PyCallable_Check(func)) {
00138 PyErr_SetString(PyExc_TypeError, "Invalid callback function.");
00139 return NULL;
00140 }
00141
00142 if (!ob::openbox->bindings()->grabKeyboard(screen, func)) {
00143 PyErr_SetString(PyExc_RuntimeError,"Unable to grab keybaord.");
00144 return NULL;
00145 }
00146 Py_INCREF(Py_None); return Py_None;
00147 }
|
|
|
Definition at line 231 of file python.cc.
00232 {
00233 ob::openbox->bindings()->removeAllKeys();
00234 }
|
|
|
Definition at line 149 of file python.cc.
00150 {
00151 ob::openbox->bindings()->ungrabKeyboard();
00152 Py_INCREF(Py_None); return Py_None;
00153 }
|
|
||||||||||||||||||||
|
Definition at line 97 of file python.cc.
00099 {
00100 if (!PyCallable_Check(func)) {
00101 PyErr_SetString(PyExc_TypeError, "Invalid callback function.");
00102 return NULL;
00103 }
00104 if(context < 0 || context >= MouseContext::NUM_MOUSE_CONTEXT) {
00105 PyErr_SetString(PyExc_ValueError, "Invalid MouseContext");
00106 return NULL;
00107 }
00108 if(action < 0 || action >= MouseAction::NUM_MOUSE_ACTION) {
00109 PyErr_SetString(PyExc_ValueError, "Invalid MouseAction");
00110 return NULL;
00111 }
00112
00113 if (!ob::openbox->bindings()->addButton(button, context,
00114 action, func)) {
00115 PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
00116 return NULL;
00117 }
00118 Py_INCREF(Py_None); return Py_None;
00119 }
|
|
|
Definition at line 155 of file python.cc.
00156 {
00157 if (!ob::openbox->bindings()->grabPointer(screen)) {
00158 PyErr_SetString(PyExc_RuntimeError,"Unable to grab pointer.");
00159 return NULL;
00160 }
00161 Py_INCREF(Py_None); return Py_None;
00162 }
|
|
||||||||||||
|
Definition at line 43 of file bindings.cc. Referenced by ob::Bindings::translate().
00044 {
00045 if (mod == "C") { // control
00046 *val |= ControlMask;
00047 } else if (mod == "S") { // shift
00048 *val |= ShiftMask;
00049 } else if (mod == "A" || // alt/mod1
00050 mod == "M" ||
00051 mod == "Mod1" ||
00052 mod == "M1") {
00053 *val |= Mod1Mask;
00054 } else if (mod == "Mod2" || // mod2
00055 mod == "M2") {
00056 *val |= Mod2Mask;
00057 } else if (mod == "Mod3" || // mod3
00058 mod == "M3") {
00059 *val |= Mod3Mask;
00060 } else if (mod == "W" || // windows/mod4
00061 mod == "Mod4" ||
00062 mod == "M4") {
00063 *val |= Mod4Mask;
00064 } else if (mod == "Mod5" || // mod5
00065 mod == "M5") {
00066 *val |= Mod5Mask;
00067 } else { // invalid
00068 return false;
00069 }
00070 return true;
00071 }
|
|
|
Definition at line 164 of file python.cc.
00165 {
00166 ob::openbox->bindings()->ungrabPointer();
00167 Py_INCREF(Py_None); return Py_None;
00168 }
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Referenced by ob::Bindings::fireButton(), ob::Bindings::fireEvent(), and ob::Bindings::fireKey(). |
|
|
Definition at line 45 of file python.cc. Referenced by ob::Openbox::~Openbox().
00046 {
00047 Py_Finalize();
00048 }
|
|
|
Definition at line 50 of file python.cc. Referenced by ob::Openbox::Openbox().
00051 {
00052 FILE *rcpyfd = fopen(path.c_str(), "r");
00053 if (!rcpyfd) {
00054 printf("Failed to load python file %s\n", path.c_str());
00055 return false;
00056 }
00057 PyRun_SimpleFile(rcpyfd, const_cast<char*>(path.c_str()));
00058 fclose(rcpyfd);
00059 return true;
00060 }
|
|
||||||||||||
|
Definition at line 62 of file python.cc. Referenced by ob::Actions::buttonReleaseHandler(), ob::Actions::motionHandler(), and ob::Screen::Screen().
00063 {
00064 PyObject *val = PyDict_GetItemString(obdict, const_cast<char*>(name));
00065 if (!(val && PyInt_Check(val))) return false;
00066
00067 *value = PyInt_AsLong(val);
00068 return true;
00069 }
|
|
||||||||||||
|
Definition at line 71 of file python.cc. Referenced by ob::Frame::adjustSize().
00072 {
00073 PyObject *val = PyDict_GetItemString(obdict, const_cast<char*>(name));
00074 if (!(val && PyString_Check(val))) return false;
00075
00076 *value = PyString_AsString(val);
00077 return true;
00078 }
|
|
||||||||||||
|
Definition at line 80 of file python.cc. Referenced by ob::Screen::Screen().
00081 {
00082 PyObject *val = PyDict_GetItemString(obdict, const_cast<char*>(name));
00083 if (!(val && PyList_Check(val))) return false;
00084
00085 for (int i = 0, end = PyList_Size(val); i < end; ++i) {
00086 PyObject *str = PyList_GetItem(val, i);
00087 if (PyString_Check(str))
00088 value->push_back(PyString_AsString(str));
00089 }
00090 return true;
00091 }
|
|
|
Definition at line 21 of file python.cc. References init_ob(), init_otk(), and obdict. Referenced by ob::Openbox::Openbox().
00022 {
00023 // start the python engine
00024 Py_SetProgramName(argv0);
00025 Py_Initialize();
00026 // initialize the C python module
00027 init_otk();
00028 init_ob();
00029 // prepend the openbox directories for python scripts to the sys path
00030 PyRun_SimpleString("import sys");
00031 PyRun_SimpleString("sys.path.insert(0, '" SCRIPTDIR "')");
00032 PyRun_SimpleString(const_cast<char*>(("sys.path.insert(0, '" +
00033 otk::expandTilde("~/.openbox/python") +
00034 "')").c_str()));
00035 PyRun_SimpleString("import ob; import otk; import config;");
00036 // set up convenience global variables
00037 PyRun_SimpleString("ob.openbox = ob.Openbox_instance()");
00038 PyRun_SimpleString("otk.display = otk.Display_instance()");
00039
00040 // set up access to the python global variables
00041 PyObject *obmodule = PyImport_AddModule("config");
00042 obdict = PyModule_GetDict(obmodule);
00043 }
|
|
|
Definition at line 314 of file bindings.cc. References ob::KeyBindingTree::callbacks, ob::KeyBindingTree::first_child, and ob::KeyBindingTree::next_sibling. Referenced by ob::Bindings::removeAllKeys().
00315 {
00316 KeyBindingTree *p = first;
00317
00318 while (p) {
00319 if (p->first_child)
00320 remove_branch(p->first_child);
00321 KeyBindingTree *s = p->next_sibling;
00322 while(!p->callbacks.empty()) {
00323 Py_XDECREF(p->callbacks.front());
00324 p->callbacks.pop_front();
00325 }
00326 delete p;
00327 p = s;
00328 }
00329 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 241 of file python.cc.
00244 {
00245 XEvent e;
00246 e.xclient.type = ClientMessage;
00247 e.xclient.format = 32;
00248 e.xclient.message_type = type;
00249 e.xclient.window = about;
00250 e.xclient.data.l[0] = data;
00251 e.xclient.data.l[1] = data1;
00252 e.xclient.data.l[2] = data2;
00253 e.xclient.data.l[3] = data3;
00254 e.xclient.data.l[4] = data4;
00255
00256 XSendEvent(**otk::display, target, false,
00257 SubstructureRedirectMask | SubstructureNotifyMask,
00258 &e);
00259 Py_INCREF(Py_None); return Py_None;
00260 }
|
|
|
Definition at line 236 of file python.cc.
00237 {
00238 ob::openbox->bindings()->setResetKey(key);
00239 }
|
|
|
Definition at line 19 of file python.cc. Referenced by python_init(). |
|
1.3-rc2