aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZufu Liu <unknown>2020-05-28 08:26:52 +1000
committerZufu Liu <unknown>2020-05-28 08:26:52 +1000
commit9938be93a19ae3eb09ec7704d800991eb7fc0f12 (patch)
treeb388d57d667488dd37de7837a006afb85378e948
parenta42753e996f6e3ea346611600f82fadd26563848 (diff)
downloadscintilla-mirror-9938be93a19ae3eb09ec7704d800991eb7fc0f12.tar.gz
Bug [#2171]. Check for DPI change in WM_DPICHANGED_AFTERPARENT instead of every
paint.
-rw-r--r--win32/ScintillaWin.cxx23
1 files changed, 12 insertions, 11 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 28b6e950c..f2f6976f5 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -99,6 +99,9 @@
#ifndef WM_DPICHANGED
#define WM_DPICHANGED 0x02E0
#endif
+#ifndef WM_DPICHANGED_AFTERPARENT
+#define WM_DPICHANGED_AFTERPARENT 0x02E3
+#endif
#ifndef UNICODE_NOCHAR
#define UNICODE_NOCHAR 0xFFFF
@@ -376,8 +379,6 @@ class ScintillaWin :
Sci::Position TargetAsUTF8(char *text) const;
Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const;
- void CheckDpiChanged();
-
bool PaintDC(HDC hdc);
sptr_t WndPaint();
@@ -901,14 +902,6 @@ Sci::Position ScintillaWin::EncodedFromUTF8(const char *utf8, char *encoded) con
}
}
-void ScintillaWin::CheckDpiChanged() {
- const UINT dpiNow = DpiForWindow(wMain.GetID());
- if (dpi != dpiNow) {
- dpi = dpiNow;
- InvalidateStyleData();
- }
-}
-
bool ScintillaWin::PaintDC(HDC hdc) {
if (technology == SC_TECHNOLOGY_DEFAULT) {
AutoSurface surfaceWindow(hdc, this);
@@ -939,7 +932,6 @@ bool ScintillaWin::PaintDC(HDC hdc) {
}
sptr_t ScintillaWin::WndPaint() {
- CheckDpiChanged();
//ElapsedPeriod ep;
// Redirect assertions to debug output and save current state
@@ -1965,6 +1957,15 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
InvalidateStyleRedraw();
break;
+ case WM_DPICHANGED_AFTERPARENT: {
+ const UINT dpiNow = DpiForWindow(wMain.GetID());
+ if (dpi != dpiNow) {
+ dpi = dpiNow;
+ InvalidateStyleRedraw();
+ }
+ }
+ break;
+
case WM_CONTEXTMENU:
return ShowContextMenu(iMessage, wParam, lParam);