Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-04-09 16:29:58 +08:00
parent ad2f7af71a
commit 054a160639
1 changed files with 2 additions and 2 deletions

View File

@ -335,7 +335,6 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType,
// If wParam is TRUE, lParam points to an NCCALCSIZE_PARAMS structure that contains information an application can use to calculate the new size and position of the client rectangle.
// If wParam is FALSE, lParam points to a RECT structure. On entry, the structure contains the proposed window rectangle for the window. On exit, the structure should contain the screen coordinates of the corresponding window client area.
const auto mode = static_cast<BOOL>(msg->wParam);
const auto rect = mode ? &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(msg->lParam)->rgrc[0]) : reinterpret_cast<LPRECT>(msg->lParam);
if (IsMaximized(msg->hwnd)) {
const HMONITOR windowMonitor =
MonitorFromWindow(msg->hwnd, MONITOR_DEFAULTTONEAREST);
@ -343,6 +342,7 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType,
SecureZeroMemory(&monitorInfo, sizeof(monitorInfo));
monitorInfo.cbSize = sizeof(monitorInfo);
GetMonitorInfoW(windowMonitor, &monitorInfo);
const auto rect = mode ? &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(msg->lParam)->rgrc[0]) : reinterpret_cast<LPRECT>(msg->lParam);
*rect = monitorInfo.rcWork;
// If the client rectangle is the same as the monitor's
// rectangle, the shell assumes that the window has gone