swift
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"
13 #include "input/swiftinputexport.h"
14 #include "misc/input/keyboardkey.h"
16 #ifndef NOMINMAX
17 # define NOMINMAX
18 #endif
19 #include <Windows.h>
20 
21 namespace swift::input
22 {
25  {
26  Q_OBJECT
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 
46  CKeyboardWindows(QObject *parent = nullptr);
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
Windows implemenation of IKeyboard using hook procedure.
CKeyboardWindows & operator=(CKeyboardWindows const &)=delete
Assignment operator.
CKeyboardWindows(CKeyboardWindows const &)=delete
Copy Constructor.
Abstract interface for native keyboard handling.
Definition: keyboard.h:23
Value object representing hotkey sequence.
unsigned long DWORD
Fake Windows DWORD.
#define SWIFT_INPUT_EXPORT
Export a class or function from the library.