]> Dogcows Code - chaz/openbox/blobdiff - src/python.cc
allow python to grab the keyboard. have release events go to the grabs callback....
[chaz/openbox] / src / python.cc
index 9905dec59b2dd93211793b9b451c6bec3d773d3b..a89fa4677a33fe6c517175e26e9aca34d77f65ee 100644 (file)
@@ -123,6 +123,26 @@ PyObject *ebind(ob::EventAction action, PyObject *func)
   Py_INCREF(Py_None); return Py_None;
 }
 
+PyObject *kgrab(PyObject *func)
+{
+  if (!PyCallable_Check(func)) {
+    PyErr_SetString(PyExc_TypeError, "Invalid callback function.");
+    return NULL;
+  }
+
+  if (!ob::openbox->bindings()->grabKeyboard(func)) {
+    PyErr_SetString(PyExc_RuntimeError,"Unable to grab keybaord.");
+    return NULL;
+  }
+  Py_INCREF(Py_None); return Py_None;
+}
+
+PyObject *kungrab()
+{
+  ob::openbox->bindings()->ungrabKeyboard();
+  Py_INCREF(Py_None); return Py_None;
+}
+
 PyObject *kbind(PyObject *keylist, ob::KeyContext context, PyObject *func)
 {
   if (!PyCallable_Check(func)) {
This page took 0.022115 seconds and 4 git commands to generate.