diff options
Diffstat (limited to 'win32/ScintillaWin.cxx')
| -rw-r--r-- | win32/ScintillaWin.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 695371bf8..97478e872 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -95,6 +95,10 @@ #define WM_UNICHAR 0x0109 #endif +#ifndef WM_DPICHANGED +#define WM_DPICHANGED 0x02E0 +#endif + #ifndef UNICODE_NOCHAR #define UNICODE_NOCHAR 0xFFFF #endif @@ -279,6 +283,8 @@ class ScintillaWin : unsigned int linesPerScroll; ///< Intellimouse support int wheelDelta; ///< Wheel delta from roll + UINT dpi = 72; + HRGN hRgnUpdate; bool hasOKText; @@ -335,6 +341,8 @@ class ScintillaWin : void AddCharUTF16(wchar_t const *wcs, unsigned int wclen, CharacterSource charSource); Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const; + void CheckDpiChanged(); + bool PaintDC(HDC hdc); sptr_t WndPaint(); @@ -825,6 +833,14 @@ 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(); + } +} + // Add one character from a UTF-16 string, by converting to either UTF-8 or // the current codepage. Code is similar to HandleCompositionWindowed(). void ScintillaWin::AddCharUTF16(wchar_t const *wcs, unsigned int wclen, CharacterSource charSource) { @@ -875,6 +891,7 @@ bool ScintillaWin::PaintDC(HDC hdc) { } sptr_t ScintillaWin::WndPaint() { + CheckDpiChanged(); //ElapsedPeriod ep; // Redirect assertions to debug output and save current state @@ -1874,6 +1891,10 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam InvalidateStyleData(); break; + case WM_DPICHANGED: + InvalidateStyleRedraw(); + break; + case WM_CONTEXTMENU: return ShowContextMenu(iMessage, wParam, lParam); |
