Hello community,

here is the log from the commit of package kguiaddons for openSUSE:Factory 
checked in at 2019-07-26 12:14:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kguiaddons (Old)
 and      /work/SRC/openSUSE:Factory/.kguiaddons.new.4126 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kguiaddons"

Fri Jul 26 12:14:10 2019 rev:68 rq:715879 version:5.60.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/kguiaddons/kguiaddons.changes    2019-06-22 
11:11:10.316495592 +0200
+++ /work/SRC/openSUSE:Factory/.kguiaddons.new.4126/kguiaddons.changes  
2019-07-26 12:14:15.210815278 +0200
@@ -1,0 +2,14 @@
+Sun Jul 14 06:41:38 UTC 2019 - [email protected]
+
+- Update to 5.60.0
+  * New feature release
+  * For more details please see:
+  * https://www.kde.org/announcements/kde-frameworks-5.60.0.php
+- Changes since 5.59.0:
+  * Don't try to generate python bindings for kmodifierkeyinfoprovider_p.h
+  * KModifierKeyInfo: we are sharing the internal implementation
+  * Remove #ifdef for Qt 5.11 since we require it nowadays
+  * Remove double look-ups
+  * Move to runtime the decision to use x11 or not
+
+-------------------------------------------------------------------

Old:
----
  kguiaddons-5.59.0.tar.xz

New:
----
  kguiaddons-5.60.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kguiaddons.spec ++++++
--- /var/tmp/diff_new_pack.UyDv3s/_old  2019-07-26 12:14:15.798815170 +0200
+++ /var/tmp/diff_new_pack.UyDv3s/_new  2019-07-26 12:14:15.802815169 +0200
@@ -17,13 +17,13 @@
 
 
 %define lname   libKF5GuiAddons5
-%define _tar_path 5.59
+%define _tar_path 5.60
 # 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: %define _kf5_bugfix_version %(echo %{_kf5_version} | 
awk -F. '{print $1"."$2}')}
 Name:           kguiaddons
-Version:        5.59.0
+Version:        5.60.0
 Release:        0
 Summary:        Utilities for graphical user interfaces
 License:        LGPL-2.1-or-later
@@ -89,6 +89,10 @@
 %license COPYING*
 %doc README*
 %{_kf5_libdir}/libKF5GuiAddons.so.*
+%dir %{_kf5_plugindir}/kf5/
+%dir %{_kf5_plugindir}/kf5/kguiaddons
+%dir %{_kf5_plugindir}/kf5/kguiaddons/kmodifierkey
+%{_kf5_plugindir}/kf5/kguiaddons/kmodifierkey/kmodifierkey_xcb.so
 
 %files devel
 %{_kf5_libdir}/libKF5GuiAddons.so

++++++ kguiaddons-5.59.0.tar.xz -> kguiaddons-5.60.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kguiaddons-5.59.0/CMakeLists.txt 
new/kguiaddons-5.60.0/CMakeLists.txt
--- old/kguiaddons-5.59.0/CMakeLists.txt        2019-06-01 18:37:53.000000000 
+0200
+++ new/kguiaddons-5.60.0/CMakeLists.txt        2019-07-08 01:31:37.000000000 
+0200
@@ -1,10 +1,10 @@
 cmake_minimum_required(VERSION 3.5)
 
-set(KF5_VERSION "5.59.0") # handled by release scripts
+set(KF5_VERSION "5.60.0") # handled by release scripts
 project(KGuiAddons VERSION ${KF5_VERSION})
 
 include(FeatureSummary)
-find_package(ECM 5.59.0  NO_MODULE)
+find_package(ECM 5.60.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)
 
@@ -14,7 +14,7 @@
 include(KDEInstallDirs)
 include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
 include(KDECMakeSettings)
-set(REQUIRED_QT_VERSION 5.10.0)
+set(REQUIRED_QT_VERSION 5.11.0)
 find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
 
 if (NOT APPLE AND NOT WIN32)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kguiaddons-5.59.0/src/CMakeLists.txt 
new/kguiaddons-5.60.0/src/CMakeLists.txt
--- old/kguiaddons-5.59.0/src/CMakeLists.txt    2019-06-01 18:37:53.000000000 
+0200
+++ new/kguiaddons-5.60.0/src/CMakeLists.txt    2019-07-08 01:31:37.000000000 
+0200
@@ -14,20 +14,7 @@
  util/urlhandler.cpp
 )
 
-set (kmodifierkeyinfoprovider_impl "dummy")
-if (NOT APPLE AND X11_FOUND AND X11_Xkb_FOUND AND XCB_XCB_FOUND)
-    find_package(Qt5X11Extras ${REQUIRED_QT_VERSION} NO_MODULE)
-    if (Qt5X11Extras_FOUND)
-        include_directories (
-            ${X11_Xkb_INCLUDE_PATH}
-            ${X11_Xlib_INCLUDE_PATH}
-            ${XCB_XCB_INCLUDE_DIR}
-        )
-        set (kmodifierkeyinfoprovider_impl "x11")
-    endif()
-endif ()
-
-set (kguiaddons_LIB_SRCS ${kguiaddons_LIB_SRCS} 
util/kmodifierkeyinfoprovider_${kmodifierkeyinfoprovider_impl}.cpp)
+set (kguiaddons_LIB_SRCS ${kguiaddons_LIB_SRCS} 
util/kmodifierkeyinfoprovider.cpp)
 
 add_library(KF5GuiAddons ${kguiaddons_LIB_SRCS})
 
@@ -45,9 +32,20 @@
 target_compile_definitions(KF5GuiAddons INTERFACE 
"$<INSTALL_INTERFACE:KGUIADDONS_LIB>")
 target_link_libraries(KF5GuiAddons PUBLIC Qt5::Gui)
 
