diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-09 22:54:31 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-09 22:54:31 +0000 |
| commit | 345d957e1ea577480f807b892b73c3f52fe913d2 (patch) | |
| tree | 489dd8d159f22bbc3828ad094ced5288eb582628 /otk | |
| parent | b1739374a61d0c33270bafe84da9d787e79c0686 (diff) | |
new python callbacks data, infrastructure. going to rework bindings code. cvs wont work for shit now. but thats life.
Diffstat (limited to 'otk')
| -rw-r--r-- | otk/display.cc | 11 | ||||
| -rw-r--r-- | otk/display.hh | 22 | ||||
| -rw-r--r-- | otk/eventhandler.cc | 4 | ||||
| -rw-r--r-- | otk/eventhandler.hh | 12 | ||||
| -rw-r--r-- | otk/otk_wrap.cc | 30 |
5 files changed, 72 insertions, 7 deletions
diff --git a/otk/display.cc b/otk/display.cc index 6fc6117c..5bd282e6 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -11,6 +11,10 @@ extern "C" { #include <X11/keysym.h> +#ifdef XKB +#include <X11/XKBlib.h> +#endif // XKB + #ifdef SHAPE #include <X11/extensions/shape.h> #endif // SHAPE @@ -44,6 +48,8 @@ namespace otk { Display *OBDisplay::display = (Display*) 0; +bool OBDisplay::_xkb = false; +int OBDisplay::_xkb_event_basep = 0; bool OBDisplay::_shape = false; int OBDisplay::_shape_event_basep = 0; bool OBDisplay::_xinerama = false; @@ -107,6 +113,11 @@ line argument.\n\n")); } // find the availability of X extensions we like to use +#ifdef XKB + _xkb = XkbQueryExtension(display, &junk, &_xkb_event_basep, &junk, NULL, + NULL); +#endif + #ifdef SHAPE _shape = XShapeQueryExtension(display, &_shape_event_basep, &junk); #endif diff --git a/otk/display.hh b/otk/display.hh index ed469a6c..0b5d5844 100644 --- a/otk/display.hh +++ b/otk/display.hh @@ -29,14 +29,19 @@ public: typedef std::vector<ScreenInfo> ScreenInfoList; private: - //! Does the display have the Shape extention? + //! Does the display have the XKB extension? + static bool _xkb; + //! Base for events for the XKB extension + static int _xkb_event_basep; + + //! Does the display have the Shape extension? static bool _shape; - //! Base for events for the Shape extention + //! Base for events for the Shape extension static int _shape_event_basep; - //! Does the display have the Xinerama extention? + //! Does the display have the Xinerama extension? static bool _xinerama; - //! Base for events for the Xinerama extention + //! Base for events for the Xinerama extension static int _xinerama_event_basep; //! A list of all possible combinations of keyboard lock masks @@ -99,11 +104,16 @@ public: //! Find a ScreenInfo based on a root window static const ScreenInfo* findScreen(Window root); - //! Returns if the display has the shape extention available + //! Returns if the display has the xkb extension available + inline static bool xkb() { return _xkb; } + //! Returns the xkb extension's event base + inline static int xkbEventBase() { return _xkb_event_basep; } + + //! Returns if the display has the shape extension available inline static bool shape() { return _shape; } //! Returns the shape extension's event base inline static int shapeEventBase() { return _shape_event_basep; } - //! Returns if the display has the xinerama extention available + //! Returns if the display has the xinerama extension available inline static bool xinerama() { return _xinerama; } inline static unsigned int numLockMask() { return _numLockMask; } diff --git a/otk/eventhandler.cc b/otk/eventhandler.cc index d61189e4..7e1ad745 100644 --- a/otk/eventhandler.cc +++ b/otk/eventhandler.cc @@ -91,6 +91,10 @@ void OtkEventHandler::handle(const XEvent &e) if (e.type == otk::OBDisplay::shapeEventBase()) return shapeHandler((*(XShapeEvent*)&e)); #endif // SHAPE +#ifdef XKB + if (e.type == otk::OBDisplay::xkbEventBase()) + return xkbHandler((*(XkbEvent*)&e)); +#endif // XKB ; } } diff --git a/otk/eventhandler.hh b/otk/eventhandler.hh index 9308ed03..96bdff94 100644 --- a/otk/eventhandler.hh +++ b/otk/eventhandler.hh @@ -7,6 +7,11 @@ extern "C" { #ifdef SHAPE #include <X11/extensions/shape.h> #endif // SHAPE + +#ifdef XKB +#include <X11/XKBlib.h> +#endif // XKB + } namespace otk { @@ -120,10 +125,15 @@ public: virtual void clientMessageHandler(const XClientMessageEvent &); #if defined(SHAPE) || defined(DOXYGEN_IGNORE) - //! Called when a shape extention event fires + //! Called when a shape extension event fires virtual void shapeHandler(const XShapeEvent &) {} #endif // SHAPE +#if defined(XKB) || defined(DOXYGEN_IGNORE) + //! Called when an xkb extension event fires + virtual void xkbHandler(const XkbEvent &) {} +#endif // XKB + virtual ~OtkEventHandler(); protected: diff --git a/otk/otk_wrap.cc b/otk/otk_wrap.cc index 57a87fa6..5d44b3ef 100644 --- a/otk/otk_wrap.cc +++ b/otk/otk_wrap.cc @@ -5481,6 +5481,34 @@ static PyObject *_wrap_OBDisplay_findScreen(PyObject *self, PyObject *args) { } +static PyObject *_wrap_OBDisplay_xkb(PyObject *self, PyObject *args) { + PyObject *resultobj; + bool result; + + if(!PyArg_ParseTuple(args,(char *)":OBDisplay_xkb")) goto fail; + result = (bool)otk::OBDisplay::xkb(); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_OBDisplay_xkbEventBase(PyObject *self, PyObject *args) { + PyObject *resultobj; + int result; + + if(!PyArg_ParseTuple(args,(char *)":OBDisplay_xkbEventBase")) goto fail; + result = (int)otk::OBDisplay::xkbEventBase(); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_OBDisplay_shape(PyObject *self, PyObject *args) { PyObject *resultobj; bool result; @@ -12960,6 +12988,8 @@ static PyMethodDef SwigMethods[] = { { (char *)"OBDisplay_gcCache", _wrap_OBDisplay_gcCache, METH_VARARGS }, { (char *)"OBDisplay_screenInfo", _wrap_OBDisplay_screenInfo, METH_VARARGS }, { (char *)"OBDisplay_findScreen", _wrap_OBDisplay_findScreen, METH_VARARGS }, + { (char *)"OBDisplay_xkb", _wrap_OBDisplay_xkb, METH_VARARGS }, + { (char *)"OBDisplay_xkbEventBase", _wrap_OBDisplay_xkbEventBase, METH_VARARGS }, { (char *)"OBDisplay_shape", _wrap_OBDisplay_shape, METH_VARARGS }, { (char *)"OBDisplay_shapeEventBase", _wrap_OBDisplay_shapeEventBase, METH_VARARGS }, { (char *)"OBDisplay_xinerama", _wrap_OBDisplay_xinerama, METH_VARARGS }, |
