RhythmGame 1.4.3
Loading...
Searching...
No Matches
CustomNotifyApp.h
Go to the documentation of this file.
1//
2// Created by PC on 16/06/2025.
3//
4
5#ifndef CUSTOMNOTIFYAPP_H
6#define CUSTOMNOTIFYAPP_H
7#include "InputTranslator.h"
8
9#include <QGuiApplication>
10
11#ifdef _WIN32
12#ifndef WIN32_LEAN_AND_MEAN
13#define WIN32_LEAN_AND_MEAN
14#endif
15#include <windows.h>
16#include <unordered_set>
17#endif
18
19namespace input {
20
21class CustomNotifyApp final : public QGuiApplication
22{
23 Q_OBJECT
24 using QGuiApplication::QGuiApplication;
25 InputTranslator* inputTranslator = nullptr;
26
27#ifdef _WIN32
28 HHOOK m_keyboardHook = nullptr;
29 // Tracks currently-pressed scan codes to filter out OS auto-repeat
30 // messages before they reach handleKeyEvent.
31 std::unordered_set<quint32> m_pressedScanCodes;
32
33 static CustomNotifyApp* s_instance;
34 static LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
35 WPARAM wParam,
36 LPARAM lParam);
37 void installHook();
38 void removeHook();
39#endif
40
41 public:
42 ~CustomNotifyApp() override;
43 void setInputTranslator(InputTranslator* translator);
44 static auto shouldTranslateKeyboardEvent(bool isKeyDown,
45 Qt::ApplicationState state,
46 bool hasFocusWindow,
47 bool textInputActive,
48 bool foregroundOwned) -> bool;
49 auto notify(QObject* receiver, QEvent* event) -> bool override;
50};
51
52} // input
53
54#endif // CUSTOMNOTIFYAPP_H
Definition CustomNotifyApp.h:22
static auto shouldTranslateKeyboardEvent(bool isKeyDown, Qt::ApplicationState state, bool hasFocusWindow, bool textInputActive, bool foregroundOwned) -> bool
Definition CustomNotifyApp.cpp:137
auto notify(QObject *receiver, QEvent *event) -> bool override
Definition CustomNotifyApp.cpp:162
void setInputTranslator(InputTranslator *translator)
Definition CustomNotifyApp.cpp:151
~CustomNotifyApp() override
Definition CustomNotifyApp.cpp:129
Definition InputTranslator.h:178
Various input-related classes and functions.
Definition BmsKeys.h:12