path: root/src/plugins/platforms/xcb/qxcbconnection.h
diff options
authorGatis Paeglis <>2013-03-25 14:44:48 +0100
committerThe Qt Project <>2013-05-07 22:43:14 +0200
commit05351b0cde3e80d2d0ae3a838e802ff6086e4b59 (patch)
treedbcbb18247aafe9485e7ccbbbc903c858bb1c75d /src/plugins/platforms/xcb/qxcbconnection.h
parent9c1d62cc95ed2579fa25d83901c7a1aa315aa2d3 (diff)
Utilize libxkbcommon API for the keyboard backend on X11
libxkbcommon is a keymap compiler [1] which utilizes xkb keyboard configuration database [2]. xkbcommon simplifies keyboard state handling by providing xkb_state object which holds the current state of all modifiers, groups, LEDs, etc, relating to the provided keymap. Detecting modifier mapping should become simpler once it gets supported in libxkbcommon. Also with xinput2 we could get rid of the XkbStateNotify events, because xinput2 key press/release already include all the mod/group info. [1] [2] This patch: - Removes a dependency to -lxcb-keysyms - Removes a dependency to XLib call - XLookupString - Enables required functionality to fix QTBUG-27681 Task-number: QTBUG-27680 Change-Id: I10e10f873821ee02f6df72238e215a541150f38f Reviewed-by: Samuel Rødal <>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.h')
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 1d6f09a2bc..3aa13a8b3a 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -53,6 +53,14 @@
#include <QVarLengthArray>
#include <qpa/qwindowsysteminterface.h>
+// This is needed to make Qt compile together with XKB. xkb.h is using a variable
+// which is called 'explicit', this is a reserved keyword in c++ */
+#ifndef QT_NO_XKB
+#define explicit dont_use_cxx_explicit
+#include <xcb/xkb.h>
+#undef explicit
#include <QTabletEvent>
@@ -355,7 +363,7 @@ public:
QXcbWMSupport *wmSupport() const { return; }
+ xcb_window_t rootWindow();
void *xlib_display() const { return m_xlib_display; }
@@ -402,6 +410,7 @@ public:
bool hasXRandr() const { return has_randr_extension; }
bool hasInputShape() const { return has_input_shape; }
bool hasTouchWithoutMouseEmulation() const { return has_touch_without_mouse_emulation; }
+ bool hasXKB() const { return has_xkb; }
bool supportsThreadedRendering() const { return m_reader->isRunning(); }
@@ -430,6 +439,7 @@ private:
void initializeXRender();
void initializeXRandr();
void initializeXShape();
+ void initializeXKB();
void initializeXInput2Maemo();
void finalizeXInput2Maemo();
@@ -539,12 +549,14 @@ private:
uint32_t xfixes_first_event;
uint32_t xrandr_first_event;
+ uint32_t xkb_first_event;
bool has_glx_extension;
bool has_shape_extension;
bool has_randr_extension;
bool has_input_shape;
bool has_touch_without_mouse_emulation;
+ bool has_xkb;
Qt::MouseButtons m_buttons;