From c242367a7f05433b2f8a03a09fa190f2b15737f0 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Oct 30 2014 19:25:21 +0000 Subject: rebase old_xkbcommon.patch --- diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index 7edb4b1..3f2bb4c 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -59,8 +59,8 @@ Source6: 10-qt5-check-opengl2.sh # in F19 and F20 Patch0: qtbase-opensource-src-5.4.0-old_xcb.patch -# support the old version of libxkbcommon in F19 and F20 -Patch1: qtbase-opensource-src-5.3.2-old_xkbcommon.patch +# support the old version of libxkbcommon in F19 +Patch1: qtbase-opensource-src-5.4.0-old_xkbcommon.patch # support multilib optflags Patch2: qtbase-multilib_optflags.patch diff --git a/qtbase-opensource-src-5.3.2-old_xkbcommon.patch b/qtbase-opensource-src-5.3.2-old_xkbcommon.patch deleted file mode 100644 index a2c0fd2..0000000 --- a/qtbase-opensource-src-5.3.2-old_xkbcommon.patch +++ /dev/null @@ -1,77 +0,0 @@ -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(); - - QList 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; diff --git a/qtbase-opensource-src-5.4.0-old_xkbcommon.patch b/qtbase-opensource-src-5.4.0-old_xkbcommon.patch new file mode 100644 index 0000000..5429d09 --- /dev/null +++ b/qtbase-opensource-src-5.4.0-old_xkbcommon.patch @@ -0,0 +1,68 @@ +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 + 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 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; +@@ -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); + +@@ -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); + } + +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;