x11: trigger shortcuts when releasing rather than pressing

This way we can issue a keyboard grab without problems
This commit is contained in:
Aleix Pol 2022-04-12 02:31:16 +02:00 committed by Aleix Pol Gonzalez
parent 1f443301ed
commit 9a31b0d727

View file

@ -40,6 +40,7 @@
#include <KConfigGroup> #include <KConfigGroup>
#include <KCrash> #include <KCrash>
#include <KGlobalAccel>
#include <KLocalizedString> #include <KLocalizedString>
#include <QOpenGLContext> #include <QOpenGLContext>
@ -368,7 +369,10 @@ void X11StandalonePlatform::startInteractivePositionSelection(std::function<void
void X11StandalonePlatform::setupActionForGlobalAccel(QAction *action) void X11StandalonePlatform::setupActionForGlobalAccel(QAction *action)
{ {
connect(action, &QAction::triggered, kwinApp(), [action] { connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutActiveChanged, kwinApp(), [action](QAction *triggeredAction, bool active) {
if (triggeredAction != action)
return;
QVariant timestamp = action->property("org.kde.kglobalaccel.activationTimestamp"); QVariant timestamp = action->property("org.kde.kglobalaccel.activationTimestamp");
bool ok = false; bool ok = false;
const quint32 t = timestamp.toULongLong(&ok); const quint32 t = timestamp.toULongLong(&ok);