From 8453224119a4c5ff7d47d9cd4924d0b1ccb99b3a Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 25 Nov 2017 18:00:06 +0000 Subject: copy 1.2 branch to trunk git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7772 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/hotkey/hotkeymanager_x11.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/plugins/General/hotkey/hotkeymanager_x11.cpp') diff --git a/src/plugins/General/hotkey/hotkeymanager_x11.cpp b/src/plugins/General/hotkey/hotkeymanager_x11.cpp index 3954eebb3..05b46280a 100644 --- a/src/plugins/General/hotkey/hotkeymanager_x11.cpp +++ b/src/plugins/General/hotkey/hotkeymanager_x11.cpp @@ -21,7 +21,7 @@ ***************************************************************************/ #include -#ifdef Q_WS_X11 +#ifdef QMMP_WS_X11 #include #include #include @@ -80,6 +80,12 @@ quint32 Hotkey::defaultKey(int act) HotkeyManager::HotkeyManager(QObject *parent) : QObject(parent) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) + //Workaround Qt regression of no longer delivering events for the root window + //See qtbase commit 2b34aefcf02f09253473b096eb4faffd3e62b5f4 + //More information: https://bugs.kde.org/show_bug.cgi?id=360841 + qApp->desktop()->winId(); +#endif QCoreApplication::instance()->installEventFilter(this); WId rootWindow = QX11Info::appRootWindow(); QSettings settings(Qmmp::configFile(), QSettings::IniFormat); //load settings @@ -138,8 +144,7 @@ const QString HotkeyManager::getKeyString(quint32 key, quint32 modifiers) bool HotkeyManager::eventFilter(QObject* o, QEvent* e) { - //receive events from active and root windows only - if (e->type() == QEvent::KeyPress && (o == qApp->desktop () || o == qApp->activeWindow ())) + if (e->type() == QEvent::KeyPress) { QKeyEvent* k = static_cast(e); quint32 key = keycodeToKeysym(k->nativeScanCode()); @@ -198,7 +203,7 @@ bool HotkeyManager::eventFilter(QObject* o, QEvent* e) break; } - qApp->processEvents(); + return true; } } return QObject::eventFilter(o, e); -- cgit v1.2.3-13-gbd6f