Hello community, here is the log from the commit of package kwindowsystem for openSUSE:Factory checked in at 2017-11-16 14:41:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kwindowsystem (Old) and /work/SRC/openSUSE:Factory/.kwindowsystem.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kwindowsystem" Thu Nov 16 14:41:29 2017 rev:51 rq:541691 version:5.40.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kwindowsystem/kwindowsystem.changes 2017-10-27 13:58:50.779239669 +0200 +++ /work/SRC/openSUSE:Factory/.kwindowsystem.new/kwindowsystem.changes 2017-11-16 14:41:29.589628899 +0100 @@ -1,0 +2,12 @@ +Mon Nov 13 07:01:15 CET 2017 - [email protected] + +- Update to 5.40.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.40.0.php +- Changes since 5.39.0: + * KKeyServer: fix handling of Meta+Shift+Print, Alt+Shift+arrowkey etc. + * Support flatpak platform + * Use KWindowSystem's own platform detection API instead of duplicated code + +------------------------------------------------------------------- Old: ---- kwindowsystem-5.39.0.tar.xz New: ---- kwindowsystem-5.40.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kwindowsystem.spec ++++++ --- /var/tmp/diff_new_pack.vlMOZu/_old 2017-11-16 14:41:30.485596383 +0100 +++ /var/tmp/diff_new_pack.vlMOZu/_new 2017-11-16 14:41:30.489596237 +0100 @@ -18,13 +18,13 @@ %bcond_without lang %define lname libKF5WindowSystem5 -%define _tar_path 5.39 +%define _tar_path 5.40 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %global _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} Name: kwindowsystem -Version: 5.39.0 +Version: 5.40.0 Release: 0 BuildRequires: cmake >= 3.0 BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} ++++++ kwindowsystem-5.39.0.tar.xz -> kwindowsystem-5.40.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.39.0/CMakeLists.txt new/kwindowsystem-5.40.0/CMakeLists.txt --- old/kwindowsystem-5.39.0/CMakeLists.txt 2017-10-07 21:25:56.000000000 +0200 +++ new/kwindowsystem-5.40.0/CMakeLists.txt 2017-11-05 09:41:06.000000000 +0100 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.0) -set(KF5_VERSION "5.39.0") # handled by release scripts +set(KF5_VERSION "5.40.0") # handled by release scripts project(KWindowSystem VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.39.0 NO_MODULE) +find_package(ECM 5.40.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.39.0/autotests/CMakeLists.txt new/kwindowsystem-5.40.0/autotests/CMakeLists.txt --- old/kwindowsystem-5.39.0/autotests/CMakeLists.txt 2017-10-07 21:25:56.000000000 +0200 +++ new/kwindowsystem-5.40.0/autotests/CMakeLists.txt 2017-11-05 09:41:06.000000000 +0100 @@ -12,12 +12,12 @@ if (NOT APPLE) find_package(X11) - find_package(XCB COMPONENTS XCB) + find_package(XCB COMPONENTS XCB KEYSYMS) endif() macro(KWINDOWSYSTEM_UNIT_TESTS) foreach(_testname ${ARGN}) - set(libs KF5::WindowSystem Qt5::Test Qt5::Widgets Qt5::X11Extras) + set(libs KF5::WindowSystem Qt5::Test Qt5::Widgets Qt5::X11Extras XCB::KEYSYMS) if(X11_FOUND) list(APPEND libs ${XCB_XCB_LIBRARY}) endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.39.0/autotests/kkeyserver_x11_unittest.cpp new/kwindowsystem-5.40.0/autotests/kkeyserver_x11_unittest.cpp --- old/kwindowsystem-5.39.0/autotests/kkeyserver_x11_unittest.cpp 2017-10-07 21:25:56.000000000 +0200 +++ new/kwindowsystem-5.40.0/autotests/kkeyserver_x11_unittest.cpp 2017-11-05 09:41:06.000000000 +0100 @@ -21,26 +21,53 @@ #include <QTest> #include "kkeyserver_x11.h" #include <X11/keysym.h> +#include <xcb/xcb_keysyms.h> +#include <QX11Info> class KKeyServerTest : public QObject { Q_OBJECT private Q_SLOTS: + void initTestCase() + { + m_keySymbols = xcb_key_symbols_alloc(QX11Info::connection()); + + // This makes me wonder why we have KKeyServer::modXShift :-) + QCOMPARE(XCB_MOD_MASK_SHIFT, xcb_mod_mask_t(KKeyServer::modXShift())); + } + + + void cleanupTestCase() + { + if (m_keySymbols) { + xcb_key_symbols_free(m_keySymbols); + } + } + void keyQtToSymX_data() { QTest::addColumn<int>("keyQt"); QTest::addColumn<uint>("modX"); + QTest::addColumn<uint>("additionalState"); // set to XCB_MOD_MASK_SHIFT if shift would indeed be pressed for this shortcut QTest::addColumn<int>("keySymX"); - QTest::newRow("a") << int(Qt::Key_A) << uint(0) << XK_A; - QTest::newRow("CTRL_F1") << int(Qt::ControlModifier|Qt::Key_F1) << KKeyServer::modXCtrl() << XK_F1; - QTest::newRow("CTRL_1") << int(Qt::ControlModifier|Qt::Key_1) << KKeyServer::modXCtrl() << XK_1; - QTest::newRow("CTRL_keypad_1") << int(Qt::ControlModifier|Qt::KeypadModifier|Qt::Key_1) << KKeyServer::modXCtrl() << XK_KP_1; - QTest::newRow("CTRL_keypad_slash") << int(Qt::ControlModifier|Qt::KeypadModifier|Qt::Key_Slash) << KKeyServer::modXCtrl() << XK_KP_Divide; - QTest::newRow("CTRL_ampersand") << int(Qt::ControlModifier|Qt::Key_Ampersand) << KKeyServer::modXCtrl() << XK_ampersand; - QTest::newRow("ALT_SHIFT_right") << int(Qt::AltModifier|Qt::ShiftModifier|Qt::Key_Right) << (KKeyServer::modXAlt() | KKeyServer::modXShift()) << XK_Right; - QTest::newRow("META_SHIFT_print") << int(Qt::MetaModifier|Qt::ShiftModifier|Qt::Key_Print) << (KKeyServer::modXMeta() | KKeyServer::modXShift()) << XK_Print; + const uint numLock = KKeyServer::modXNumLock(); + + // Before adding any testcase below, check what `kcmshell5 keys` records, to make sure it matches + QTest::newRow("a") << int(Qt::Key_A) << uint(0) << numLock << XK_A; + QTest::newRow("CTRL_F1") << int(Qt::ControlModifier|Qt::Key_F1) << KKeyServer::modXCtrl() << numLock << XK_F1; + QTest::newRow("CTRL_1") << int(Qt::ControlModifier|Qt::Key_1) << KKeyServer::modXCtrl() << numLock << XK_1; + QTest::newRow("CTRL_keypad_1") << int(Qt::ControlModifier|Qt::KeypadModifier|Qt::Key_1) << KKeyServer::modXCtrl() << numLock << XK_KP_1; + QTest::newRow("CTRL_keypad_slash") << int(Qt::ControlModifier|Qt::KeypadModifier|Qt::Key_Slash) << KKeyServer::modXCtrl() << numLock << XK_KP_Divide; + QTest::newRow("CTRL_SHIFT_keypad_end") << int(Qt::ControlModifier|Qt::ShiftModifier|Qt::KeypadModifier|Qt::Key_End) << (KKeyServer::modXCtrl()|KKeyServer::modXShift()) << numLock << XK_KP_End; + QTest::newRow("CTRL_keypad_end_no_numlock") << int(Qt::ControlModifier|Qt::KeypadModifier|Qt::Key_End) << (KKeyServer::modXCtrl()) << uint(0) << XK_KP_End; + QTest::newRow("CTRL_ampersand") << int(Qt::ControlModifier|Qt::Key_Ampersand) << KKeyServer::modXCtrl() << uint(XCB_MOD_MASK_SHIFT|numLock) << XK_ampersand; + QTest::newRow("ALT_SHIFT_right") << int(Qt::AltModifier|Qt::ShiftModifier|Qt::Key_Right) << (KKeyServer::modXAlt() | KKeyServer::modXShift()) << numLock << XK_Right; + QTest::newRow("CTRL_SHIFT_right") << int(Qt::ControlModifier|Qt::ShiftModifier|Qt::Key_Right) << (KKeyServer::modXCtrl() | KKeyServer::modXShift()) << numLock << XK_Right; + QTest::newRow("META_SHIFT_print") << int(Qt::MetaModifier|Qt::ShiftModifier|Qt::Key_Print) << (KKeyServer::modXMeta() | KKeyServer::modXShift()) << numLock << XK_Print; + QTest::newRow("ALT_Tab") << int(Qt::AltModifier|Qt::Key_Tab) << (KKeyServer::modXAlt()) << numLock << XK_Tab; + QTest::newRow("ALT_Shift_Tab") << int(Qt::AltModifier|Qt::ShiftModifier|Qt::Key_Tab) << (KKeyServer::modXAlt() | KKeyServer::modXShift()) << numLock << XK_Tab; } void keyQtToSymX() @@ -50,7 +77,7 @@ QFETCH(int, keySymX); int sym; QVERIFY(KKeyServer::keyQtToSymX(keyQt, &sym)); - QCOMPARE(sym, keySymX); + QCOMPARE(QString::number(sym, 16), QString::number(keySymX, 16)); uint mod; QVERIFY(KKeyServer::keyQtToModX(keyQt, &mod)); QCOMPARE(mod, modX); @@ -68,12 +95,45 @@ QFETCH(int, keySymX); int keyCodeQt; - //qDebug() << "modX=" << modX << "keySymX=0x" << QString::number(keySymX, 16); + //qDebug() << "modX=" << modX << "keySymX=0x" << QString::number(keySymX, 16) << "keyQt=0x" << QString::number(keyQt, 16); QVERIFY(KKeyServer::symXModXToKeyQt(keySymX, modX, &keyCodeQt)); QCOMPARE(keyCodeQt, keyQt); } + void decodeXcbEvent_data() + { + keyQtToSymX_data(); + } + + void decodeXcbEvent() + { + QFETCH(int, keyQt); + QFETCH(uint, modX); + QFETCH(uint, additionalState); + QFETCH(int, keySymX); + + xcb_keycode_t *keyCodes = xcb_key_symbols_get_keycode(m_keySymbols, keySymX); + QVERIFY(keyCodes); + const xcb_keycode_t keyCodeX = keyCodes[0]; + QVERIFY(keyCodeX != XCB_NO_SYMBOL); + free(keyCodes); + + xcb_key_press_event_t event{ XCB_KEY_PRESS, keyCodeX, 0, 0 /*time*/, 0 /*root*/, 0 /*event*/, 0 /*child*/, 0 /*root_x*/, 0 /*root_y*/, 0 /*event_x*/, 0 /*event_y*/, + uint16_t(modX | additionalState), 0 /*same_screen*/, 0 /*pad0*/ }; + + int decodedKeyQt; + const bool ok = KKeyServer::xcbKeyPressEventToQt(&event, &decodedKeyQt); + QVERIFY(ok); + if (decodedKeyQt != keyQt) { + qDebug() << "given modX=" << modX << "keySymX=0x" << QString::number(keySymX, 16) << "I expected keyQt=0x" << QString::number(keyQt, 16) << QKeySequence(keyQt).toString() << "got" << QString::number(decodedKeyQt, 16) << QKeySequence(decodedKeyQt).toString(); + } + QCOMPARE(decodedKeyQt, keyQt); + } + +private: + xcb_key_symbols_t *m_keySymbols; + }; QTEST_MAIN(KKeyServerTest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.39.0/src/kusertimestamp.cpp new/kwindowsystem-5.40.0/src/kusertimestamp.cpp --- old/kwindowsystem-5.39.0/src/kusertimestamp.cpp 2017-10-07 21:25:56.000000000 +0200 +++ new/kwindowsystem-5.40.0/src/kusertimestamp.cpp 2017-11-05 09:41:06.000000000 +0100 @@ -18,6 +18,7 @@ #include "kusertimestamp.h" #include "config-kwindowsystem.h" +#include "kwindowsystem.h" #include <QGuiApplication> #if KWINDOWSYSTEM_HAVE_X11 @@ -27,7 +28,7 @@ unsigned long KUserTimestamp::userTimestamp() { - if (QGuiApplication::platformName() == QStringLiteral("xcb")) { + if (KWindowSystem::isPlatformX11()) { #if KWINDOWSYSTEM_HAVE_X11 return QX11Info::appUserTime(); #endif @@ -38,7 +39,7 @@ void KUserTimestamp::updateUserTimestamp(unsigned long time) { #if KWINDOWSYSTEM_HAVE_X11 - if (QGuiApplication::platformName() != QStringLiteral("xcb")) { + if (!KWindowSystem::isPlatformX11()) { return; } if (time == 0) { // get current X timestamp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.39.0/src/kwindowsystem.cpp new/kwindowsystem-5.40.0/src/kwindowsystem.cpp --- old/kwindowsystem-5.39.0/src/kwindowsystem.cpp 2017-10-07 21:25:56.000000000 +0200 +++ new/kwindowsystem-5.40.0/src/kwindowsystem.cpp 2017-11-05 09:41:06.000000000 +0100 @@ -507,7 +507,7 @@ height *= qApp->devicePixelRatio(); #if KWINDOWSYSTEM_HAVE_X11 if (info) { - if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0) { + if (isPlatformX11()) { // this is the xcb plugin, we can just delegate return d->iconFromNetWinInfo(width, height, scale, flags, info); } else { @@ -715,12 +715,20 @@ static inline KWindowSystem::Platform initPlatform() { + auto platformName = QGuiApplication::platformName(); + if (platformName == QLatin1String("flatpak")) { + // here we cannot know what is the actual windowing system, let's try it's env variable + const auto flatpakPlatform = QString::fromLocal8Bit(qgetenv("QT_QPA_FLATPAK_PLATFORM")); + if (!flatpakPlatform.isEmpty()) { + platformName = flatpakPlatform; + } + } #if KWINDOWSYSTEM_HAVE_X11 - if (QX11Info::isPlatformX11()) { + if (platformName == QLatin1String("xcb")) { return KWindowSystem::Platform::X11; } #endif - if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + if (platformName.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { return KWindowSystem::Platform::Wayland; } return KWindowSystem::Platform::Unknown; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.39.0/src/platforms/xcb/kkeyserver.cpp new/kwindowsystem-5.40.0/src/platforms/xcb/kkeyserver.cpp --- old/kwindowsystem-5.39.0/src/platforms/xcb/kkeyserver.cpp 2017-10-07 21:25:56.000000000 +0200 +++ new/kwindowsystem-5.40.0/src/platforms/xcb/kkeyserver.cpp 2017-11-05 09:41:06.000000000 +0100 @@ -964,10 +964,7 @@ else keySymX = keySym1; } else { - if ((e->state & XCB_MOD_MASK_SHIFT)) - keySymX = keySym1; - else - keySymX = keySym0; + keySymX = keySym0; } bool ok = KKeyServer::symXModXToKeyQt(keySymX, keyModX, keyQt); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.39.0/src/platforms/xcb/kselectionowner.cpp new/kwindowsystem-5.40.0/src/platforms/xcb/kselectionowner.cpp --- old/kwindowsystem-5.39.0/src/platforms/xcb/kselectionowner.cpp 2017-10-07 21:25:56.000000000 +0200 +++ new/kwindowsystem-5.40.0/src/platforms/xcb/kselectionowner.cpp 2017-11-05 09:41:06.000000000 +0100 @@ -25,6 +25,7 @@ #include "kselectionowner.h" #include <config-kwindowsystem.h> +#include "kwindowsystem.h" #include <QtCore/QBasicTimer> #include <QDebug> @@ -123,7 +124,7 @@ KSelectionOwner::Private* KSelectionOwner::Private::create(KSelectionOwner *owner, xcb_atom_t selection_P, int screen_P) { - if (QGuiApplication::platformName() == QStringLiteral("xcb")) { + if (KWindowSystem::isPlatformX11()) { return create(owner, selection_P, QX11Info::connection(), QX11Info::appRootWindow(screen_P)); } qWarning() << "Trying to use KSelectionOwner on a non-X11 platform! This is an application bug."; @@ -137,7 +138,7 @@ KSelectionOwner::Private *KSelectionOwner::Private::create(KSelectionOwner *owner, const char *selection_P, int screen_P) { - if (QGuiApplication::platformName() == QStringLiteral("xcb")) { + if (KWindowSystem::isPlatformX11()) { return create(owner, selection_P, QX11Info::connection(), QX11Info::appRootWindow(screen_P)); } qWarning() << "Trying to use KSelectionOwner on a non-X11 platform! This is an application bug."; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.39.0/src/platforms/xcb/kselectionwatcher.cpp new/kwindowsystem-5.40.0/src/platforms/xcb/kselectionwatcher.cpp --- old/kwindowsystem-5.39.0/src/platforms/xcb/kselectionwatcher.cpp 2017-10-07 21:25:56.000000000 +0200 +++ new/kwindowsystem-5.40.0/src/platforms/xcb/kselectionwatcher.cpp 2017-11-05 09:41:06.000000000 +0100 @@ -25,6 +25,7 @@ #include "kselectionwatcher.h" #include <config-kwindowsystem.h> +#include "kwindowsystem.h" #include <QtCore/QObject> #include <QGuiApplication> @@ -104,7 +105,7 @@ KSelectionWatcher::Private *KSelectionWatcher::Private::create(KSelectionWatcher *watcher, xcb_atom_t selection_P, int screen_P) { - if (QGuiApplication::platformName() == QStringLiteral("xcb")) { + if (KWindowSystem::isPlatformX11()) { return create(watcher, selection_P, QX11Info::connection(), QX11Info::appRootWindow(screen_P)); } return nullptr; @@ -117,7 +118,7 @@ KSelectionWatcher::Private *KSelectionWatcher::Private::create(KSelectionWatcher *watcher, const char *selection_P, int screen_P) { - if (QGuiApplication::platformName() == QStringLiteral("xcb")) { + if (KWindowSystem::isPlatformX11()) { return create(watcher, selection_P, QX11Info::connection(), QX11Info::appRootWindow(screen_P)); } return nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwindowsystem-5.39.0/src/pluginwrapper.cpp new/kwindowsystem-5.40.0/src/pluginwrapper.cpp --- old/kwindowsystem-5.39.0/src/pluginwrapper.cpp 2017-10-07 21:25:56.000000000 +0200 +++ new/kwindowsystem-5.40.0/src/pluginwrapper.cpp 2017-11-05 09:41:06.000000000 +0100 @@ -51,6 +51,14 @@ static KWindowSystemPluginInterface *loadPlugin() { + QString platformName = QGuiApplication::platformName(); + if (platformName == QLatin1String("flatpak")) { + // here we cannot know what is the actual windowing system, let's try it's env variable + const auto flatpakPlatform = QString::fromLocal8Bit(qgetenv("QT_QPA_FLATPAK_PLATFORM")); + if (!flatpakPlatform.isEmpty()) { + platformName = flatpakPlatform; + } + } foreach (const QString &candidate, pluginCandidates()) { if (!QLibrary::isLibrary(candidate)) { continue; @@ -59,10 +67,10 @@ QJsonObject metaData = loader.metaData(); const QJsonArray platforms = metaData.value(QStringLiteral("MetaData")).toObject().value(QStringLiteral("platforms")).toArray(); for (auto it = platforms.begin(); it != platforms.end(); ++it) { - if (QString::compare(QGuiApplication::platformName(), (*it).toString(), Qt::CaseInsensitive) == 0) { + if (QString::compare(platformName, (*it).toString(), Qt::CaseInsensitive) == 0) { KWindowSystemPluginInterface *interface = qobject_cast< KWindowSystemPluginInterface* >(loader.instance()); if (interface) { - qCDebug(LOG_KWINDOWSYSTEM) << "Loaded plugin" << candidate << "for platform" << QGuiApplication::platformName(); + qCDebug(LOG_KWINDOWSYSTEM) << "Loaded plugin" << candidate << "for platform" << platformName; return interface; } }
