From 91c7e5c378b1a639c6f5383915ed68b36b7735d4 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 24 Jan 2003 07:37:26 +0000 Subject: allow python to grab the keyboard. have release events go to the grabs callback. remove the modifier from teh state when a modifier key is the one being released --- src/python.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/python.cc') diff --git a/src/python.cc b/src/python.cc index 9905dec5..a89fa467 100644 --- a/src/python.cc +++ b/src/python.cc @@ -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)) { -- cgit v1.2.3