[deploy] fix: missing WindowResizedEvent when maximized

This commit is contained in:
Nomango 2020-10-16 00:17:58 +08:00
parent 266453a907
commit 18a0fd5e55
1 changed files with 19 additions and 10 deletions

View File

@ -603,6 +603,7 @@ LRESULT WindowWin32Impl::MessageProc(HWND hwnd, UINT32 msg, WPARAM wparam, LPARA
case WM_SIZE: case WM_SIZE:
{ {
bool resized = false;
if (SIZE_MAXHIDE == wparam || SIZE_MINIMIZED == wparam) if (SIZE_MAXHIDE == wparam || SIZE_MINIMIZED == wparam)
{ {
KGE_DEBUG_LOGF("Window minimized"); KGE_DEBUG_LOGF("Window minimized");
@ -620,6 +621,10 @@ LRESULT WindowWin32Impl::MessageProc(HWND hwnd, UINT32 msg, WPARAM wparam, LPARA
is_minimized_ = false; is_minimized_ = false;
Application::GetInstance().Resume(); Application::GetInstance().Resume();
} }
else
{
resized = true;
}
} }
else if (wparam == SIZE_RESTORED) else if (wparam == SIZE_RESTORED)
{ {
@ -637,18 +642,22 @@ LRESULT WindowWin32Impl::MessageProc(HWND hwnd, UINT32 msg, WPARAM wparam, LPARA
} }
else else
{ {
this->width_ = ((uint32_t)(short)LOWORD(lparam)); resized = true;
this->height_ = ((uint32_t)(short)HIWORD(lparam));
WindowResizedEventPtr evt = new WindowResizedEvent;
evt->window = this;
evt->width = this->GetWidth();
evt->height = this->GetHeight();
this->PushEvent(evt);
KGE_DEBUG_LOGF("Window resized to (%d, %d)", this->width_, this->height_);
} }
} }
if (resized)
{
this->width_ = ((uint32_t)(short)LOWORD(lparam));
this->height_ = ((uint32_t)(short)HIWORD(lparam));
WindowResizedEventPtr evt = new WindowResizedEvent;
evt->window = this;
evt->width = this->GetWidth();
evt->height = this->GetHeight();
this->PushEvent(evt);
KGE_DEBUG_LOGF("Window resized to (%d, %d)", this->width_, this->height_);
}
} }
break; break;