diff --git a/Source/Client/Application/ApplicationWindow.cpp b/Source/Client/Application/ApplicationWindow.cpp index ae662253..4841e320 100644 --- a/Source/Client/Application/ApplicationWindow.cpp +++ b/Source/Client/Application/ApplicationWindow.cpp @@ -126,17 +126,17 @@ LRESULT CALLBACK sub_E5C430(HWND window, UINT message, WPARAM wParam, LPARAM lPa } return 1; } - if (g_isAppActive != 1) { - CWebBrowser* browser = g_windowMgr.FindBrowser(reinterpret_cast(lParam)); - if (browser && browser->MatchesWindow(reinterpret_cast(lParam))) { - SetApplicationActive(1); - } else { - ShowWindow(window, SW_MINIMIZE); - } + if (g_isAppActive == 1) { + g_restoreSurfaces = 1; + ShowWindow(window, SW_MAXIMIZE); return 1; } - g_restoreSurfaces = 1; - ShowWindow(window, SW_MAXIMIZE); + CWebBrowser* browser = g_windowMgr.FindBrowser(reinterpret_cast(lParam)); + if (browser && browser->MatchesWindow(reinterpret_cast(lParam))) { + SetApplicationActive(1); + } else { + ShowWindow(window, SW_MINIMIZE); + } return 1; } case WM_ERASEBKGND: @@ -171,10 +171,11 @@ LRESULT CALLBACK sub_E5C430(HWND window, UINT message, WPARAM wParam, LPARAM lPa case WM_GETMINMAXINFO: if (hWnd) { MINMAXINFO* info = reinterpret_cast(lParam); - info->ptMinTrackSize.x = Rect.right - Rect.left; - info->ptMaxTrackSize.x = Rect.right - Rect.left; - info->ptMinTrackSize.y = Rect.bottom - Rect.top; - info->ptMaxTrackSize.y = Rect.bottom - Rect.top; + const RECT bounds = Rect; + info->ptMinTrackSize.x = bounds.right - bounds.left; + info->ptMaxTrackSize.x = bounds.right - bounds.left; + info->ptMinTrackSize.y = bounds.bottom - bounds.top; + info->ptMaxTrackSize.y = bounds.bottom - bounds.top; } return 0; case WM_NCACTIVATE: @@ -263,7 +264,7 @@ LRESULT CALLBACK sub_E5C430(HWND window, UINT message, WPARAM wParam, LPARAM lPa case WM_RBUTTONUP: case WM_RBUTTONDBLCLK: case WM_MOUSEWHEEL: - g_mouse.Message(g_mouse, hWnd, window, message, wParam, lParam); + g_mouse.Message(window, message, wParam, lParam); break; case WM_ENTERMENULOOP: case WM_ENTERSIZEMOVE: diff --git a/Source/Client/Input/Mouse.cpp b/Source/Client/Input/Mouse.cpp index 4af89011..1858969d 100644 --- a/Source/Client/Input/Mouse.cpp +++ b/Source/Client/Input/Mouse.cpp @@ -1,7 +1,7 @@ #include "Client/Input/Mouse.h" +#include "Client/Application/ApplicationWindow.h" #include "Render/DeviceContext/DCSurface.h" -#include #include // OFFSET: 0x006370C0 @@ -88,21 +88,16 @@ void CMouse::SetY(int value) { // OFFSET: 0x00637260 // FUNCTION: fn_04731 -void CMouse::Message(CMouse& global, HWND mainWindow, HWND source, UINT message, WPARAM keys, LPARAM) { - if (global.active != 1) { - global.Reset(); - global.active = 1; +void CMouse::Message(HWND source, UINT message, WPARAM keys, LPARAM) { + if (g_mouse.active != 1) { + g_mouse.Reset(); + g_mouse.active = 1; } switch (message) { - case WM_MOUSEMOVE: { - POINT point; - GetCursorPos(&point); - ScreenToClient(mainWindow, &point); - this->pendingX = point.x; - this->pendingY = point.y; + case WM_MOUSEWHEEL: + this->pendingWheel = GET_WHEEL_DELTA_WPARAM(keys); break; - } case WM_LBUTTONDOWN: this->pendingButtons[0] = 1; SetCapture(source); @@ -117,8 +112,13 @@ void CMouse::Message(CMouse& global, HWND mainWindow, HWND source, UINT message, case WM_RBUTTONUP: this->pendingButtons[1] = 0; break; - case WM_MOUSEWHEEL: - this->pendingWheel = GET_WHEEL_DELTA_WPARAM(keys); + case WM_MOUSEMOVE: { + POINT point; + GetCursorPos(&point); + ScreenToClient(hWnd, &point); + this->pendingX = point.x; + this->pendingY = point.y; break; } + } } diff --git a/Source/Client/Input/Mouse.h b/Source/Client/Input/Mouse.h index b0a2923d..dcabbfe0 100644 --- a/Source/Client/Input/Mouse.h +++ b/Source/Client/Input/Mouse.h @@ -13,7 +13,7 @@ public: void SetX(int value); void SetY(int value); - void Message(CMouse& global, HWND mainWindow, HWND source, UINT message, WPARAM keys, LPARAM unused); + void Message(HWND source, UINT message, WPARAM keys, LPARAM unused); /* 0004 */ int x = 0; /* 0008 */ int y = 0;