summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-02-10 09:11:55 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-02-10 09:12:51 (GMT)
commitb6e74de57f6f7504148987394c311c215ec7b375 (patch)
tree532ef405c9a025ef0a8daf94a03c9d65e722ea99 /src
parentae873c93125df1c6afe03fe30f70878a8d47414a (diff)
downloadQt-b6e74de57f6f7504148987394c311c215ec7b375.zip
Qt-b6e74de57f6f7504148987394c311c215ec7b375.tar.gz
Qt-b6e74de57f6f7504148987394c311c215ec7b375.tar.bz2
Small improvement to XCB key input handling.
If xcb_key_symbols_get_keysym returns XCB_NO_SYMBOL, try the other column.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 67039a7..dcb35fd 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -911,6 +911,8 @@ QXcbKeyboard::~QXcbKeyboard()
xcb_key_symbols_free(m_key_symbols);
}
+// #define XCB_KEYBOARD_DEBUG
+
void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time)
{
int col = state & XCB_MOD_MASK_SHIFT ? 1 : 0;
@@ -919,7 +921,17 @@ void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycod
if (state & 128)
col += altGrOffset;
+#ifdef XCB_KEYBOARD_DEBUG
+ printf("key code: %d, state: %d, syms: ", code, state);
+ for (int i = 0; i <= 5; ++i) {
+ printf("%d ", xcb_key_symbols_get_keysym(m_key_symbols, code, i));
+ }
+ printf("\n");
+#endif
+
xcb_keysym_t sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col);
+ if (sym == XCB_NO_SYMBOL)
+ sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col ^ 0x1);
if (state & XCB_MOD_MASK_LOCK && sym <= 0x7f && isprint(sym)) {
if (isupper(sym))