Hello community, here is the log from the commit of package libqt5-qtbase for openSUSE:Factory checked in at 2014-04-15 07:34:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libqt5-qtbase (Old) and /work/SRC/openSUSE:Factory/.libqt5-qtbase.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libqt5-qtbase" Changes: -------- --- /work/SRC/openSUSE:Factory/libqt5-qtbase/libqt5-qtbase.changes 2014-03-27 09:29:44.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libqt5-qtbase.new/libqt5-qtbase.changes 2014-04-15 07:34:08.000000000 +0200 @@ -1,0 +2,19 @@ +Tue Apr 8 06:56:21 UTC 2014 - m...@suse.com + +- Add support for byte swapping, bnc#866709 + * Add libqt5-add-support-for-byte-swapping.patch + * Add libqt5-byte-order-byte-is-address0.patch +- Fix keyboard remapping not applied on Qt5, bnc#866051 + * Add backported libqt5-add-better-support-for-keymap-update-handling.patch + * Add backported libqt5-improve-keymap-error-handling.patch + * Add backported libqt5-fix-build-failure-xcb.patch + * Add backported libqt5-update-bundled-libxkbcommon-version-to-041.patch + * Add backported libqt5-fix-regression-in-key-handling.patch + +------------------------------------------------------------------- +Fri Mar 28 08:22:53 UTC 2014 - hrvoje.sen...@gmail.com + +- The no-neon switch no longer exists with 5.3, so drop it: fixes + build on arm/aarch64 + +------------------------------------------------------------------- New: ---- libqt5-add-better-support-for-keymap-update-handling.patch libqt5-add-support-for-byte-swapping.patch libqt5-byte-order-byte-is-address0.patch libqt5-fix-build-failure-xcb.patch libqt5-fix-regression-in-key-handling.patch libqt5-improve-keymap-error-handling.patch libqt5-update-bundled-libxkbcommon-version-to-041.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libqt5-qtbase.spec ++++++ --- /var/tmp/diff_new_pack.Tk8pRg/_old 2014-04-15 07:34:10.000000000 +0200 +++ /var/tmp/diff_new_pack.Tk8pRg/_new 2014-04-15 07:34:10.000000000 +0200 @@ -46,6 +46,20 @@ Patch132: use-freetype-default.patch # PATCH-FIX-UPSTREAM f1ee10f81ac18789e9a7dc715b464415ba2bc2b8.patch -- prefer QPA implementation in qsystemtrayicon_x11 if available Patch133: f1ee10f81ac18789e9a7dc715b464415ba2bc2b8.patch +# PATCH-FIX-UPSTREAM libqt5-add-better-support-for-keymap-update-handling.patch -- fixed keyboard remapping not applied(bnc#866051, qtbug#31527) +Patch134: libqt5-add-better-support-for-keymap-update-handling.patch +# PATCH-FIX-UPSTREAM libqt5-improve-keymap-error-handling.patch -- improve keymap error handling +Patch135: libqt5-improve-keymap-error-handling.patch +# PATCH-FIX-UPSTREAM libqt5-fix-build-failure-xcb.patch -- fix build failure in xcb(qtbug#37971) +Patch136: libqt5-fix-build-failure-xcb.patch +# PATCH-FIX-UPSTREAM libqt5-update-bundled-libxkbcommon-version-to-041.patch -- updated bundled libxkbcommon also updated the minimal requirement version at build(qtbug#36281) +Patch137: libqt5-update-bundled-libxkbcommon-version-to-041.patch +# PATCH-FIX-UPSTREAM libqt5-fix-regression-in-key-handling.patch -- introduced new function from libxkbcommon 0.4.1 to fix key handling regression(qtbug#36281) +Patch138: libqt5-fix-regression-in-key-handling.patch +# PATCH-FIX-UPSTREAM libqt5-add-support-for-byte-swapping.patch -- add support for byte swapping(bnc#866709), currently it's at the upstream dev branch +Patch139: libqt5-add-support-for-byte-swapping.patch +# PATCH-FIX-UPSTREAM libqt5-byte-order-byte-is-address0.patch -- the byte order byte is at address 0(bnc#866709), currently it's at the upstream dev branch +Patch140: libqt5-byte-order-byte-is-address0.patch BuildRequires: alsa-devel BuildRequires: cups-devel BuildRequires: fdupes @@ -91,9 +105,9 @@ %endif BuildRequires: pkgconfig(ice) BuildRequires: pkgconfig(sm) -%if 0%{?suse_version} >= 1320 -BuildRequires: pkgconfig(xkbcommon) -BuildRequires: pkgconfig(xkbcommon-x11) +%if 0%{?suse_version} >= 1315 +BuildRequires: pkgconfig(xkbcommon) >= 0.4.1 +BuildRequires: pkgconfig(xkbcommon-x11) >= 0.4.1 %else BuildRequires: xkeyboard-config %endif @@ -130,6 +144,13 @@ %patch131 -p1 %patch132 -p1 %patch133 -p1 +%patch134 -p1 +%patch135 -p1 +%patch136 -p1 +%patch137 -p1 +%patch138 -p1 +%patch139 -p1 +%patch140 -p1 # be sure not to use them rm -r src/3rdparty/{libjpeg,freetype,libpng,zlib} @@ -640,7 +661,7 @@ -no-separate-debug-info \ -shared \ -xkb \ -%if 0%{?suse_version} >= 1320 +%if 0%{?suse_version} >= 1315 -system-xkbcommon \ %else -qt-xkbcommon \ @@ -686,9 +707,6 @@ -opengl desktop \ %endif -release \ -%ifarch %arm aarch64 - -no-neon \ -%endif -plugin-sql-sqlite -nomake tests \ -plugin-sql-psql -I/usr/include -I/usr/include/pgsql/ -I/usr/include/pgsql/server \ -plugin-sql-odbc \ ++++++ libqt5-add-better-support-for-keymap-update-handling.patch ++++++ ++++ 666 lines (skipped) ++++++ libqt5-add-support-for-byte-swapping.patch ++++++ >From a3ed9b781cb0e1fa4ae3b1cedcd63bd394903db7 Mon Sep 17 00:00:00 2001 From: Egbert Eich <e...@suse.de> Date: Tue, 18 Mar 2014 18:29:02 +0100 Subject: [PATCH] [xcb/xsettings] Add support for byte swapping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The XSettings protocol is not endian neutral. Instead it holds information about endianness in the first byte. It uses the same convention as X11/X.h does. So far byte order handling was missing leading to nasty crashes when byte order between clients setting and reading XSettings differed. This patch fixes this. Using the X11/X.h conventions seems to be an 'established standard', this piece is missing from the Xsettings specifications. Therefore this fix may introduce spurious regressions as other Xsettings 'providers' may use a different convention. To detect this and to avoid crashes the fix also adds checks to avoid reading past the end of the of the Xsettings data blob. If problems are encountered: warn and bail. Change-Id: If8acb23cca2478369633129af2d99e122a84cede Reviewed-by: Jørgen Lind <jorgen.l...@digia.com> --- src/plugins/platforms/xcb/qxcbxsettings.cpp | 43 +++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 141a6cc..26d95e9 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -42,6 +42,7 @@ #include "qxcbxsettings.h" #include <QtCore/QByteArray> +#include <QtCore/QtEndian> #include <X11/extensions/XIproto.h> @@ -149,47 +150,67 @@ public: { if (xSettings.length() < 12) return; - // we ignore byteorder for now char byteOrder = xSettings.at(1); - Q_UNUSED(byteOrder); - uint number_of_settings = *reinterpret_cast<const uint *>(xSettings.mid(8,4).constData()); + if (byteOrder != LSBFirst && byteOrder != MSBFirst) { + qWarning("%s ByteOrder byte %d not 0 or 1", Q_FUNC_INFO , byteOrder); + return; + } + +#define ADJUST_BO(b, t, x) \ + ((b == LSBFirst) ? \ + qFromLittleEndian<t>((const uchar *)(x)) : \ + qFromBigEndian<t>((const uchar *)(x))) +#define VALIDATE_LENGTH(x) \ + if ((size_t)xSettings.length() < (offset + local_offset + 12 + x)) { \ + qWarning("%s Length %d runs past end of data", Q_FUNC_INFO , x); \ + return; \ + } + uint number_of_settings = ADJUST_BO(byteOrder, quint32, xSettings.mid(8,4).constData()); const char *data = xSettings.constData() + 12; size_t offset = 0; for (uint i = 0; i < number_of_settings; i++) { int local_offset = 0; + VALIDATE_LENGTH(2); XSettingsType type = static_cast<XSettingsType>(*reinterpret_cast<const quint8 *>(data + offset)); local_offset += 2; - quint16 name_len = *reinterpret_cast<const quint16 *>(data + offset + local_offset); + VALIDATE_LENGTH(2); + quint16 name_len = ADJUST_BO(byteOrder, quint16, data + offset + local_offset); local_offset += 2; + VALIDATE_LENGTH(name_len); QByteArray name(data + offset + local_offset, name_len); local_offset += round_to_nearest_multiple_of_4(name_len); - int last_change_serial = *reinterpret_cast<const int *>(data + offset + local_offset); + VALIDATE_LENGTH(4); + int last_change_serial = ADJUST_BO(byteOrder, qint32, data + offset + local_offset); Q_UNUSED(last_change_serial); local_offset += 4; QVariant value; if (type == XSettingsTypeString) { - int value_length = *reinterpret_cast<const int *>(data + offset + local_offset); + VALIDATE_LENGTH(4); + int value_length = ADJUST_BO(byteOrder, qint32, data + offset + local_offset); local_offset+=4; + VALIDATE_LENGTH(value_length); QByteArray value_string(data + offset + local_offset, value_length); value.setValue(value_string); local_offset += round_to_nearest_multiple_of_4(value_length); } else if (type == XSettingsTypeInteger) { - int value_length = *reinterpret_cast<const int *>(data + offset + local_offset); + VALIDATE_LENGTH(4); + int value_length = ADJUST_BO(byteOrder, qint32, data + offset + local_offset); local_offset += 4; value.setValue(value_length); } else if (type == XSettingsTypeColor) { - quint16 red = *reinterpret_cast<const quint16 *>(data + offset + local_offset); + VALIDATE_LENGTH(2*4); + quint16 red = ADJUST_BO(byteOrder, quint16, data + offset + local_offset); local_offset += 2; - quint16 green = *reinterpret_cast<const quint16 *>(data + offset + local_offset); + quint16 green = ADJUST_BO(byteOrder, quint16, data + offset + local_offset); local_offset += 2; - quint16 blue = *reinterpret_cast<const quint16 *>(data + offset + local_offset); + quint16 blue = ADJUST_BO(byteOrder, quint16, data + offset + local_offset); local_offset += 2; - quint16 alpha= *reinterpret_cast<const quint16 *>(data + offset + local_offset); + quint16 alpha= ADJUST_BO(byteOrder, quint16, data + offset + local_offset); local_offset += 2; QColor color_value(red,green,blue,alpha); value.setValue(color_value); -- 1.8.4.5 ++++++ libqt5-byte-order-byte-is-address0.patch ++++++ >From 5819ffe492cf3cd98718819b1bd837819318d82e Mon Sep 17 00:00:00 2001 From: Egbert Eich <e...@suse.de> Date: Sun, 6 Apr 2014 16:54:03 +0200 Subject: [PATCH] [xcb/xsettings] Byte order byte is at address 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Accoring to http://standards.freedesktop.org\ /xsettings-spec/xsettings-spec-0.5.html the byte order byte is address 0 (not 1). Change-Id: I441084a7f24908dd8a504648bfc50ba2d486a586 Reviewed-by: Jørgen Lind <jorgen.l...@digia.com> --- src/plugins/platforms/xcb/qxcbxsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 26d95e9..17b40a4 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -150,7 +150,7 @@ public: { if (xSettings.length() < 12) return; - char byteOrder = xSettings.at(1); + char byteOrder = xSettings.at(0); if (byteOrder != LSBFirst && byteOrder != MSBFirst) { qWarning("%s ByteOrder byte %d not 0 or 1", Q_FUNC_INFO , byteOrder); return; -- 1.8.4.5 ++++++ libqt5-fix-build-failure-xcb.patch ++++++ >From ee3dea8d3fdc9477f3a54e5457e19be1d0c61de9 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis <gatis.paeg...@digia.com> Date: Mon, 31 Mar 2014 14:48:29 +0200 Subject: [PATCH] [xcb] Fix build failure Build failure was introduced by 9bb634a6176c639bd6b52d58151e9927c30919d0. When linking with systems provided libxkbcommon, then DFLT_XKB_CONFIG_ROOT can't be accessed directly. The reason that this slip through CI is that on CI machines Qt is build with bundled version of libxkbcommon. In addition this patch improves keymap error message, by making it more explicit for users what could be the reasons for "keymap compilation" failures and what should be done to make input work. As it turns out this is a common issue on old systems, servers and some VNC clients. Task-number: QTBUG-37971 Change-Id: I77667a404150ee7ab8465a065e23ca5eea63c33b Reviewed-by: Uli Schlachter <psyc...@znc.in> Reviewed-by: Thiago Macieira <thiago.macie...@intel.com> Reviewed-by: Lars Knoll <lars.kn...@digia.com> --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 28 +++++++++------------------- src/plugins/platforms/xcb/qxcbkeyboard.h | 2 +- 2 files changed, 10 insertions(+), 20 deletions(-) --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -663,23 +663,14 @@ void QXcbKeyboard::clearXKBConfig() memset(&xkb_names, 0, sizeof(xkb_names)); } -void QXcbKeyboard::printKeymapError(const QString &error) const +void QXcbKeyboard::printKeymapError(const char *error) const { - qWarning() << "Qt: " << error; - // check if XKB config root is a valid path - const QDir xkbRoot = qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT") - ? QString::fromLocal8Bit(qgetenv("QT_XKB_CONFIG_ROOT")) - : DFLT_XKB_CONFIG_ROOT; - if (!xkbRoot.exists() || xkbRoot.dirName() != "xkb") { - qWarning() << "Set QT_XKB_CONFIG_ROOT to provide a valid XKB configuration data path, current search paths: " - << xkbRoot.path() << ". Use ':' as separator to provide several search paths."; - return; - } - qWarning() << "_XKB_RULES_NAMES property contains:" << "\nrules : " << xkb_names.rules << - "\nmodel : " << xkb_names.model << "\nlayout : " << xkb_names.layout << - "\nvariant : " << xkb_names.variant << "\noptions : " << xkb_names.options << - "\nIf this looks like a valid keyboard layout information then you might need to " - "update XKB configuration data on the system (http://cgit.freedesktop.org/xkeyboard-config/)."; + qWarning() << error << "Current XKB configuration data search paths are: "; + for (unsigned int i = 0; i < xkb_context_num_include_paths(xkb_context); ++i) + qWarning() << xkb_context_include_path_get(xkb_context, i); + qWarning() << "Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, " + "add ':' as separator to provide several search paths and/or make sure that XKB configuration data " + "directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ ."; } void QXcbKeyboard::updateKeymap() @@ -696,7 +687,7 @@ void QXcbKeyboard::updateKeymap() xkb_context = xkb_context_new((xkb_context_flags)0); } if (!xkb_context) { - printKeymapError("Failed to create XKB context!"); + printKeymapError("Qt: Failed to create XKB context!"); m_config = false; return; } @@ -731,8 +722,7 @@ void QXcbKeyboard::updateKeymap() if (xkb_keymap) { new_state = xkb_state_new(xkb_keymap); } else { - // failed to compile from RMLVO, give a verbose error message - printKeymapError("Qt: Failed to compile a keymap!"); + printKeymapError("Failed to compile a keymap!"); m_config = false; return; } --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -92,7 +92,7 @@ protected: 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 QString &error) const; + void printKeymapError(const char *error) const; void readXKBConfig(); void clearXKBConfig(); ++++++ libqt5-fix-regression-in-key-handling.patch ++++++ >From 6ad458bc93162753e448eea28499e778e2946d2c Mon Sep 17 00:00:00 2001 From: Gatis Paeglis <gatis.paeg...@digia.com> Date: Mon, 31 Mar 2014 17:13:20 +0200 Subject: [PATCH] Fix regression in key handling. libxkbcommon 0.4.1 added two new functions, xkb_state_key_get_utf{8,32}(). They combine the operations of xkb_state_key_get_syms() and xkb_keysym_to_utf{8,32}(). The xkb_state_key_get_utf{8,32}() functions now apply Control transformation: when the Control modifier is active, the string is converted to an appropriate control character. This matches the behavior of libX11's XLookupString(3), and is required by the XKB specification: http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Interpreting_the_Control_Modifier Task-number: QTBUG-36281 Change-Id: Ib45f45d801291c171640600384107a35d7d56b9b Reviewed-by: Ran Benita <ran...@gmail.com> Reviewed-by: Lars Knoll <lars.kn...@digia.com> --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 19 ++++++++----------- src/plugins/platforms/xcb/qxcbkeyboard.h | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -853,7 +853,7 @@ QList<int> QXcbKeyboard::possibleKeys(co return QList<int>(); QList<int> result; - int baseQtKey = keysymToQtKey(sym, modifiers, keysymToUnicode(sym)); + int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, event->nativeScanCode())); result += (baseQtKey + modifiers); // The base key is _always_ valid, of course xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(xkb_keymap, "Shift"); @@ -900,7 +900,7 @@ QList<int> QXcbKeyboard::possibleKeys(co continue; Qt::KeyboardModifiers mods = modifiers & ~neededMods; - qtKey = keysymToQtKey(sym, mods, keysymToUnicode(sym)); + qtKey = keysymToQtKey(sym, mods, lookupString(kb_state, event->nativeScanCode())); if (qtKey == baseQtKey) continue; @@ -1316,7 +1316,8 @@ void QXcbKeyboard::handleKeyEvent(QWindo } Qt::KeyboardModifiers modifiers = translateModifiers(state); - QString string = keysymToUnicode(sym); + + QString string = lookupString(xkb_state, code); int count = string.size(); string.truncate(count); @@ -1379,16 +1380,12 @@ void QXcbKeyboard::handleKeyEvent(QWindo } } -QString QXcbKeyboard::keysymToUnicode(xcb_keysym_t sym) const +QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const { QByteArray chars; - 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); - + 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()); return QString::fromUtf8(chars); } --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -86,7 +86,7 @@ protected: void handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time); void resolveMaskConflicts(); - QString keysymToUnicode(xcb_keysym_t sym) const; + QString lookupString(struct xkb_state *state, xcb_keycode_t code) 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; ++++++ libqt5-improve-keymap-error-handling.patch ++++++ >From 9bb634a6176c639bd6b52d58151e9927c30919d0 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis <gatis.paeg...@digia.com> Date: Mon, 3 Mar 2014 18:00:33 +0100 Subject: [PATCH] Improve keymap error handling - add QT_XKB_CONFIG_ROOT envvar, this can be used to provide an alternative XKB configuration search paths (default XKB configuration root is detected when building Qt library). At runtime these paths might change - when dropping Qt application binary into a system with different setup. Change-Id: Ia21a3e7f0339c95793c1f543d1a95b1591e5d8df Reviewed-by: Uli Schlachter <psyc...@znc.in> Reviewed-by: Lars Knoll <lars.kn...@digia.com> --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 77 ++++++++++++++++++++++------- src/plugins/platforms/xcb/qxcbkeyboard.h | 1 2 files changed, 61 insertions(+), 17 deletions(-) --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -38,20 +38,22 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - #include "qxcbkeyboard.h" #include "qxcbwindow.h" #include "qxcbscreen.h" -#include <X11/keysym.h> + #include <qpa/qwindowsysteminterface.h> +#include <qpa/qplatforminputcontext.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformcursor.h> + #include <QtCore/QTextCodec> #include <QtCore/QMetaMethod> +#include <QtCore/QDir> #include <private/qguiapplication_p.h> -#include <stdio.h> -#include <qpa/qplatforminputcontext.h> -#include <qpa/qplatformintegration.h> -#include <qpa/qplatformcursor.h> +#include <stdio.h> +#include <X11/keysym.h> #ifndef XK_ISO_Left_Tab #define XK_ISO_Left_Tab 0xFE20 @@ -619,6 +621,12 @@ void QXcbKeyboard::readXKBConfig() char *xkb_config = (char *)xcb_get_property_value(config_reply); int length = xcb_get_property_value_length(config_reply); + // on old X servers xkb_config can be 0 even if config_reply indicates a succesfull read + if (!xkb_config || length == 0) + return; + // ### TODO some X servers don't set _XKB_RULES_NAMES at all, in these cases it is filled + // with gibberish, we would need to do some kind of sanity check + char *names[5] = { 0, 0, 0, 0, 0 }; char *p = xkb_config, *end = p + length; int i = 0; @@ -655,17 +663,45 @@ void QXcbKeyboard::clearXKBConfig() memset(&xkb_names, 0, sizeof(xkb_names)); } +void QXcbKeyboard::printKeymapError(const QString &error) const +{ + qWarning() << "Qt: " << error; + // check if XKB config root is a valid path + const QDir xkbRoot = qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT") + ? QString::fromLocal8Bit(qgetenv("QT_XKB_CONFIG_ROOT")) + : DFLT_XKB_CONFIG_ROOT; + if (!xkbRoot.exists() || xkbRoot.dirName() != "xkb") { + qWarning() << "Set QT_XKB_CONFIG_ROOT to provide a valid XKB configuration data path, current search paths: " + << xkbRoot.path() << ". Use ':' as separator to provide several search paths."; + return; + } + qWarning() << "_XKB_RULES_NAMES property contains:" << "\nrules : " << xkb_names.rules << + "\nmodel : " << xkb_names.model << "\nlayout : " << xkb_names.layout << + "\nvariant : " << xkb_names.variant << "\noptions : " << xkb_names.options << + "\nIf this looks like a valid keyboard layout information then you might need to " + "update XKB configuration data on the system (http://cgit.freedesktop.org/xkeyboard-config/)."; +} + void QXcbKeyboard::updateKeymap() { m_config = true; // set xkb context object if (!xkb_context) { - xkb_context = xkb_context_new((xkb_context_flags)0); + if (qEnvironmentVariableIsSet("QT_XKB_CONFIG_ROOT")) { + xkb_context = xkb_context_new((xkb_context_flags)XKB_CONTEXT_NO_DEFAULT_INCLUDES); + QList<QByteArray> xkbRootList = QByteArray(qgetenv("QT_XKB_CONFIG_ROOT")).split(':'); + foreach (QByteArray xkbRoot, xkbRootList) + xkb_context_include_path_append(xkb_context, xkbRoot.constData()); + } else { + xkb_context = xkb_context_new((xkb_context_flags)0); + } if (!xkb_context) { - qWarning("Qt: Failed to create XKB context"); + printKeymapError("Failed to create XKB context!"); m_config = false; return; } + // 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); } // update xkb keymap object xkb_keymap_unref(xkb_keymap); @@ -685,21 +721,28 @@ void QXcbKeyboard::updateKeymap() // Compile a keymap from RMLVO (rules, models, layouts, variants and options) names readXKBConfig(); xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0); - if (xkb_keymap) + if (!xkb_keymap) { + // last fallback is to used hard-coded keymap name, see DEFAULT_XKB_* in xkbcommon.pri + qWarning() << "Qt: Could not determine keyboard configuration data" + " from X server, will use hard-coded keymap configuration."; + clearXKBConfig(); + xkb_keymap = xkb_keymap_new_from_names(xkb_context, &xkb_names, (xkb_keymap_compile_flags)0); + } + if (xkb_keymap) { new_state = xkb_state_new(xkb_keymap); - } + } else { + // failed to compile from RMLVO, give a verbose error message + printKeymapError("Qt: Failed to compile a keymap!"); + m_config = false; + return; + } - if (!xkb_keymap) { - qWarning("Qt: Failed to compile a keymap"); - m_config = false; } if (!new_state) { - qWarning("Qt: Failed to create xkb state"); + qWarning("Qt: Failed to create xkb state!"); m_config = false; - } - if (!m_config) return; - + } // update xkb state object xkb_state_unref(xkb_state); xkb_state = new_state; --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -92,6 +92,7 @@ protected: 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 QString &error) const; void readXKBConfig(); void clearXKBConfig(); ++++++ libqt5-update-bundled-libxkbcommon-version-to-041.patch ++++++ ++++ 7085 lines (skipped) -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org