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

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 
0013 #include <QObject>
0014 
0015 class QTimer;
0016 
0017 namespace KWin
0018 {
0019 class Xkb;
0020 
0021 class KeyboardRepeat : public QObject, public InputEventSpy
0022 {
0023     Q_OBJECT
0024 public:
0025     explicit KeyboardRepeat(Xkb *xkb);
0026     ~KeyboardRepeat() override;
0027 
0028     void keyEvent(KeyEvent *event) override;
0029 
0030 Q_SIGNALS:
0031     void keyRepeat(quint32 key, std::chrono::microseconds time);
0032 
0033 private:
0034     void handleKeyRepeat();
0035     QTimer *m_timer;
0036     Xkb *m_xkb;
0037     std::chrono::microseconds m_time;
0038     quint32 m_key = 0;
0039 };
0040 
0041 }