diff --git a/src/mirage_render/src/platform_window/windows/windows_window.cpp b/src/mirage_render/src/platform_window/windows/windows_window.cpp index 5d9f69a..54a48aa 100644 --- a/src/mirage_render/src/platform_window/windows/windows_window.cpp +++ b/src/mirage_render/src/platform_window/windows/windows_window.cpp @@ -3,6 +3,7 @@ #include "platform_window/platform_window.h" #include <windows.h> +#include <windowsx.h> #define WINDOW_HANDLE static_cast<HWND>(window_handle_) @@ -40,14 +41,14 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // 窗口移动事件 if (uMsg == WM_MOVE) { - if (const auto window = get_window_from_hwnd(hwnd)) { window->on_move(LOWORD(lParam), HIWORD(lParam)); } + if (const auto window = get_window_from_hwnd(hwnd)) { window->on_move(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); } processed = true; } // 窗口大小改变事件 if (uMsg == WM_SIZE) { if (const auto window = get_window_from_hwnd(hwnd)) { - window->on_resize(LOWORD(lParam), HIWORD(lParam)); + window->on_resize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); } processed = true; } @@ -55,8 +56,8 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // 鼠标移动事件 if (uMsg == WM_MOUSEMOVE) { if (const auto window = get_window_from_hwnd(hwnd)) { - const int x = LOWORD(lParam); - const int y = HIWORD(lParam); + const int x = GET_X_LPARAM(lParam); + const int y = GET_Y_LPARAM(lParam); const Eigen::Vector2f pos(static_cast<float>(x), static_cast<float>(y)); window->handle_mouse_move(pos); } @@ -77,8 +78,8 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) const auto x_button = uMsg >= WM_XBUTTONDOWN && uMsg <= WM_XBUTTONDBLCLK; if (lmr_button || x_button) { if (const auto window = get_window_from_hwnd(hwnd)) { - const int x = LOWORD(lParam); - const int y = HIWORD(lParam); + const int x = GET_X_LPARAM(lParam); + const int y = GET_Y_LPARAM(lParam); const Eigen::Vector2f pos(static_cast<float>(x), static_cast<float>(y)); const auto action = platform_event_to_mouse_action(uMsg, wParam); const auto button = platform_event_to_mouse_button(uMsg, wParam); @@ -95,8 +96,8 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // 鼠标滚轮事件 if (uMsg == WM_MOUSEWHEEL || uMsg == WM_MOUSEHWHEEL) { if (const auto window = get_window_from_hwnd(hwnd)) { - const int x = LOWORD(lParam); - const int y = HIWORD(lParam); + const int x = GET_X_LPARAM(lParam); + const int y = GET_Y_LPARAM(lParam); POINT screen_point = { x, y }; ScreenToClient(hwnd, &screen_point);