swift
Loading...
Searching...
No Matches
keyboardwindows.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_INPUT_KEYBOARD_WINDOWS_H
7#define SWIFT_INPUT_KEYBOARD_WINDOWS_H
8
9#include <QHash>
10#include <QTimer>
11
12#include "input/keyboard.h"
16#ifndef NOMINMAX
17# define NOMINMAX
18#endif
19#include <Windows.h>
20
21namespace swift::input
22{
24 class SWIFT_INPUT_EXPORT CKeyboardWindows : public IKeyboard
25 {
27
28 public:
31
34
36 virtual ~CKeyboardWindows() override;
37
38 protected:
40 virtual bool init() override;
41
42 private:
43 friend class IKeyboard;
44
47
48 void addKey(WPARAM vkcode);
49 void removeKey(WPARAM vkcode);
50 void processKeyEvent(DWORD vkCode, WPARAM event);
51 void pollKeyboardState();
52
53 const bool useWindowsHook = false;
54
56 static LRESULT CALLBACK keyboardProc(int nCode, WPARAM wParam, LPARAM lParam);
57
59 HHOOK m_keyboardHook;
60 QTimer m_pollTimer;
61 QVector<int> m_pressedKeys;
62 };
63} // namespace swift::input
64
65#endif // SWIFT_INPUT_KEYBOARD_WINDOWS_H
virtual bool init()
Initializes the platform keyboard device.
CKeyboardWindows(CKeyboardWindows const &)=delete
Copy Constructor.
CKeyboardWindows & operator=(CKeyboardWindows const &)=delete
Assignment operator.
Value object representing hotkey sequence.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
virtual bool event(QEvent *e)
QObject * parent() const const
unsigned long DWORD
Fake Windows DWORD.
#define SWIFT_INPUT_EXPORT
Export a class or function from the library.