forked from github_mirror/framelesshelper
Win32: update the internal margin when DPI changes
Make the internal margin sync with the latest DPI. Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
824b0746c1
commit
04f31f7b42
|
@ -154,7 +154,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
// Anyway, we should skip it in this case.
|
// Anyway, we should skip it in this case.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const QWindow *window = Utilities::findWindow(reinterpret_cast<WId>(msg->hwnd));
|
const QWindow * const window = Utilities::findWindow(reinterpret_cast<WId>(msg->hwnd));
|
||||||
if (!window || !window->property(Constants::kFramelessModeFlag).toBool()) {
|
if (!window || !window->property(Constants::kFramelessModeFlag).toBool()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -675,6 +675,12 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
windowPos->flags |= SWP_NOCOPYBITS;
|
windowPos->flags |= SWP_NOCOPYBITS;
|
||||||
} break;
|
} break;
|
||||||
#endif
|
#endif
|
||||||
|
case WM_DPICHANGED: {
|
||||||
|
// The DPI has changed, we need to update the internal window frame
|
||||||
|
// recorded in Windows QPA.
|
||||||
|
Utilities::updateQtFrameMargins(const_cast<QWindow *>(window), true);
|
||||||
|
Utilities::triggerFrameChange(reinterpret_cast<WId>(msg->hwnd));
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,10 @@
|
||||||
#define WM_DWMCOLORIZATIONCOLORCHANGED (0x0320)
|
#define WM_DWMCOLORIZATIONCOLORCHANGED (0x0320)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WM_DPICHANGED
|
||||||
|
#define WM_DPICHANGED (0x02E0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SM_CXPADDEDBORDER
|
#ifndef SM_CXPADDEDBORDER
|
||||||
#define SM_CXPADDEDBORDER (92)
|
#define SM_CXPADDEDBORDER (92)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -96,6 +96,9 @@ void FramelessQuickHelper::showMinimized()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
// Work-around a QtQuick bug: https://bugreports.qt.io/browse/QTBUG-69711
|
// Work-around a QtQuick bug: https://bugreports.qt.io/browse/QTBUG-69711
|
||||||
|
// Don't use "SW_SHOWMINIMIZED" because it will activate the current
|
||||||
|
// window instead of the next window in the Z order, that's not the
|
||||||
|
// native behavior of Windows applications.
|
||||||
ShowWindow(reinterpret_cast<HWND>(window()->winId()), SW_MINIMIZE);
|
ShowWindow(reinterpret_cast<HWND>(window()->winId()), SW_MINIMIZE);
|
||||||
#else
|
#else
|
||||||
window()->showMinimized();
|
window()->showMinimized();
|
||||||
|
|
Loading…
Reference in New Issue