File indexing completed on 2024-04-28 05:30:24

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2016, 2017 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include "input_event_spy.h"
0012 #include <kwin_export.h>
0013 
0014 #include <QObject>
0015 #include <QSet>
0016 
0017 namespace KWin
0018 {
0019 
0020 class KWIN_EXPORT ModifierOnlyShortcuts : public QObject, public InputEventSpy
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit ModifierOnlyShortcuts();
0025     ~ModifierOnlyShortcuts() override;
0026 
0027     void keyEvent(KeyEvent *event) override;
0028     void pointerEvent(MouseEvent *event) override;
0029     void wheelEvent(WheelEvent *event) override;
0030 
0031     void reset()
0032     {
0033         m_modifier = Qt::NoModifier;
0034     }
0035 
0036 private:
0037     Qt::KeyboardModifier m_modifier = Qt::NoModifier;
0038     Qt::KeyboardModifiers m_cachedMods;
0039     Qt::MouseButtons m_pressedButtons;
0040     QSet<quint32> m_pressedKeys;
0041 };
0042 
0043 }