Add WM_ACTIVATE to Win32 Mouse to make it a bit more robust

This commit is contained in:
Chuck Walbourn 2022-01-22 22:02:15 -08:00
Родитель 5013cab0b8
Коммит 09becf2178
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -401,6 +401,7 @@ void Mouse::SetResolution(float scale)
// { // {
// switch (message) // switch (message)
// { // {
// case WM_ACTIVATE:
// case WM_ACTIVATEAPP: // case WM_ACTIVATEAPP:
// case WM_INPUT: // case WM_INPUT:
// case WM_MOUSEMOVE: // case WM_MOUSEMOVE:
@ -513,6 +514,7 @@ public:
assert(mWindow != nullptr); assert(mWindow != nullptr);
// Send a WM_HOVER as a way to 'kick' the message processing even if the mouse is still.
TRACKMOUSEEVENT tme; TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme); tme.cbSize = sizeof(tme);
tme.dwFlags = TME_HOVER; tme.dwFlags = TME_HOVER;
@ -702,6 +704,7 @@ void Mouse::ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam)
switch (message) switch (message)
{ {
case WM_ACTIVATE:
case WM_ACTIVATEAPP: case WM_ACTIVATEAPP:
if (wParam) if (wParam)
{ {
@ -722,6 +725,11 @@ void Mouse::ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam)
memset(&pImpl->mState, 0, sizeof(State)); memset(&pImpl->mState, 0, sizeof(State));
pImpl->mState.scrollWheelValue = scrollWheel; pImpl->mState.scrollWheelValue = scrollWheel;
if (pImpl->mMode == MODE_RELATIVE)
{
ClipCursor(nullptr);
}
pImpl->mInFocus = false; pImpl->mInFocus = false;
} }
return; return;