summaryrefslogtreecommitdiff
path: root/otk
diff options
context:
space:
mode:
Diffstat (limited to 'otk')
-rw-r--r--otk/display.cc11
-rw-r--r--otk/display.hh22
-rw-r--r--otk/eventhandler.cc4
-rw-r--r--otk/eventhandler.hh12
-rw-r--r--otk/otk_wrap.cc30
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 },