-if (kmodifierkeyinfoprovider_impl STREQUAL "x11")
-    target_link_libraries(KF5GuiAddons LINK_PRIVATE ${X11_LIBRARIES} 
${XCB_XCB_LIBRARY} Qt5::X11Extras)
-endif()
+set(WITH_XCB)
+if (NOT APPLE AND X11_FOUND AND X11_Xkb_FOUND AND XCB_XCB_FOUND)
+    find_package(Qt5X11Extras ${REQUIRED_QT_VERSION} NO_MODULE)
+    if (Qt5X11Extras_FOUND)
+        add_library(kmodifierkey_xcb MODULE 
util/kmodifierkeyinfoprovider_xcb.cpp)
+        target_include_directories (kmodifierkey_xcb PRIVATE
+            ${X11_Xkb_INCLUDE_PATH}
+            ${X11_Xlib_INCLUDE_PATH}
+            ${XCB_XCB_INCLUDE_DIR}
+        )
+        target_link_libraries(kmodifierkey_xcb PRIVATE ${X11_LIBRARIES} 
${XCB_XCB_LIBRARY} Qt5::X11Extras KF5::GuiAddons)
+        install( TARGETS kmodifierkey_xcb DESTINATION 
${PLUGIN_INSTALL_DIR}/kf5/kguiaddons/kmodifierkey/)
+    endif()
+endif ()
 
 set_target_properties(KF5GuiAddons PROPERTIES VERSION   
${KGUIADDONS_VERSION_STRING}
                                               SOVERSION ${KGUIADDONS_SOVERSION}
@@ -113,6 +111,7 @@
 install(TARGETS KF5GuiAddons EXPORT KF5GuiAddonsTargets 
${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
 install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/kguiaddons_export.h
+  util/kmodifierkeyinfoprovider_p.h
   util/klocalimagecacheimpl.h # implementation detail, no forwarding header
   ${KGuiAddons_HEADERS}
   DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KGuiAddons COMPONENT Devel
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kguiaddons-5.59.0/src/text/kwordwrap.cpp 
new/kguiaddons-5.60.0/src/text/kwordwrap.cpp
--- old/kguiaddons-5.59.0/src/text/kwordwrap.cpp        2019-06-01 
18:37:53.000000000 +0200
+++ new/kguiaddons-5.60.0/src/text/kwordwrap.cpp        2019-07-08 
01:31:37.000000000 +0200
@@ -225,41 +225,25 @@
         if (t.isRightToLeft()) {
             x += maxW; // start from the right side for RTL string
             if (tl > 3) {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
                 x -= fm.horizontalAdvance(t.left(tl - 3));
-#else
-                x -= fm.width(t.left(tl - 3));
-#endif
                 p->drawText(x, y, t.left(tl - 3));
             }
             for (int i = 0; i < n; i++) {
                 p->setPen(mixColors(0.70 - i * 0.25, textColor, bgColor));
                 QString s(t.at(tl - n + i));
-#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
                 x -= fm.horizontalAdvance(s);
-#else
-                x -= fm.width(s);
-#endif
                 p->drawText(x, y, s);
             }
         } else {
             if (tl > 3) {
                 p->drawText(x, y, t.left(tl - 3));
-#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
                 x += fm.horizontalAdvance(t.left(tl - 3));
-#else
-                x += fm.width(t.left(tl - 3));
-#endif
             }
             for (int i = 0; i < n; i++) {
                 p->setPen(mixColors(0.70 - i * 0.25, textColor, bgColor));
                 QString s(t.at(tl - n + i));
                 p->drawText(x, y, s);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
                 x += fm.horizontalAdvance(s);
-#else
-                x += fm.width(s);
-#endif
             }
         }
     } else {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kguiaddons-5.59.0/src/util/kmodifierkeyinfo.cpp 
new/kguiaddons-5.60.0/src/util/kmodifierkeyinfo.cpp
--- old/kguiaddons-5.59.0/src/util/kmodifierkeyinfo.cpp 2019-06-01 
18:37:53.000000000 +0200
+++ new/kguiaddons-5.60.0/src/util/kmodifierkeyinfo.cpp 2019-07-08 
01:31:37.000000000 +0200
@@ -20,27 +20,40 @@
 
 #include "kmodifierkeyinfo.h"
 #include "kmodifierkeyinfoprovider_p.h"
+#include <QPluginLoader>
+
+#include <QDebug>
+#include <QGuiApplication>
+
+KModifierKeyInfoProvider* createProvider()
+{
+    QPluginLoader 
loader(QStringLiteral("kf5/kguiaddons/kmodifierkey/kmodifierkey_")+qGuiApp->platformName());
+    auto instance = dynamic_cast<KModifierKeyInfoProvider*>(loader.instance());
+    if (instance)
+        return instance;
+    qWarning() << "Error: could not load plugin for platform" << 
loader.fileName() << "error:" << loader.errorString() << loader.instance();
+    return new KModifierKeyInfoProvider;
+}
 
 KModifierKeyInfo::KModifierKeyInfo(QObject *parent)
-    : QObject(parent), p(new KModifierKeyInfoProvider)
+    : QObject(parent), p(createProvider())
 {
-    connect(p, &KModifierKeyInfoProvider::keyPressed,
+    connect(p.data(), &KModifierKeyInfoProvider::keyPressed,
             this, &KModifierKeyInfo::keyPressed);
-    connect(p, &KModifierKeyInfoProvider::keyLatched,
+    connect(p.data(), &KModifierKeyInfoProvider::keyLatched,
             this, &KModifierKeyInfo::keyLatched);
-    connect(p, &KModifierKeyInfoProvider::keyLocked,
+    connect(p.data(), &KModifierKeyInfoProvider::keyLocked,
             this, &KModifierKeyInfo::keyLocked);
-    connect(p, &KModifierKeyInfoProvider::buttonPressed,
+    connect(p.data(), &KModifierKeyInfoProvider::buttonPressed,
             this, &KModifierKeyInfo::buttonPressed);
-    connect(p, &KModifierKeyInfoProvider::keyAdded,
+    connect(p.data(), &KModifierKeyInfoProvider::keyAdded,
             this, &KModifierKeyInfo::keyAdded);
-    connect(p, &KModifierKeyInfoProvider::keyRemoved,
+    connect(p.data(), &KModifierKeyInfoProvider::keyRemoved,
             this, &KModifierKeyInfo::keyRemoved);
 }
 
 KModifierKeyInfo::~KModifierKeyInfo()
 {
-    delete p;
 }
 
 bool KModifierKeyInfo::knowsKey(Qt::Key key) const
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kguiaddons-5.59.0/src/util/kmodifierkeyinfo.h 
new/kguiaddons-5.60.0/src/util/kmodifierkeyinfo.h
--- old/kguiaddons-5.59.0/src/util/kmodifierkeyinfo.h   2019-06-01 
18:37:53.000000000 +0200
+++ new/kguiaddons-5.60.0/src/util/kmodifierkeyinfo.h   2019-07-08 
01:31:37.000000000 +0200
@@ -23,6 +23,7 @@
 
 #include <kguiaddons_export.h>
 
+#include <QExplicitlySharedDataPointer>
 #include <QObject>
 
 class KModifierKeyInfoProvider;
@@ -185,7 +186,7 @@
 
 private:
     Q_DISABLE_COPY(KModifierKeyInfo)
-    KModifierKeyInfoProvider *const p;  // krazy:exclude=dpointer
+    QExplicitlySharedDataPointer<KModifierKeyInfoProvider> const p;  // 
krazy:exclude=dpointer
 };
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider.cpp 
new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider.cpp
--- old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider.cpp 2019-06-01 
18:37:53.000000000 +0200
+++ new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider.cpp 2019-07-08 
01:31:37.000000000 +0200
@@ -20,26 +20,52 @@
 
 #include "kmodifierkeyinfoprovider_p.h"
 
+KModifierKeyInfoProvider::KModifierKeyInfoProvider()
+    : QObject(nullptr)
+{
+}
+
+KModifierKeyInfoProvider::~KModifierKeyInfoProvider()
+{
+}
+
+bool KModifierKeyInfoProvider::setKeyLatched(Qt::Key key, bool latched)
+{
+    Q_UNUSED(key);
+    Q_UNUSED(latched);
+    return false;
+}
+
+bool KModifierKeyInfoProvider::setKeyLocked(Qt::Key key, bool locked)
+{
+    Q_UNUSED(key);
+    Q_UNUSED(locked);
+    return false;
+}
+
 bool KModifierKeyInfoProvider::isKeyPressed(Qt::Key key) const
 {
-    if (m_modifierStates.contains(key)) {
-        return m_modifierStates[key] & Pressed;
+    auto it = m_modifierStates.constFind(key);
+    if (it != m_modifierStates.constEnd()) {
+        return *it & Pressed;
     }
     return false;
 }
 
 bool KModifierKeyInfoProvider::isKeyLatched(Qt::Key key) const
 {
-    if (m_modifierStates.contains(key)) {
-        return m_modifierStates[key] & Latched;
+    auto it = m_modifierStates.constFind(key);
+    if (it != m_modifierStates.constEnd()) {
+        return *it & Latched;
     }
     return false;
 }
 
 bool KModifierKeyInfoProvider::isKeyLocked(Qt::Key key) const
 {
-    if (m_modifierStates.contains(key)) {
-        return m_modifierStates[key] & Locked;
+    auto it = m_modifierStates.constFind(key);
+    if (it != m_modifierStates.constEnd()) {
+        return *it & Locked;
     }
     return false;
 }
@@ -62,4 +88,20 @@
     return m_modifierStates.keys();
 }
 
-#include "moc_kmodifierkeyinfoprovider_p.cpp"
+void KModifierKeyInfoProvider::stateUpdated(Qt::Key key, 
KModifierKeyInfoProvider::ModifierStates newState)
+{
+    auto &state = m_modifierStates[key];
+    if (newState != state) {
+        const auto difference = (newState ^ state);
+        state = newState;
+        if (difference & Pressed) {
+            emit keyPressed(key, newState & Pressed);
+        }
+        if (difference & Latched) {
+            emit keyLatched(key, newState & Latched);
+        }
+        if (difference & Locked) {
+            emit keyLocked(key, newState & Locked);
+        }
+    }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_dummy.cpp 
new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_dummy.cpp
--- old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_dummy.cpp   
2019-06-01 18:37:53.000000000 +0200
+++ new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_dummy.cpp   
1970-01-01 01:00:00.000000000 +0100
@@ -1,53 +0,0 @@
-/*
-    Copyright 2009  Michael Leupold <[email protected]>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) version 3, or any
-    later version accepted by the membership of KDE e.V. (or its
-    successor approved by the membership of KDE e.V.), which shall
-    act as a proxy defined in Section 6 of version 3 of the license.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library.  If not, see 
<http://www.gnu.org/licenses/>.
-*/
-
-#include "kmodifierkeyinfo.h"
-#include "kmodifierkeyinfoprovider_p.h"
-
-KModifierKeyInfoProvider::KModifierKeyInfoProvider()
-    : QObject(0)
-{
-}
-
-KModifierKeyInfoProvider::~KModifierKeyInfoProvider()
-{
-}
-
-bool KModifierKeyInfoProvider::setKeyLatched(Qt::Key key, bool latched)
-{
-    Q_UNUSED(key);
-    Q_UNUSED(latched);
-    return false;
-}
-
-bool KModifierKeyInfoProvider::setKeyLocked(Qt::Key key, bool locked)
-{
-    Q_UNUSED(key);
-    Q_UNUSED(locked);
-    return false;
-}
-
-bool KModifierKeyInfoProvider::nativeEventFilter(const QByteArray &eventType, 
void *message, long int *result)
-{
-    Q_UNUSED(eventType)
-    Q_UNUSED(message)
-    Q_UNUSED(result)
-    return false;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_p.h 
new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_p.h
--- old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_p.h 2019-06-01 
18:37:53.000000000 +0200
+++ new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_p.h 2019-07-08 
01:31:37.000000000 +0200
@@ -24,13 +24,15 @@
 #include <QAbstractNativeEventFilter>
 #include <QHash>
 #include <QObject>
+#include <QSharedData>
+#include "kguiaddons_export.h"
 
 /**
  * Background class that implements the behaviour of KModifierKeyInfo for
  * the different supported platforms.
  * @internal
  */
-class KModifierKeyInfoProvider : public QObject, public 
QAbstractNativeEventFilter
+class KGUIADDONS_EXPORT KModifierKeyInfoProvider : public QObject, public 
QSharedData
 {
     Q_OBJECT
 
@@ -41,6 +43,7 @@
         Latched = 0x2,
         Locked = 0x4
     };
+    Q_ENUM(ModifierState);
     Q_DECLARE_FLAGS(ModifierStates, ModifierState)
 
     KModifierKeyInfoProvider();
@@ -66,7 +69,7 @@
      * @param latched true to latch the key, false to unlatch it
      * @return true if the key is known, false else
      */
-    bool setKeyLatched(Qt::Key key, bool latched);
+    virtual bool setKeyLatched(Qt::Key key, bool latched);
 
     /**
      * Detect if a key is locked.
@@ -81,7 +84,7 @@
      * @param latched true to lock the key, false to unlock it
      * @return true if the key is known, false else
      */
-    bool setKeyLocked(Qt::Key key, bool locked);
+    virtual bool setKeyLocked(Qt::Key key, bool locked);
 
     /**
      * Check if a mouse button is pressed.
@@ -103,8 +106,6 @@
      */
     const QList<Qt::Key> knownKeys() const;
 
-    bool nativeEventFilter(const QByteArray &eventType, void *message, long 
int *result) override;
-
 Q_SIGNALS:
     void keyLatched(Qt::Key key, bool state);
     void keyLocked(Qt::Key key, bool state);
@@ -114,26 +115,16 @@
     void keyRemoved(Qt::Key key);
 
 protected:
-    void xkbUpdateModifierMapping();
-    void xkbModifierStateChanged(unsigned char mods, unsigned char 
latched_mods,
-                                 unsigned char locked_mods);
-    void xkbButtonStateChanged(unsigned short ptr_buttons);
+    void stateUpdated(Qt::Key key, KModifierKeyInfoProvider::ModifierStates 
state);
 
-private:
     // the state of each known modifier
     QHash<Qt::Key, ModifierStates> m_modifierStates;
+
     // the state of each known mouse button
     QHash<Qt::MouseButton, bool> m_buttonStates;
-
-    int m_xkbEv;
-    bool m_xkbAvailable;
-
-    // maps a Qt::Key to a modifier mask
-    QHash<Qt::Key, unsigned int> m_xkbModifiers;
-    // maps a Qt::MouseButton to a button mask
-    QHash<Qt::MouseButton, unsigned short> m_xkbButtons;
 };
 
+Q_DECLARE_INTERFACE(KModifierKeyInfoProvider, 
"org.kde.kguiaddons.KModifierKeyInfoProvider")
 Q_DECLARE_OPERATORS_FOR_FLAGS(KModifierKeyInfoProvider::ModifierStates)
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_x11.cpp 
new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_x11.cpp
--- old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_x11.cpp     
2019-06-01 18:37:53.000000000 +0200
+++ new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_x11.cpp     
1970-01-01 01:00:00.000000000 +0100
@@ -1,362 +0,0 @@
-/*
-    Copyright 2009  Michael Leupold <[email protected]>
-    Copyright 2013  Martin Gräßlin <[email protected]>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) version 3, or any
-    later version accepted by the membership of KDE e.V. (or its
-    successor approved by the membership of KDE e.V.), which shall
-    act as a proxy defined in Section 6 of version 3 of the license.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library.  If not, see 
<http://www.gnu.org/licenses/>.
-*/
-
-#include "kmodifierkeyinfo.h"
-#include "kmodifierkeyinfoprovider_p.h"
-
-#include <QGuiApplication>
-#include <QX11Info>
-
-#define XK_MISCELLANY
-#define XK_XKB_KEYS
-#include <X11/XKBlib.h>
-#include <X11/keysymdef.h>
-#include <xcb/xcb.h>
-
-struct ModifierDefinition {
-    ModifierDefinition(Qt::Key _key, unsigned int _mask, const char *_name, 
KeySym _keysym)
-    {
-        key = _key;
-        mask = _mask;
-        name = _name;
-        keysym = _keysym;
-    }
-    Qt::Key key;
-    unsigned int mask;
-    const char *name; // virtual modifier name
-    KeySym keysym;
-};
-
-/*
- * Get the real modifiers related to a virtual modifier.
- */
-unsigned int xkbVirtualModifier(XkbDescPtr xkb, const char *name)
-{
-    Q_ASSERT(xkb != nullptr);
-
-    unsigned int mask = 0;
-    bool nameEqual;
-    for (int i = 0; i < XkbNumVirtualMods; ++i) {
-        char *modStr = XGetAtomName(xkb->dpy, xkb->names->vmods[i]);
-        if (modStr != nullptr) {
-            nameEqual = (strcmp(name, modStr) == 0);
-            XFree(modStr);
-            if (nameEqual) {
-                XkbVirtualModsToReal(xkb, 1 << i, &mask);
-                break;
-            }
-        }
-    }
-    return mask;
-}
-
-KModifierKeyInfoProvider::KModifierKeyInfoProvider()
-    : QObject(nullptr)
-    , QAbstractNativeEventFilter()
-    , m_xkbEv(0)
-    , m_xkbAvailable(false)
-{
-    if (qApp) {
-        if (qApp->platformName() == QStringLiteral("xcb")) {
-            int code, xkberr, maj, min;
-            m_xkbAvailable = XkbQueryExtension(QX11Info::display(), &code, 
&m_xkbEv, &xkberr, &maj, &min);
-        }
-    }
-    if (m_xkbAvailable) {
-        XkbSelectEvents(QX11Info::display(), XkbUseCoreKbd,
-                        XkbStateNotifyMask | XkbMapNotifyMask,
-                        XkbStateNotifyMask | XkbMapNotifyMask);
-        unsigned long int stateMask = XkbModifierStateMask | 
XkbModifierBaseMask |
-                                      XkbModifierLatchMask | 
XkbModifierLockMask |
-                                      XkbPointerButtonMask;
-        XkbSelectEventDetails(QX11Info::display(), XkbUseCoreKbd, 
XkbStateNotifyMask,
-                              stateMask, stateMask);
-    }
-
-    xkbUpdateModifierMapping();
-
-    // add known pointer buttons
-    m_xkbButtons.insert(Qt::LeftButton, Button1Mask);
-    m_xkbButtons.insert(Qt::MidButton, Button2Mask);
-    m_xkbButtons.insert(Qt::RightButton, Button3Mask);
-    m_xkbButtons.insert(Qt::XButton1, Button4Mask);
-    m_xkbButtons.insert(Qt::XButton2, Button5Mask);
-
-    // get the initial state
-    if (m_xkbAvailable) {
-        XkbStateRec state;
-        XkbGetState(QX11Info::display(), XkbUseCoreKbd, &state);
-        xkbModifierStateChanged(state.mods, state.latched_mods, 
state.locked_mods);
-        xkbButtonStateChanged(state.ptr_buttons);
-
-        QCoreApplication::instance()->installNativeEventFilter(this);
-    }
-}
-
-KModifierKeyInfoProvider::~KModifierKeyInfoProvider()
-{
-    if (m_xkbAvailable) {
-        QCoreApplication::instance()->removeNativeEventFilter(this);
-    }
-}
-
-bool KModifierKeyInfoProvider::setKeyLatched(Qt::Key key, bool latched)
-{
-    if (!m_xkbModifiers.contains(key)) {
-        return false;
-    }
-
-    return XkbLatchModifiers(QX11Info::display(), XkbUseCoreKbd,
-                             m_xkbModifiers[key], latched ? 
m_xkbModifiers[key] : 0);
-}
-
-bool KModifierKeyInfoProvider::setKeyLocked(Qt::Key key, bool locked)
-{
-    if (!m_xkbModifiers.contains(key)) {
-        return false;
-    }
-
-    return XkbLockModifiers(QX11Info::display(), XkbUseCoreKbd,
-                            m_xkbModifiers[key], locked ? m_xkbModifiers[key] 
: 0);
-}
-
-// HACK: xcb-xkb is not yet a public part of xcb. Because of that we have to 
include the event structure.
-namespace
-{
-typedef struct _xcb_xkb_map_notify_event_t {
-    uint8_t         response_type;
-    uint8_t         xkbType;
-    uint16_t        sequence;
-    xcb_timestamp_t time;
-    uint8_t         deviceID;
-    uint8_t         ptrBtnActions;
-    uint16_t        changed;
-    xcb_keycode_t   minKeyCode;
-    xcb_keycode_t   maxKeyCode;
-    uint8_t         firstType;
-    uint8_t         nTypes;
-    xcb_keycode_t   firstKeySym;
-    uint8_t         nKeySyms;
-    xcb_keycode_t   firstKeyAct;
-    uint8_t         nKeyActs;
-    xcb_keycode_t   firstKeyBehavior;
-    uint8_t         nKeyBehavior;
-    xcb_keycode_t   firstKeyExplicit;
-    uint8_t         nKeyExplicit;
-    xcb_keycode_t   firstModMapKey;
-    uint8_t         nModMapKeys;
-    xcb_keycode_t   firstVModMapKey;
-    uint8_t         nVModMapKeys;
-    uint16_t        virtualMods;
-    uint8_t         pad0[2];
-} _xcb_xkb_map_notify_event_t;
-typedef struct _xcb_xkb_state_notify_event_t {
-    uint8_t         response_type;
-    uint8_t         xkbType;
-    uint16_t        sequence;
-    xcb_timestamp_t time;
-    uint8_t         deviceID;
-    uint8_t         mods;
-    uint8_t         baseMods;
-    uint8_t         latchedMods;
-    uint8_t         lockedMods;
-    uint8_t         group;
-    int16_t         baseGroup;
-    int16_t         latchedGroup;
-    uint8_t         lockedGroup;
-    uint8_t         compatState;
-    uint8_t         grabMods;
-    uint8_t         compatGrabMods;
-    uint8_t         lookupMods;
-    uint8_t         compatLoockupMods;
-    uint16_t        ptrBtnState;
-    uint16_t        changed;
-    xcb_keycode_t   keycode;
-    uint8_t         eventType;
-    uint8_t         requestMajor;
-    uint8_t         requestMinor;
-} _xcb_xkb_state_notify_event_t;
-typedef union {
-    /* All XKB events share these fields. */
-    struct {
-        uint8_t response_type;
-        uint8_t xkbType;
-        uint16_t sequence;
-        xcb_timestamp_t time;
-        uint8_t deviceID;
-    } any;
-    _xcb_xkb_map_notify_event_t map_notify;
-    _xcb_xkb_state_notify_event_t state_notify;
-} _xkb_event;
-}
-
-bool KModifierKeyInfoProvider::nativeEventFilter(const QByteArray &eventType, 
void *message, long int *result)
-{
-    Q_UNUSED(result)
-    if (!m_xkbAvailable || eventType != "xcb_generic_event_t") {
-        return false;
-    }
-    xcb_generic_event_t *event = static_cast<xcb_generic_event_t *>(message);
-    if ((event->response_type & ~0x80) == m_xkbEv + XkbEventCode) {
-        _xkb_event *kbevt = reinterpret_cast<_xkb_event *>(event);
-        unsigned int stateMask = XkbModifierStateMask | XkbModifierBaseMask |
-                                 XkbModifierLatchMask | XkbModifierLockMask;
-        if (kbevt->any.xkbType == XkbMapNotify) {
-            xkbUpdateModifierMapping();
-        } else if (kbevt->any.xkbType == XkbStateNotify) {
-            if (kbevt->state_notify.changed & stateMask) {
-                xkbModifierStateChanged(kbevt->state_notify.mods, 
kbevt->state_notify.latchedMods,
-                                        kbevt->state_notify.lockedMods);
-            } else if (kbevt->state_notify.changed & XkbPointerButtonMask) {
-                xkbButtonStateChanged(kbevt->state_notify.ptrBtnState);
-            }
-        }
-    }
-    return false;
-}
-
-void KModifierKeyInfoProvider::xkbModifierStateChanged(unsigned char mods,
-        unsigned char latched_mods,
-        unsigned char locked_mods)
-{
-    // detect keyboard modifiers
-    ModifierStates oldState;
-    ModifierStates newState;
-
-    QHash<Qt::Key, unsigned int>::const_iterator it;
-    QHash<Qt::Key, unsigned int>::const_iterator end = 
m_xkbModifiers.constEnd();
-    for (it = m_xkbModifiers.constBegin(); it != end; ++it) {
-        if (!m_modifierStates.contains(it.key())) {
-            continue;
-        }
-        newState = Nothing;
-        oldState = m_modifierStates[it.key()];
-
-        // determine the new state
-        if (mods & it.value()) {
-            newState |= Pressed;
-        }
-        if (latched_mods & it.value()) {
-            newState |= Latched;
-        }
-        if (locked_mods & it.value()) {
-            newState |= Locked;
-        }
-
-        if (newState != oldState) {
-            m_modifierStates[it.key()] = newState;
-
-            if ((newState ^ oldState) & Pressed) {
-                emit keyPressed(it.key(), newState & Pressed);
-            }
-            if ((newState ^ oldState) & Latched) {
-                emit keyLatched(it.key(), newState & Latched);
-            }
-            if ((newState ^ oldState) & Locked) {
-                emit keyLocked(it.key(), newState & Locked);
-            }
-        }
-    }
-}
-
-void KModifierKeyInfoProvider::xkbButtonStateChanged(unsigned short 
ptr_buttons)
-{
-    // detect mouse button states
-    bool newButtonState;
-
-    QHash<Qt::MouseButton, unsigned short>::const_iterator it;
-    QHash<Qt::MouseButton, unsigned short>::const_iterator end = 
m_xkbButtons.constEnd();
-    for (it = m_xkbButtons.constBegin(); it != end; ++it) {
-        newButtonState = (ptr_buttons & it.value());
-        if (newButtonState != m_buttonStates[it.key()]) {
-            m_buttonStates[it.key()] = newButtonState;
-            emit buttonPressed(it.key(), newButtonState);
-        }
-    }
-}
-
-void KModifierKeyInfoProvider::xkbUpdateModifierMapping()
-{
-    if (!m_xkbAvailable) {
-        return;
-    }
-    m_xkbModifiers.clear();
-
-    QList<ModifierDefinition> srcModifiers;
-    srcModifiers << ModifierDefinition(Qt::Key_Shift, ShiftMask, nullptr, 0)
-                 << ModifierDefinition(Qt::Key_Control, ControlMask, nullptr, 
0)
-                 << ModifierDefinition(Qt::Key_Alt, 0, "Alt", XK_Alt_L)
-                 // << { 0, 0, I18N_NOOP("Win"), "superkey", "" }
-                 << ModifierDefinition(Qt::Key_Meta, 0, "Meta", XK_Meta_L)
-                 << ModifierDefinition(Qt::Key_Super_L, 0, "Super", XK_Super_L)
-                 << ModifierDefinition(Qt::Key_Hyper_L, 0, "Hyper", XK_Hyper_L)
-                 << ModifierDefinition(Qt::Key_AltGr, 0, "AltGr", 0)
-                 << ModifierDefinition(Qt::Key_NumLock, 0, "NumLock", 
XK_Num_Lock)
-                 << ModifierDefinition(Qt::Key_CapsLock, LockMask, nullptr, 0)
-                 << ModifierDefinition(Qt::Key_ScrollLock, 0, "ScrollLock", 
XK_Scroll_Lock);
-
-    XkbDescPtr xkb = XkbGetKeyboard(QX11Info::display(), XkbAllComponentsMask, 
XkbUseCoreKbd);
-
-    QList<ModifierDefinition>::const_iterator it;
-    QList<ModifierDefinition>::const_iterator end = srcModifiers.constEnd();
-    for (it = srcModifiers.constBegin(); it != end; ++it) {
-        unsigned int mask = it->mask;
-        if (mask == 0 && xkb != nullptr) {
-            // try virtual modifier first
-            if (it->name != nullptr) {
-                mask = xkbVirtualModifier(xkb, it->name);
-            }
-            if (mask == 0 && it->keysym != 0) {
-                mask = XkbKeysymToModifiers(QX11Info::display(), it->keysym);
-            } else if (mask == 0) {
-                // special case for AltGr
-                mask = XkbKeysymToModifiers(QX11Info::display(), 
XK_Mode_switch) |
-                       XkbKeysymToModifiers(QX11Info::display(), 
XK_ISO_Level3_Shift) |
-                       XkbKeysymToModifiers(QX11Info::display(), 
XK_ISO_Level3_Latch) |
-                       XkbKeysymToModifiers(QX11Info::display(), 
XK_ISO_Level3_Lock);
-            }
-        }
-
-        if (mask != 0) {
-            m_xkbModifiers.insert(it->key, mask);
-            // previously unknown modifier
-            if (!m_modifierStates.contains(it->key)) {
-                m_modifierStates.insert(it->key, Nothing);
-                emit keyAdded(it->key);
-            }
-        }
-    }
-
-    // remove modifiers which are no longer available
-    QMutableHashIterator<Qt::Key, ModifierStates> i(m_modifierStates);
-    while (i.hasNext()) {
-        i.next();
-        if (!m_xkbModifiers.contains(i.key())) {
-            Qt::Key key = i.key();
-            i.remove();
-            emit keyRemoved(key);
-        }
-    }
-
-    if (xkb != nullptr) {
-        XkbFreeKeyboard(xkb, 0, true);
-    }
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_xcb.cpp 
new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_xcb.cpp
--- old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_xcb.cpp     
1970-01-01 01:00:00.000000000 +0100
+++ new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_xcb.cpp     
2019-07-08 01:31:37.000000000 +0200
@@ -0,0 +1,347 @@
+/*
+    Copyright 2009  Michael Leupold <[email protected]>
+    Copyright 2013  Martin Gräßlin <[email protected]>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) version 3, or any
+    later version accepted by the membership of KDE e.V. (or its
+    successor approved by the membership of KDE e.V.), which shall
+    act as a proxy defined in Section 6 of version 3 of the license.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library.  If not, see 
<http://www.gnu.org/licenses/>.
+*/
+
+#include "kmodifierkeyinfo.h"
+#include "kmodifierkeyinfoprovider_xcb.h"
+
+#include <QGuiApplication>
+#include <QX11Info>
+
+#define XK_MISCELLANY
+#define XK_XKB_KEYS
+#include <X11/XKBlib.h>
+#include <X11/keysymdef.h>
+#include <xcb/xcb.h>
+
+struct ModifierDefinition {
+    ModifierDefinition(Qt::Key _key, unsigned int _mask, const char *_name, 
KeySym _keysym)
+    {
+        key = _key;
+        mask = _mask;
+        name = _name;
+        keysym = _keysym;
+    }
+    Qt::Key key;
+    unsigned int mask;
+    const char *name; // virtual modifier name
+    KeySym keysym;
+};
+
+/*
+ * Get the real modifiers related to a virtual modifier.
+ */
+unsigned int xkbVirtualModifier(XkbDescPtr xkb, const char *name)
+{
+    Q_ASSERT(xkb != nullptr);
+
+    unsigned int mask = 0;
+    bool nameEqual;
+    for (int i = 0; i < XkbNumVirtualMods; ++i) {
+        char *modStr = XGetAtomName(xkb->dpy, xkb->names->vmods[i]);
+        if (modStr != nullptr) {
+            nameEqual = (strcmp(name, modStr) == 0);
+            XFree(modStr);
+            if (nameEqual) {
+                XkbVirtualModsToReal(xkb, 1 << i, &mask);
+                    break;
+            }
+        }
+    }
+    return mask;
+}
+
+KModifierKeyInfoProviderXcb::KModifierKeyInfoProviderXcb()
+    : KModifierKeyInfoProvider()
+    , m_xkbEv(0)
+    , m_xkbAvailable(false)
+{
+    if (qApp) {
+        if (qApp->platformName() == QStringLiteral("xcb")) {
+            int code, xkberr, maj, min;
+            m_xkbAvailable = XkbQueryExtension(QX11Info::display(), &code, 
&m_xkbEv, &xkberr, &maj, &min);
+        }
+    }
+    if (m_xkbAvailable) {
+        XkbSelectEvents(QX11Info::display(), XkbUseCoreKbd,
+                        XkbStateNotifyMask | XkbMapNotifyMask,
+                        XkbStateNotifyMask | XkbMapNotifyMask);
+        unsigned long int stateMask = XkbModifierStateMask | 
XkbModifierBaseMask |
+                                      XkbModifierLatchMask | 
XkbModifierLockMask |
+                                      XkbPointerButtonMask;
+        XkbSelectEventDetails(QX11Info::display(), XkbUseCoreKbd, 
XkbStateNotifyMask,
+                              stateMask, stateMask);
+    }
+
+    xkbUpdateModifierMapping();
+
+    // add known pointer buttons
+    m_xkbButtons.insert(Qt::LeftButton, Button1Mask);
+    m_xkbButtons.insert(Qt::MidButton, Button2Mask);
+    m_xkbButtons.insert(Qt::RightButton, Button3Mask);
+    m_xkbButtons.insert(Qt::XButton1, Button4Mask);
+    m_xkbButtons.insert(Qt::XButton2, Button5Mask);
+
+    // get the initial state
+    if (m_xkbAvailable) {
+        XkbStateRec state;
+        XkbGetState(QX11Info::display(), XkbUseCoreKbd, &state);
+        xkbModifierStateChanged(state.mods, state.latched_mods, 
state.locked_mods);
+        xkbButtonStateChanged(state.ptr_buttons);
+
+        QCoreApplication::instance()->installNativeEventFilter(this);
+    }
+}
+
+KModifierKeyInfoProviderXcb::~KModifierKeyInfoProviderXcb()
+{
+    if (m_xkbAvailable) {
+        QCoreApplication::instance()->removeNativeEventFilter(this);
+    }
+}
+
+bool KModifierKeyInfoProviderXcb::setKeyLatched(Qt::Key key, bool latched)
+{
+    if (!m_xkbModifiers.contains(key)) {
+        return false;
+    }
+
+    return XkbLatchModifiers(QX11Info::display(), XkbUseCoreKbd,
+                             m_xkbModifiers[key], latched ? 
m_xkbModifiers[key] : 0);
+}
+
+bool KModifierKeyInfoProviderXcb::setKeyLocked(Qt::Key key, bool locked)
+{
+    if (!m_xkbModifiers.contains(key)) {
+        return false;
+    }
+
+    return XkbLockModifiers(QX11Info::display(), XkbUseCoreKbd,
+                            m_xkbModifiers[key], locked ? m_xkbModifiers[key] 
: 0);
+}
+
+// HACK: xcb-xkb is not yet a public part of xcb. Because of that we have to 
include the event structure.
+namespace
+{
+typedef struct _xcb_xkb_map_notify_event_t {
+    uint8_t         response_type;
+    uint8_t         xkbType;
+    uint16_t        sequence;
+    xcb_timestamp_t time;
+    uint8_t         deviceID;
+    uint8_t         ptrBtnActions;
+    uint16_t        changed;
+    xcb_keycode_t   minKeyCode;
+    xcb_keycode_t   maxKeyCode;
+    uint8_t         firstType;
+    uint8_t         nTypes;
+    xcb_keycode_t   firstKeySym;
+    uint8_t         nKeySyms;
+    xcb_keycode_t   firstKeyAct;
+    uint8_t         nKeyActs;
+    xcb_keycode_t   firstKeyBehavior;
+    uint8_t         nKeyBehavior;
+    xcb_keycode_t   firstKeyExplicit;
+    uint8_t         nKeyExplicit;
+    xcb_keycode_t   firstModMapKey;
+    uint8_t         nModMapKeys;
+    xcb_keycode_t   firstVModMapKey;
+    uint8_t         nVModMapKeys;
+    uint16_t        virtualMods;
+    uint8_t         pad0[2];
+} _xcb_xkb_map_notify_event_t;
+typedef struct _xcb_xkb_state_notify_event_t {
+    uint8_t         response_type;
+    uint8_t         xkbType;
+    uint16_t        sequence;
+    xcb_timestamp_t time;
+    uint8_t         deviceID;
+    uint8_t         mods;
+    uint8_t         baseMods;
+    uint8_t         latchedMods;
+    uint8_t         lockedMods;
+    uint8_t         group;
+    int16_t         baseGroup;
+    int16_t         latchedGroup;
+    uint8_t         lockedGroup;
+    uint8_t         compatState;
+    uint8_t         grabMods;
+    uint8_t         compatGrabMods;
+    uint8_t         lookupMods;
+    uint8_t         compatLoockupMods;
+    uint16_t        ptrBtnState;
+    uint16_t        changed;
+    xcb_keycode_t   keycode;
+    uint8_t         eventType;
+    uint8_t         requestMajor;
+    uint8_t         requestMinor;
+} _xcb_xkb_state_notify_event_t;
+typedef union {
+    /* All XKB events share these fields. */
+    struct {
+        uint8_t response_type;
+        uint8_t xkbType;
+        uint16_t sequence;
+        xcb_timestamp_t time;
+        uint8_t deviceID;
+    } any;
+    _xcb_xkb_map_notify_event_t map_notify;
+    _xcb_xkb_state_notify_event_t state_notify;
+} _xkb_event;
+}
+
+bool KModifierKeyInfoProviderXcb::nativeEventFilter(const QByteArray 
&eventType, void *message, long int *result)
+{
+    Q_UNUSED(result)
+    if (!m_xkbAvailable || eventType != "xcb_generic_event_t") {
+        return false;
+    }
+    xcb_generic_event_t *event = static_cast<xcb_generic_event_t *>(message);
+    if ((event->response_type & ~0x80) == m_xkbEv + XkbEventCode) {
+        _xkb_event *kbevt = reinterpret_cast<_xkb_event *>(event);
+        unsigned int stateMask = XkbModifierStateMask | XkbModifierBaseMask |
+                                 XkbModifierLatchMask | XkbModifierLockMask;
+        if (kbevt->any.xkbType == XkbMapNotify) {
+            xkbUpdateModifierMapping();
+        } else if (kbevt->any.xkbType == XkbStateNotify) {
+            if (kbevt->state_notify.changed & stateMask) {
+                xkbModifierStateChanged(kbevt->state_notify.mods, 
kbevt->state_notify.latchedMods,
+                                        kbevt->state_notify.lockedMods);
+            } else if (kbevt->state_notify.changed & XkbPointerButtonMask) {
+                xkbButtonStateChanged(kbevt->state_notify.ptrBtnState);
+            }
+        }
+    }
+    return false;
+}
+
+void KModifierKeyInfoProviderXcb::xkbModifierStateChanged(unsigned char mods,
+        unsigned char latched_mods,
+        unsigned char locked_mods)
+{
+    // detect keyboard modifiers
+    ModifierStates newState;
+
+    QHash<Qt::Key, unsigned int>::const_iterator it;
+    QHash<Qt::Key, unsigned int>::const_iterator end = 
m_xkbModifiers.constEnd();
+    for (it = m_xkbModifiers.constBegin(); it != end; ++it) {
+        if (!m_modifierStates.contains(it.key())) {
+            continue;
+        }
+        newState = Nothing;
+
+        // determine the new state
+        if (mods & it.value()) {
+            newState |= Pressed;
+        }
+        if (latched_mods & it.value()) {
+            newState |= Latched;
+        }
+        if (locked_mods & it.value()) {
+            newState |= Locked;
+        }
+
+        stateUpdated(it.key(), newState);
+    }
+}
+
+void KModifierKeyInfoProviderXcb::xkbButtonStateChanged(unsigned short 
ptr_buttons)
+{
+    // detect mouse button states
+    bool newButtonState;
+
+    QHash<Qt::MouseButton, unsigned short>::const_iterator it;
+    QHash<Qt::MouseButton, unsigned short>::const_iterator end = 
m_xkbButtons.constEnd();
+    for (it = m_xkbButtons.constBegin(); it != end; ++it) {
+        newButtonState = (ptr_buttons & it.value());
+        if (newButtonState != m_buttonStates[it.key()]) {
+            m_buttonStates[it.key()] = newButtonState;
+            emit buttonPressed(it.key(), newButtonState);
+        }
+    }
+}
+
+void KModifierKeyInfoProviderXcb::xkbUpdateModifierMapping()
+{
+    if (!m_xkbAvailable) {
+        return;
+    }
+    m_xkbModifiers.clear();
+
+    QList<ModifierDefinition> srcModifiers;
+    srcModifiers << ModifierDefinition(Qt::Key_Shift, ShiftMask, nullptr, 0)
+                 << ModifierDefinition(Qt::Key_Control, ControlMask, nullptr, 
0)
+                 << ModifierDefinition(Qt::Key_Alt, 0, "Alt", XK_Alt_L)
+                 // << { 0, 0, I18N_NOOP("Win"), "superkey", "" }
+                 << ModifierDefinition(Qt::Key_Meta, 0, "Meta", XK_Meta_L)
+                 << ModifierDefinition(Qt::Key_Super_L, 0, "Super", XK_Super_L)
+                 << ModifierDefinition(Qt::Key_Hyper_L, 0, "Hyper", XK_Hyper_L)
+                 << ModifierDefinition(Qt::Key_AltGr, 0, "AltGr", 0)
+                 << ModifierDefinition(Qt::Key_NumLock, 0, "NumLock", 
XK_Num_Lock)
+                 << ModifierDefinition(Qt::Key_CapsLock, LockMask, nullptr, 0)
+                 << ModifierDefinition(Qt::Key_ScrollLock, 0, "ScrollLock", 
XK_Scroll_Lock);
+
+    XkbDescPtr xkb = XkbGetKeyboard(QX11Info::display(), XkbAllComponentsMask, 
XkbUseCoreKbd);
+
+    QList<ModifierDefinition>::const_iterator it;
+    QList<ModifierDefinition>::const_iterator end = srcModifiers.constEnd();
+    for (it = srcModifiers.constBegin(); it != end; ++it) {
+        unsigned int mask = it->mask;
+        if (mask == 0 && xkb != nullptr) {
+            // try virtual modifier first
+            if (it->name != nullptr) {
+                mask = xkbVirtualModifier(xkb, it->name);
+            }
+            if (mask == 0 && it->keysym != 0) {
+                mask = XkbKeysymToModifiers(QX11Info::display(), it->keysym);
+            } else if (mask == 0) {
+                // special case for AltGr
+                mask = XkbKeysymToModifiers(QX11Info::display(), 
XK_Mode_switch) |
+                       XkbKeysymToModifiers(QX11Info::display(), 
XK_ISO_Level3_Shift) |
+                       XkbKeysymToModifiers(QX11Info::display(), 
XK_ISO_Level3_Latch) |
+                       XkbKeysymToModifiers(QX11Info::display(), 
XK_ISO_Level3_Lock);
+            }
+        }
+
+        if (mask != 0) {
+            m_xkbModifiers.insert(it->key, mask);
+            // previously unknown modifier
+            if (!m_modifierStates.contains(it->key)) {
+                m_modifierStates.insert(it->key, Nothing);
+                emit keyAdded(it->key);
+            }
+        }
+    }
+
+    // remove modifiers which are no longer available
+    QMutableHashIterator<Qt::Key, ModifierStates> i(m_modifierStates);
+    while (i.hasNext()) {
+        i.next();
+        if (!m_xkbModifiers.contains(i.key())) {
+            Qt::Key key = i.key();
+            i.remove();
+            emit keyRemoved(key);
+        }
+    }
+
+    if (xkb != nullptr) {
+        XkbFreeKeyboard(xkb, 0, true);
+    }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_xcb.h 
new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_xcb.h
--- old/kguiaddons-5.59.0/src/util/kmodifierkeyinfoprovider_xcb.h       
1970-01-01 01:00:00.000000000 +0100
+++ new/kguiaddons-5.60.0/src/util/kmodifierkeyinfoprovider_xcb.h       
2019-07-08 01:31:37.000000000 +0200
@@ -0,0 +1,55 @@
+/*
+    Copyright 2009  Michael Leupold <[email protected]>
+    Copyright 2013  Martin Gräßlin <[email protected]>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) version 3, or any
+    later version accepted by the membership of KDE e.V. (or its
+    successor approved by the membership of KDE e.V.), which shall
+    act as a proxy defined in Section 6 of version 3 of the license.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library.  If not, see 
<http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KMODIFIERKEYINFOPROVIDERXCB_H
+#define KMODIFIERKEYINFOPROVIDERXCB_H
+
+#include "kmodifierkeyinfoprovider_p.h"
+
+class KModifierKeyInfoProviderXcb : public KModifierKeyInfoProvider, public 
QAbstractNativeEventFilter
+{
+Q_OBJECT
+Q_PLUGIN_METADATA(IID "org.kde.kguiaddons.KModifierKeyInfoProvider.XCB")
+public:
+    KModifierKeyInfoProviderXcb();
+    ~KModifierKeyInfoProviderXcb();
+
+    bool setKeyLatched(Qt::Key key, bool latched) override;
+    bool setKeyLocked(Qt::Key key, bool locked) override;
+
+    bool nativeEventFilter(const QByteArray &eventType, void *message, long 
int *result) override;
+
+    void xkbUpdateModifierMapping();
+    void xkbModifierStateChanged(unsigned char mods, unsigned char 
latched_mods,
+                                 unsigned char locked_mods);
+    void xkbButtonStateChanged(unsigned short ptr_buttons);
+
+private:
+    int m_xkbEv;
+    bool m_xkbAvailable;
+
+    // maps a Qt::Key to a modifier mask
+    QHash<Qt::Key, unsigned int> m_xkbModifiers;
+    // maps a Qt::MouseButton to a button mask
+    QHash<Qt::MouseButton, unsigned short> m_xkbButtons;
+};
+
+#endif


Reply via email to