This bug report is related to #2344 DirectWrite rendering looks blurry with DPI unaware apps.
When the application window which hosts Scintilla is moved to another monitor and the scaling factor of that monitor differs from the previous one, render targets need to be invalidated so that a call to ScintillaWin::EnsureRenderTarget() will drop the existing render target and recreate it with the scaling factor of the new monitor.
Therefore I suggest to alter the bottom section of ScintillaWin::UpdateRenderingParams() the following way:
const float newDeviceScaleFactor = Internal::GetDeviceScaleFactorWhenGdiScalingActive(hRootWnd);
if (deviceScaleFactor != newDeviceScaleFactor) {
deviceScaleFactor = newDeviceScaleFactor;
targets.valid = false;
}
When the application moves to another monitor with another scaling factor, a GDI scaling application will not inform child windows about WM_SIZE as its logical units aren't changing.
Update: Yesterday, I was moving the application between monitors with the shortcut
Win+Shift+Left/Right. This triggers the messageWM_WINDOWPOSCHANGED.Alas, when you drag the application with the mouse between monitors,
WM_WINDOWPOSCHANGEDis not sent.The change in scale factor when crossing monitor boundaries does trigger
WM_PAINT, but alsoWM_NCPAINTwhich is sent way less often thanWM_PAINT. Hence I suggest to updateScintillaWin::WndProc()by moving theWM_NCPAINTcase down toWM_WINDOWPOSCHANGED.Moreover, the
reverseArrowCursoralso needs to be invalidated.