Minor tweaks.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-12-05 21:55:26 +08:00
parent 6c76dda4f0
commit ca2a3be39d
1 changed files with 17 additions and 11 deletions

View File

@ -1003,12 +1003,7 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType,
*result = 0; *result = 0;
return true; return true;
} }
// If the window bounds change, we're going to relayout and repaint bool nonclient = false;
// anyway. Returning WVR_REDRAW avoids an extra paint before that of
// the old client pixels in the (now wrong) location, and thus makes
// actions like resizing a window from the left edge look slightly
// less broken.
*result = WVR_REDRAW;
const auto clientRect = &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(msg->lParam)->rgrc[0]); const auto clientRect = &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(msg->lParam)->rgrc[0]);
if (shouldHaveWindowFrame()) { if (shouldHaveWindowFrame()) {
// Store the original top before the default window proc // Store the original top before the default window proc
@ -1048,6 +1043,7 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType,
clientRect->left += bw; clientRect->left += bw;
clientRect->right -= bw; clientRect->right -= bw;
} }
nonclient = true;
} }
// Attempt to detect if there's an autohide taskbar, and if // Attempt to detect if there's an autohide taskbar, and if
// there is, reduce our size a bit on the side with the taskbar, // there is, reduce our size a bit on the side with the taskbar,
@ -1143,20 +1139,30 @@ bool WinNativeEventFilter::nativeEventFilter(const QByteArray &eventType,
if (top) { if (top) {
// Peculiarly, when we're fullscreen, // Peculiarly, when we're fullscreen,
clientRect->top += kAutoHideTaskbarThicknessPy; clientRect->top += kAutoHideTaskbarThicknessPy;
nonclient = true;
} else if (bottom) { } else if (bottom) {
clientRect->bottom -= kAutoHideTaskbarThicknessPy; clientRect->bottom -= kAutoHideTaskbarThicknessPy;
nonclient = true;
} else if (left) { } else if (left) {
clientRect->left += kAutoHideTaskbarThicknessPx; clientRect->left += kAutoHideTaskbarThicknessPx;
nonclient = true;
} else if (right) { } else if (right) {
clientRect->right -= kAutoHideTaskbarThicknessPx; clientRect->right -= kAutoHideTaskbarThicknessPx;
nonclient = true;
} }
} }
// We cannot return WVR_REDRAW when there is nonclient area, or
// Windows exhibits bugs where client pixels and child HWNDs are
// mispositioned by the width/height of the upper-left nonclient
// area.
*result = 0;
} }
// If the window bounds change, we're going to relayout and repaint
// anyway. Returning WVR_REDRAW avoids an extra paint before that of
// the old client pixels in the (now wrong) location, and thus makes
// actions like resizing a window from the left edge look slightly
// less broken.
//
// We cannot return WVR_REDRAW when there is nonclient area, or
// Windows exhibits bugs where client pixels and child HWNDs are
// mispositioned by the width/height of the upper-left nonclient
// area.
*result = nonclient ? 0 : WVR_REDRAW;
return true; return true;
} }
// These undocumented messages are sent to draw themed window // These undocumented messages are sent to draw themed window