2014-11-29 02:38:51 +00:00
|
|
|
diff -ur qtbase-opensource-src-5.4.0-rc-old_xcb/configure qtbase-opensource-src-5.4.0-rc-old_xkbcommon/configure
|
|
|
|
--- qtbase-opensource-src-5.4.0-rc-old_xcb/configure 2014-11-29 03:07:40.000000000 +0100
|
|
|
|
+++ qtbase-opensource-src-5.4.0-rc-old_xkbcommon/configure 2014-11-29 03:32:16.000000000 +0100
|
|
|
|
@@ -5144,7 +5144,7 @@
|
2014-10-08 17:57:09 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Detect libxkbcommon
|
|
|
|
-MIN_REQ_XKBCOMMON="0.4.1"
|
|
|
|
+MIN_REQ_XKBCOMMON="0.3.0"
|
|
|
|
# currently only xcb platform plugin supports building xkbcommon
|
|
|
|
if [ "$CFG_XCB" != "no" ]; then
|
2014-10-30 19:25:21 +00:00
|
|
|
if [ "$CFG_XKBCOMMON" != "no" ] && [ "$CFG_XKBCOMMON" != "qt" ]; then
|
2014-11-29 02:38:51 +00:00
|
|
|
diff -ur qtbase-opensource-src-5.4.0-rc-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp qtbase-opensource-src-5.4.0-rc-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
|
|
|
--- qtbase-opensource-src-5.4.0-rc-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-11-29 03:29:53.000000000 +0100
|
|
|
|
+++ qtbase-opensource-src-5.4.0-rc-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-11-29 03:35:36.000000000 +0100
|
|
|
|
@@ -971,7 +971,7 @@
|
2014-11-10 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QList<int> result;
|
2014-11-29 02:38:51 +00:00
|
|
|
- int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, keycode));
|
2014-11-10 16:34:57 +00:00
|
|
|
+ int baseQtKey = keysymToQtKey(sym, modifiers, keysymToUnicode(sym));
|
|
|
|
result += (baseQtKey + modifiers); // The base key is _always_ valid, of course
|
|
|
|
|
|
|
|
xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(xkb_keymap, "Shift");
|
2014-11-29 02:38:51 +00:00
|
|
|
@@ -1008,7 +1008,7 @@
|
2014-10-08 17:57:09 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
Qt::KeyboardModifiers mods = modifiers & ~neededMods;
|
2014-11-29 02:38:51 +00:00
|
|
|
- qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, keycode));
|
2014-10-08 17:57:09 +00:00
|
|
|
+ qtKey = keysymToQtKey(sym, mods, keysymToUnicode(sym));
|
2014-11-29 02:38:51 +00:00
|
|
|
if (!qtKey || qtKey == baseQtKey)
|
2014-10-08 17:57:09 +00:00
|
|
|
continue;
|
|
|
|
|
2014-11-29 02:38:51 +00:00
|
|
|
@@ -1462,7 +1462,7 @@
|
|
|
|
return;
|
|
|
|
}
|
2014-10-08 17:57:09 +00:00
|
|
|
|
|
|
|
- QString string = lookupString(xkb_state, code);
|
|
|
|
+ QString string = keysymToUnicode(sym);
|
|
|
|
int count = string.size();
|
|
|
|
string.truncate(count);
|
|
|
|
|
2014-11-29 02:38:51 +00:00
|
|
|
@@ -1535,12 +1535,18 @@
|
2014-10-08 17:57:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
-QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const
|
|
|
|
+QString QXcbKeyboard::keysymToUnicode(xcb_keysym_t sym) const
|
|
|
|
{
|
|
|
|
QByteArray chars;
|
|
|
|
- chars.resize(1 + xkb_state_key_get_utf8(state, code, 0, 0));
|
|
|
|
- // equivalent of XLookupString
|
|
|
|
- xkb_state_key_get_utf8(state, code, chars.data(), chars.size());
|
|
|
|
+ int bytes;
|
|
|
|
+ chars.resize(7);
|
|
|
|
+
|
|
|
|
+ bytes = xkb_keysym_to_utf8(sym, chars.data(), chars.size());
|
|
|
|
+
|
|
|
|
+ if (bytes == -1)
|
|
|
|
+ qWarning("QXcbKeyboard::handleKeyEvent - buffer too small");
|
|
|
|
+ chars.resize(bytes-1);
|
|
|
|
+
|
|
|
|
return QString::fromUtf8(chars);
|
|
|
|
}
|
|
|
|
|
2014-11-29 02:38:51 +00:00
|
|
|
diff -ur qtbase-opensource-src-5.4.0-rc-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h qtbase-opensource-src-5.4.0-rc-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.h
|
|
|
|
--- qtbase-opensource-src-5.4.0-rc-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-11-29 03:07:40.000000000 +0100
|
|
|
|
+++ qtbase-opensource-src-5.4.0-rc-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-11-29 03:32:16.000000000 +0100
|
|
|
|
@@ -75,7 +75,7 @@
|
2014-10-08 17:57:09 +00:00
|
|
|
void handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time);
|
|
|
|
|
|
|
|
void resolveMaskConflicts();
|
|
|
|
- QString lookupString(struct xkb_state *state, xcb_keycode_t code) const;
|
|
|
|
+ QString keysymToUnicode(xcb_keysym_t sym) const;
|
|
|
|
int keysymToQtKey(xcb_keysym_t keysym) const;
|
|
|
|
int keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const;
|
|
|
|
void printKeymapError(const char *error) const;
|