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

1 view
Skip to first unread message

Markus Nißl

unread,
Mar 30, 2026, 6:31:00 AMMar 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 AMMar 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

Neil Hodgson

unread,
Apr 8, 2026, 12:39:36 AMApr 8
to scintill...@googlegroups.com

WM_NCPAINT doesn't appear to occur when the Scintilla window has no border as may be caused when any borders or dividers are supplied by other windows in the hierarchy.


[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: Tue Mar 31, 2026 02:31 PM UTC
Owner: nobody

Zufu Liu

unread,
Apr 11, 2026, 2:33:37 AMApr 11
to scintill...@googlegroups.com
  • labels: Scintilla, Windows --> Scintilla, Windows, DirectWrite

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

Status: open
Group: Bug
Labels: Scintilla Windows DirectWrite

Created: Mon Mar 30, 2026 10:30 AM UTC by Markus Nißl

Last Updated: Wed Apr 08, 2026 04:39 AM UTC
Owner: nobody

Markus Nißl

unread,
Apr 14, 2026, 8:36:33 AMApr 14
to scintill...@googlegroups.com

The Scintilla edit control has no WS_BORDER style, though WM_NCPAINT is triggered.


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

Status: open
Group: Bug
Labels: Scintilla Windows DirectWrite

Created: Mon Mar 30, 2026 10:30 AM UTC by Markus Nißl

Last Updated: Sat Apr 11, 2026 06:33 AM UTC
Owner: nobody

Neil Hodgson

unread,
Apr 21, 2026, 9:21:17 PM (13 days ago) Apr 21
to scintill...@googlegroups.com

Committed with [0c8e25].


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

Status: open
Group: Bug
Labels: Scintilla Windows DirectWrite

Created: Mon Mar 30, 2026 10:30 AM UTC by Markus Nißl

Last Updated: Tue Apr 14, 2026 12:36 PM UTC
Owner: nobody

Neil Hodgson

unread,
Apr 21, 2026, 9:21:28 PM (13 days ago) Apr 21
to scintill...@googlegroups.com
  • status: open --> open-fixed

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

Status: open-fixed
Group: Bug
Labels: Scintilla Windows DirectWrite

Created: Mon Mar 30, 2026 10:30 AM UTC by Markus Nißl

Last Updated: Wed Apr 22, 2026 01:21 AM UTC
Owner: nobody

Markus Nißl

unread,
Apr 22, 2026, 7:46:12 AM (13 days ago) Apr 22
to scintill...@googlegroups.com

In your commit, you missed to also invalidate the reverse arrow cursor when handling WM_NCPAINTand WM_WINDOWPOSCHANGED in case UpdateRenderingParams(false) returns true:

reverseArrowCursor.Invalidate();

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

Status: open-fixed


Group: Bug
Labels: Scintilla Windows DirectWrite
Created: Mon Mar 30, 2026 10:30 AM UTC by Markus Nißl

Last Updated: Wed Apr 22, 2026 01:21 AM UTC
Owner: nobody

Neil Hodgson

unread,
Apr 22, 2026, 6:36:03 PM (12 days ago) Apr 22
to scintill...@googlegroups.com

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

Status: open-fixed
Group: Bug
Labels: Scintilla Windows DirectWrite
Created: Mon Mar 30, 2026 10:30 AM UTC by Markus Nißl

Last Updated: Wed Apr 22, 2026 11:46 AM UTC
Owner: nobody

Neil Hodgson

unread,
Apr 28, 2026, 8:12:05 PM (6 days ago) Apr 28
to scintill...@googlegroups.com
  • status: open-fixed --> closed-fixed

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

Status: closed-fixed
Group: Bug
Labels: Scintilla Windows DirectWrite

Created: Mon Mar 30, 2026 10:30 AM UTC by Markus Nißl

Last Updated: Wed Apr 22, 2026 10:35 PM UTC
Owner: nobody

Reply all
Reply to author
Forward
0 new messages