From 951974f8084ba8b1e8c0fa93f706c3e820256b84 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 31 May 2020 23:37:08 +0200 Subject: [PATCH] Reset the wxSTC cursor when the DPI changes This causes the cursor to be recreated (when necessary) at the correct DPI. --- src/stc/stc.cpp | 5 +++++ src/stc/stc.cpp.in | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index a0ed931021..b2578a4bd8 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -5436,6 +5436,11 @@ void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) { void wxStyledTextCtrl::OnDPIChanged(wxDPIChangedEvent& evt) { m_swx->DoInvalidateStyleData(); + // trigger a cursor change, so any cursors created by wxWidgets (like reverse arrow) will be recreated + const int oldCursor = GetSTCCursor(); + SetSTCCursor(-1); + SetSTCCursor(oldCursor); + // adjust the margins to the new DPI for ( int i = 0; i < SC_MAX_MARGIN; ++i ) { diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 4ea7df2d78..35210cbf1b 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -963,6 +963,11 @@ void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) { void wxStyledTextCtrl::OnDPIChanged(wxDPIChangedEvent& evt) { m_swx->DoInvalidateStyleData(); + // trigger a cursor change, so any cursors created by wxWidgets (like reverse arrow) will be recreated + const int oldCursor = GetSTCCursor(); + SetSTCCursor(-1); + SetSTCCursor(oldCursor); + // adjust the margins to the new DPI for ( int i = 0; i < SC_MAX_MARGIN; ++i ) {