split the old_xcb patch into old_xcb and old_xkbcommon
That should not change anything by itself, but it allows applying only the old_xcb portion if libxkbcommon gets upgraded in F20, which will then fix QTBUG-36281.
This commit is contained in:
parent
7793fafdb6
commit
5006fbbb5e
@ -52,8 +52,12 @@ Source5: qconfig-multilib.h
|
||||
# QT_XCB_FORCE_SOFTWARE_OPENGL for them
|
||||
Source6: 10-qt5-check-opengl2.sh
|
||||
|
||||
# support the old versions of libxcb and libxkbcommon in F19 and F20
|
||||
Patch1: qtbase-opensource-src-5.3.2-old_xcb.patch
|
||||
# support the old version of libxcb and the resulting lack of libxkbcommon-x11
|
||||
# in F19 and F20
|
||||
Patch0: qtbase-opensource-src-5.3.2-old_xcb.patch
|
||||
|
||||
# support the old version of libxkbcommon in F19 and F20
|
||||
Patch1: qtbase-opensource-src-5.3.2-old_xkbcommon.patch
|
||||
|
||||
# support multilib optflags
|
||||
Patch2: qtbase-multilib_optflags.patch
|
||||
@ -125,8 +129,9 @@ BuildRequires: pkgconfig(xcb-xkb) >= 1.10
|
||||
BuildRequires: pkgconfig(xkbcommon) >= 0.4.1
|
||||
BuildRequires: pkgconfig(xkbcommon-x11) >= 0.4.1
|
||||
%else
|
||||
# apply patch to support older versions of xcb and xkbcommon
|
||||
# apply patches to support older versions of xcb and xkbcommon
|
||||
%global old_xcb 1
|
||||
%global old_xkbcommon 1
|
||||
BuildRequires: pkgconfig(xkbcommon)
|
||||
%endif
|
||||
%else
|
||||
@ -280,7 +285,10 @@ Qt5 libraries used for drawing widgets and OpenGL items.
|
||||
%setup -q -n qtbase-opensource-src-%{version}%{?pre:-%{pre}}
|
||||
|
||||
%if 0%{?old_xcb}
|
||||
%patch1 -p1 -b .old_xcb
|
||||
%patch0 -p1 -b .old_xcb
|
||||
%if 0%{?old_xkbcommon}
|
||||
%patch1 -p1 -b .old_xkbcommon
|
||||
%endif
|
||||
%endif
|
||||
%patch2 -p1 -b .multilib_optflags
|
||||
# drop backup file(s), else they get installed too, http://bugzilla.redhat.com/639463
|
||||
|
@ -1,7 +1,7 @@
|
||||
diff -up qtbase-opensource-src-5.3.2/configure.old_xcb qtbase-opensource-src-5.3.2/configure
|
||||
--- qtbase-opensource-src-5.3.2/configure.old_xcb 2014-09-11 05:47:55.000000000 -0500
|
||||
+++ qtbase-opensource-src-5.3.2/configure 2014-09-16 12:55:41.511468849 -0500
|
||||
@@ -4982,10 +4982,8 @@ if [ "$CFG_XCB" != "no" ]; then
|
||||
diff -ur qtbase-opensource-src-5.3.2/configure qtbase-opensource-src-5.3.2-old_xcb/configure
|
||||
--- qtbase-opensource-src-5.3.2/configure 2014-09-11 12:47:55.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xcb/configure 2014-10-08 19:46:02.000000000 +0200
|
||||
@@ -4982,10 +4982,8 @@
|
||||
QMAKE_LIBS_XCB="`$PKG_CONFIG --libs $XCB_PACKAGES 2>/dev/null`"
|
||||
fi
|
||||
|
||||
@ -13,13 +13,7 @@ diff -up qtbase-opensource-src-5.3.2/configure.old_xcb qtbase-opensource-src-5.3
|
||||
QMAKE_CFLAGS_XKB="`$PKG_CONFIG --cflags xcb xcb-xkb 2>/dev/null`"
|
||||
QMAKE_LIBS_XKB="`$PKG_CONFIG --libs xcb xcb-xkb 2>/dev/null`"
|
||||
if compileTest qpa/xcb-xkb "xcb-xkb" $QMAKE_CFLAGS_XKB $QMAKE_LIBS_XKB; then
|
||||
@@ -5087,14 +5085,14 @@ if [ "$CFG_KMS" != "no" ]; then
|
||||
fi
|
||||
|
||||
# Detect libxkbcommon
|
||||
-MIN_REQ_XKBCOMMON="0.4.1"
|
||||
+MIN_REQ_XKBCOMMON="0.3.0"
|
||||
ORIG_CFG_XKBCOMMON="$CFG_XKBCOMMON"
|
||||
@@ -5092,9 +5090,9 @@
|
||||
# currently only xcb platform plugin supports building xkbcommon
|
||||
if [ "$CFG_XCB" != "no" ]; then
|
||||
if [ "$CFG_XKBCOMMON" = "auto" ] || [ "$CFG_XKBCOMMON" = "system" ]; then
|
||||
@ -32,7 +26,7 @@ diff -up qtbase-opensource-src-5.3.2/configure.old_xcb qtbase-opensource-src-5.3
|
||||
|
||||
QMakeVar set QMAKE_CFLAGS_XKBCOMMON "$QMAKE_CFLAGS_XKBCOMMON"
|
||||
QMakeVar set QMAKE_LIBS_XKBCOMMON "$QMAKE_LIBS_XKBCOMMON"
|
||||
@@ -6588,7 +6586,7 @@ if [ "$CFG_OPENSSL" = "linked" ] && [ "$
|
||||
@@ -6588,7 +6586,7 @@
|
||||
echo
|
||||
fi
|
||||
if [ "$ORIG_CFG_XKBCOMMON" != qt ] && [ "$CFG_XKBCOMMON" = qt ]; then
|
||||
@ -41,10 +35,10 @@ diff -up qtbase-opensource-src-5.3.2/configure.old_xcb qtbase-opensource-src-5.3
|
||||
echo "the bundled version from 3rd party directory."
|
||||
fi
|
||||
if [ "$CFG_XKBCOMMON" = "qt" ] && [ "$CFG_XKB_CONFIG_ROOT" = "not found" ]; then
|
||||
diff -up qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbconnection.cpp.old_xcb qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbconnection.cpp
|
||||
--- qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbconnection.cpp.old_xcb 2014-09-11 05:48:06.000000000 -0500
|
||||
+++ qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbconnection.cpp 2014-09-16 12:55:41.512468839 -0500
|
||||
@@ -1710,7 +1710,7 @@ void QXcbConnection::initializeXKB()
|
||||
diff -ur qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbconnection.cpp qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbconnection.cpp
|
||||
--- qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbconnection.cpp 2014-09-11 12:48:06.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbconnection.cpp 2014-10-08 19:46:02.000000000 +0200
|
||||
@@ -1710,7 +1710,7 @@
|
||||
xcb_xkb_use_extension_cookie_t xkb_query_cookie;
|
||||
xcb_xkb_use_extension_reply_t *xkb_query;
|
||||
|
||||
@ -53,10 +47,10 @@ diff -up qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbconnection.cp
|
||||
xkb_query = xcb_xkb_use_extension_reply(c, xkb_query_cookie, 0);
|
||||
|
||||
if (!xkb_query) {
|
||||
diff -up qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp.old_xcb qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||
--- qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp.old_xcb 2014-09-11 05:48:06.000000000 -0500
|
||||
+++ qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-09-16 12:55:41.512468839 -0500
|
||||
@@ -697,50 +697,65 @@ void QXcbKeyboard::updateKeymap()
|
||||
diff -ur qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||
--- qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-09-11 12:48:06.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-10-08 19:46:02.000000000 +0200
|
||||
@@ -697,50 +697,65 @@
|
||||
// log only critical errors, we do our own error logging from printKeymapError()
|
||||
xkb_context_set_log_level(xkb_context, (xkb_log_level)XKB_LOG_LEVEL_CRITICAL);
|
||||
}
|
||||
@ -157,25 +151,7 @@ diff -up qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp.
|
||||
}
|
||||
|
||||
#ifndef QT_NO_XKB
|
||||
@@ -856,7 +871,7 @@ QList<int> QXcbKeyboard::possibleKeys(co
|
||||
return QList<int>();
|
||||
|
||||
QList<int> result;
|
||||
- int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, event->nativeScanCode()));
|
||||
+ 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");
|
||||
@@ -903,7 +918,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;
|
||||
@@ -995,11 +1010,23 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnectio
|
||||
@@ -995,11 +1010,23 @@
|
||||
if (connection->hasXKB()) {
|
||||
updateVModMapping();
|
||||
updateVModToRModMapping();
|
||||
@ -201,41 +177,9 @@ diff -up qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.cpp.
|
||||
} else {
|
||||
#endif
|
||||
m_key_symbols = xcb_key_symbols_alloc(xcb_connection());
|
||||
@@ -1336,7 +1363,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);
|
||||
|
||||
@@ -1400,12 +1427,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);
|
||||
}
|
||||
|
||||
diff -up qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.h.old_xcb qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||
--- qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.h.old_xcb 2014-09-11 05:48:06.000000000 -0500
|
||||
+++ qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-09-16 12:56:38.381878563 -0500
|
||||
diff -ur qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.h qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||
--- qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-09-11 12:48:06.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-10-08 19:46:02.000000000 +0200
|
||||
@@ -47,9 +47,6 @@
|
||||
#include <xcb/xcb_keysyms.h>
|
||||
|
||||
@ -246,12 +190,3 @@ diff -up qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbkeyboard.h.ol
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
@@ -86,7 +83,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;
|
||||
|
77
qtbase-opensource-src-5.3.2-old_xkbcommon.patch
Normal file
77
qtbase-opensource-src-5.3.2-old_xkbcommon.patch
Normal file
@ -0,0 +1,77 @@
|
||||
diff -ur qtbase-opensource-src-5.3.2-old_xcb/configure qtbase-opensource-src-5.3.2-old_xkbcommon/configure
|
||||
--- qtbase-opensource-src-5.3.2-old_xcb/configure 2014-10-08 19:46:02.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xkbcommon/configure 2014-10-08 19:42:46.000000000 +0200
|
||||
@@ -5085,7 +5085,7 @@
|
||||
fi
|
||||
|
||||
# Detect libxkbcommon
|
||||
-MIN_REQ_XKBCOMMON="0.4.1"
|
||||
+MIN_REQ_XKBCOMMON="0.3.0"
|
||||
ORIG_CFG_XKBCOMMON="$CFG_XKBCOMMON"
|
||||
# currently only xcb platform plugin supports building xkbcommon
|
||||
if [ "$CFG_XCB" != "no" ]; then
|
||||
diff -ur qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp qtbase-opensource-src-5.3.2-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.cpp
|
||||
--- qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-10-08 19:46:02.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.cpp 2014-10-08 19:42:46.000000000 +0200
|
||||
@@ -871,7 +871,7 @@
|
||||
return QList<int>();
|
||||
|
||||
QList<int> result;
|
||||
- int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, event->nativeScanCode()));
|
||||
+ 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");
|
||||
@@ -918,7 +918,7 @@
|
||||
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;
|
||||
@@ -1363,7 +1363,7 @@
|
||||
|
||||
Qt::KeyboardModifiers modifiers = translateModifiers(state);
|
||||
|
||||
- QString string = lookupString(xkb_state, code);
|
||||
+ QString string = keysymToUnicode(sym);
|
||||
int count = string.size();
|
||||
string.truncate(count);
|
||||
|
||||
@@ -1427,12 +1427,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
-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);
|
||||
}
|
||||
|
||||
diff -ur qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h qtbase-opensource-src-5.3.2-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.h
|
||||
--- qtbase-opensource-src-5.3.2-old_xcb/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-10-08 19:46:02.000000000 +0200
|
||||
+++ qtbase-opensource-src-5.3.2-old_xkbcommon/src/plugins/platforms/xcb/qxcbkeyboard.h 2014-10-08 19:42:46.000000000 +0200
|
||||
@@ -83,7 +83,7 @@
|
||||
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;
|
Loading…
Reference in New Issue
Block a user