mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-18 02:52:47 +03:00
feat(event): handle WM_ACTIVATE event in window proc
This commit is contained in:
parent
e6b43f9758
commit
27cab4814c
@ -51,6 +51,7 @@ int32_t Input::s_simulatedRightButtonClick;
|
|||||||
uint32_t Input::s_metaKeyState;
|
uint32_t Input::s_metaKeyState;
|
||||||
int32_t Input::s_queueHead;
|
int32_t Input::s_queueHead;
|
||||||
int32_t Input::s_queueTail;
|
int32_t Input::s_queueTail;
|
||||||
|
int32_t Input::s_windowFocused;
|
||||||
|
|
||||||
#if defined(WHOA_SYSTEM_WIN)
|
#if defined(WHOA_SYSTEM_WIN)
|
||||||
int32_t Input::s_savedMouseSpeed;
|
int32_t Input::s_savedMouseSpeed;
|
||||||
|
@ -21,6 +21,7 @@ namespace Input {
|
|||||||
extern uint32_t s_metaKeyState;
|
extern uint32_t s_metaKeyState;
|
||||||
extern int32_t s_queueHead;
|
extern int32_t s_queueHead;
|
||||||
extern int32_t s_queueTail;
|
extern int32_t s_queueTail;
|
||||||
|
extern int32_t s_windowFocused;
|
||||||
|
|
||||||
#if defined(WHOA_SYSTEM_WIN)
|
#if defined(WHOA_SYSTEM_WIN)
|
||||||
extern int32_t s_savedMouseSpeed;
|
extern int32_t s_savedMouseSpeed;
|
||||||
|
@ -8,11 +8,27 @@ int32_t OsGuiProcessMessage(void* message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) {
|
int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) {
|
||||||
|
auto hwnd = static_cast<HWND>(window);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
// TODO handle remaining message types
|
// TODO handle remaining message types
|
||||||
|
|
||||||
|
case WM_ACTIVATE: {
|
||||||
|
auto isMinimized = IsIconic(hwnd);
|
||||||
|
auto isActive = wparam != WA_INACTIVE;
|
||||||
|
Input::s_windowFocused = isActive && !isMinimized;
|
||||||
|
|
||||||
|
// TODO capture
|
||||||
|
|
||||||
|
// TODO mouse speed
|
||||||
|
|
||||||
|
OsQueuePut(OS_INPUT_FOCUS, Input::s_windowFocused != 0, 0, 0, 0);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_CLOSE: {
|
case WM_CLOSE: {
|
||||||
OsQueuePut(OS_INPUT_CLOSE, 0, 0, 0, 0);
|
OsQueuePut(OS_INPUT_CLOSE, 0, 0, 0, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user