diff --git a/win-linux/src/windows/platform_win/cwindowplatform.cpp b/win-linux/src/windows/platform_win/cwindowplatform.cpp index da7a50b3a..8c2f8c758 100644 --- a/win-linux/src/windows/platform_win/cwindowplatform.cpp +++ b/win-linux/src/windows/platform_win/cwindowplatform.cpp @@ -127,15 +127,17 @@ void CWindowPlatform::adjustGeometry() #ifdef __OS_WIN_XP setContentsMargins(0, 0, 0, 0); #else - double dpi = qApp->screenAt(geometry().center())->logicalDotsPerInch()/96; - const int brd = (dpi <= 1.0) ? 8 : - (dpi == 1.25) ? 9 : - (dpi == 1.5) ? 11 : - (dpi == 1.75) ? 12 : - (dpi == 2.0) ? 13 : - (dpi == 2.25) ? 14 : - (dpi == 2.5) ? 16 : 6 * dpi; - const int border = (!isTaskbarAutoHideOn() && Utils::getWinVersion() > Utils::WinVer::Win7) ? brd: 0; + int border = 0; + if (!isTaskbarAutoHideOn() && Utils::getWinVersion() > Utils::WinVer::Win7) { + double dpi = qApp->screenAt(geometry().center())->logicalDotsPerInch()/96; + border = (dpi <= 1.0) ? 8 : + (dpi == 1.25) ? 9 : + (dpi == 1.5) ? 11 : + (dpi == 1.75) ? 12 : + (dpi == 2.0) ? 13 : + (dpi == 2.25) ? 14 : + (dpi == 2.5) ? 16 : 6 * dpi; + } setContentsMargins(border, border, border, border); #endif }); @@ -261,10 +263,11 @@ bool CWindowPlatform::nativeEvent(const QByteArray &eventType, void *message, lo } case WM_NCCALCSIZE: { - NCCALCSIZE_PARAMS& params = *reinterpret_cast(msg->lParam); - if (params.rgrc[0].bottom != 0) - params.rgrc[0].bottom += 1; - *result = WVR_REDRAW; + if (!msg->wParam) + break; + NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS*)msg->lParam; + params->rgrc[0].bottom += 1; + *result = WVR_ALIGNLEFT | WVR_ALIGNTOP | WVR_REDRAW; return true; }