qt5-qtbase/qtbase-opensource-src-5.4.0-old_xkbcommon.patch

69 lines
3.3 KiB
Diff
Raw Normal View History

2014-10-30 19:25:21 +00:00
diff -up qtbase-opensource-src-5.4.0-beta/configure.old_xkbcommon qtbase-opensource-src-5.4.0-beta/configure
--- qtbase-opensource-src-5.4.0-beta/configure.old_xkbcommon 2014-10-30 14:22:00.388881243 -0500
+++ qtbase-opensource-src-5.4.0-beta/configure 2014-10-30 14:23:39.800851375 -0500
@@ -5143,7 +5143,7 @@ if [ "$CFG_KMS" != "no" ]; then
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
diff -up qtbase-opensource-src-5.4.0-beta/src/plugins/platforms/xcb/qxcbkeyboard.cpp.old_xkbcommon qtbase-opensource-src-5.4.0-beta/src/plugins/platforms/xcb/qxcbkeyboard.cpp
--- qtbase-opensource-src-5.4.0-beta/src/plugins/platforms/xcb/qxcbkeyboard.cpp.old_xkbcommon 2014-10-30 14:22:00.383881294 -0500
+++ qtbase-opensource-src-5.4.0-beta/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-10-30 14:22:00.390881222 -0500
@@ -916,7 +916,7 @@ QList<int> QXcbKeyboard::possibleKeys(co
continue;
Qt::KeyboardModifiers mods = modifiers & ~neededMods;
- qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, event->nativeScanCode()));
+ qtKey = keysymToQtKey(sym, mods, keysymToUnicode(sym));
if (qtKey == baseQtKey)
continue;
2014-10-30 19:25:21 +00:00
@@ -1361,7 +1361,7 @@ void QXcbKeyboard::handleKeyEvent(xcb_wi
Qt::KeyboardModifiers modifiers = translateModifiers(state);
- QString string = lookupString(xkb_state, code);
+ QString string = keysymToUnicode(sym);
int count = string.size();
string.truncate(count);
2014-10-30 19:25:21 +00:00
@@ -1425,12 +1425,18 @@ void QXcbKeyboard::handleKeyEvent(xcb_wi
}
}
-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-10-30 19:25:21 +00:00
diff -up qtbase-opensource-src-5.4.0-beta/src/plugins/platforms/xcb/qxcbkeyboard.h.old_xkbcommon qtbase-opensource-src-5.4.0-beta/src/plugins/platforms/xcb/qxcbkeyboard.h
--- qtbase-opensource-src-5.4.0-beta/src/plugins/platforms/xcb/qxcbkeyboard.h.old_xkbcommon 2014-10-30 14:22:00.383881294 -0500
+++ qtbase-opensource-src-5.4.0-beta/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-10-30 14:22:00.390881222 -0500
@@ -75,7 +75,7 @@ protected:
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;