From e5a527b5ef0e83465d195a03442829980e01d89d Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 11 May 2020 04:19:50 +0400 Subject: [PATCH] Adapt for building with MinGW and 64-bit --- ui/platform/win/ui_utility_win.cpp | 2 +- ui/platform/win/ui_window_shadow_win.cpp | 18 +++++++++++++++++- ui/platform/win/ui_window_win.cpp | 8 ++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ui/platform/win/ui_utility_win.cpp b/ui/platform/win/ui_utility_win.cpp index 9187e50..392a65d 100644 --- a/ui/platform/win/ui_utility_win.cpp +++ b/ui/platform/win/ui_utility_win.cpp @@ -36,7 +36,7 @@ void IgnoreAllActivation(not_null widget) { Assert(handle != nullptr); ShowWindow(handle, SW_HIDE); - const auto style = GetWindowLong(handle, GWL_EXSTYLE); + const auto style = GetWindowLongPtr(handle, GWL_EXSTYLE); SetWindowLong( handle, GWL_EXSTYLE, diff --git a/ui/platform/win/ui_window_shadow_win.cpp b/ui/platform/win/ui_window_shadow_win.cpp index 9b703fe..7661e50 100644 --- a/ui/platform/win/ui_window_shadow_win.cpp +++ b/ui/platform/win/ui_window_shadow_win.cpp @@ -16,6 +16,22 @@ #include +// WM_POINTER support from Windows 8 onwards (WINVER >= 0x0602) +#ifndef WM_POINTERUPDATE +# define WM_NCPOINTERUPDATE 0x0241 +# define WM_NCPOINTERDOWN 0x0242 +# define WM_NCPOINTERUP 0x0243 +# define WM_POINTERUPDATE 0x0245 +# define WM_POINTERDOWN 0x0246 +# define WM_POINTERUP 0x0247 +# define WM_POINTERENTER 0x0249 +# define WM_POINTERLEAVE 0x024A +# define WM_POINTERACTIVATE 0x024B +# define WM_POINTERCAPTURECHANGED 0x024C +# define WM_POINTERWHEEL 0x024E +# define WM_POINTERHWHEEL 0x024F +#endif // WM_POINTERUPDATE + namespace Ui { namespace Platform { namespace { @@ -197,7 +213,7 @@ void WindowShadow::init(QColor color) { return; } ShadowByHandle.emplace(_handles[i], this); - SetWindowLong(_handles[i], GWL_HWNDPARENT, (LONG)_handle); + SetWindowLongPtr(_handles[i], GWLP_HWNDPARENT, (LONG)_handle); _contexts[i] = CreateCompatibleDC(_screenContext); if (!_contexts[i]) { diff --git a/ui/platform/win/ui_window_win.cpp b/ui/platform/win/ui_window_win.cpp index 41a2260..b1dbd1c 100644 --- a/ui/platform/win/ui_window_win.cpp +++ b/ui/platform/win/ui_window_win.cpp @@ -70,7 +70,7 @@ bool WindowHelper::NativeFilter::nativeEventFilter( msg->message, msg->wParam, msg->lParam, - static_cast(result)) + reinterpret_cast(result)) : false; } @@ -269,7 +269,7 @@ bool WindowHelper::handleNativeEvent( } return false; case WM_SHOWWINDOW: { - const auto style = GetWindowLong(_handle, GWL_STYLE); + const auto style = GetWindowLongPtr(_handle, GWL_STYLE); const auto changes = WindowShadow::Change::Resized | ((wParam && !(style & (WS_MAXIMIZE | WS_MINIMIZE))) ? WindowShadow::Change::Shown @@ -375,8 +375,8 @@ void WindowHelper::updateMargins() { GetClientRect(_handle, &r); a = r; - const auto style = GetWindowLong(_handle, GWL_STYLE); - const auto styleEx = GetWindowLong(_handle, GWL_EXSTYLE); + const auto style = GetWindowLongPtr(_handle, GWL_STYLE); + const auto styleEx = GetWindowLongPtr(_handle, GWL_EXSTYLE); AdjustWindowRectEx(&a, style, false, styleEx); auto margins = QMargins( a.left - r.left,