|
|
|
|
@ -22,7 +22,8 @@ |
|
|
|
|
|
|
|
|
|
#include <QDebug> |
|
|
|
|
#include <QProcess> |
|
|
|
|
|
|
|
|
|
#include <QVersionNumber> |
|
|
|
|
#include <QTimer> |
|
|
|
|
|
|
|
|
|
#include <QDBusConnection> |
|
|
|
|
#include <QDBusConnectionInterface> |
|
|
|
|
@ -163,9 +164,30 @@ void SystemTray::showPlasmoidMenu(QQuickItem *appletInterface, int x, int y) |
|
|
|
|
connect(this, &QObject::destroyed, desktopMenu, &QMenu::close); |
|
|
|
|
desktopMenu->setAttribute(Qt::WA_DeleteOnClose); |
|
|
|
|
|
|
|
|
|
if (appletInterface->window() && appletInterface->window()->mouseGrabberItem()) { |
|
|
|
|
appletInterface->window()->mouseGrabberItem()->ungrabMouse(); |
|
|
|
|
//this is a workaround where Qt will fail to realise a mouse has been released
|
|
|
|
|
|
|
|
|
|
// this happens if a window which does not accept focus spawns a new window that takes focus and X grab
|
|
|
|
|
// whilst the mouse is depressed
|
|
|
|
|
// https://bugreports.qt.io/browse/QTBUG-59044
|
|
|
|
|
// this causes the next click to go missing
|
|
|
|
|
|
|
|
|
|
//by releasing manually we avoid that situation
|
|
|
|
|
auto ungrabMouseHack = [appletInterface]() { |
|
|
|
|
if (appletInterface->window() && appletInterface->window()->mouseGrabberItem()) { |
|
|
|
|
appletInterface->window()->mouseGrabberItem()->ungrabMouse(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//pre 5.8.0 QQuickWindow code is "item->grabMouse(); sendEvent(item, mouseEvent)"
|
|
|
|
|
//post 5.8.0 QQuickWindow code is sendEvent(item, mouseEvent); item->grabMouse()
|
|
|
|
|
if (QVersionNumber::fromString(qVersion()) > QVersionNumber(5, 8, 0)) { |
|
|
|
|
QTimer::singleShot(0, appletInterface, ungrabMouseHack); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
ungrabMouseHack(); |
|
|
|
|
} |
|
|
|
|
//end workaround
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
emit applet->contextualActionsAboutToShow(); |
|
|
|
|
foreach (QAction *action, applet->contextualActions()) { |
|
|
|
|
|