[scintilla:bugs] #2503 Invalidate render targets when detecting a changed scaling factor

0 views
Skip to first unread message

Markus Nißl

unread,
Mar 30, 2026, 6:31:00 AM (7 days ago) Mar 30
to scintill...@googlegroups.com

[bugs:#2503] Invalidate render targets when detecting a changed scaling factor

Status: open
Group: Bug
Labels: Scintilla Windows
Created: Mon Mar 30, 2026 10:30 AM UTC by Markus Nißl
Last Updated: Mon Mar 30, 2026 10:30 AM UTC
Owner: nobody

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.


Sent from sourceforge.net because scintill...@googlegroups.com is subscribed to https://sourceforge.net/p/scintilla/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/scintilla/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.

Markus Nißl

unread,
Mar 31, 2026, 10:31:11 AM (5 days ago) Mar 31
to scintill...@googlegroups.com

Update: Yesterday, I was moving the application between monitors with the shortcut Win+Shift+Left/Right. This triggers the message WM_WINDOWPOSCHANGED.

Alas, when you drag the application with the mouse between monitors, WM_WINDOWPOSCHANGED is not sent.

The change in scale factor when crossing monitor boundaries does trigger WM_PAINT, but also WM_NCPAINT which is sent way less often than WM_PAINT. Hence I suggest to update ScintillaWin::WndProc() by moving the WM_NCPAINT case down to WM_WINDOWPOSCHANGED.

Moreover, the reverseArrowCursor also needs to be invalidated.

        case WM_NCPAINT:
        case WM_WINDOWPOSCHANGED:
#if defined(USE_D2D)
            if (technology != Technology::Default) {
                if (UpdateRenderingParams(false)) {
                    reverseArrowCursor.Invalidate();
                    DropGraphics();
                    Redraw();
                }
            }
#endif
Reply all
Reply to author
Forward
0 new messages