From 5fa8280fd8d94006b9ad75ab924bc287df41afb3 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Mon, 1 Jun 2020 15:56:30 +0200 Subject: [PATCH] Hide wxSTC popup when the DPI changes After a DPI change, the position of the popup is wrong. It is not shown at the cursor position anymore. The correct size and position are calculated by scintilla, and there is no easy way to access this without modifying scintilla sources. --- src/stc/stc.cpp | 7 +++++++ src/stc/stc.cpp.in | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index b2578a4bd8..8e3820d162 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -5446,6 +5446,13 @@ void wxStyledTextCtrl::OnDPIChanged(wxDPIChangedEvent& evt) { { SetMarginWidth(i, (int)wxMulDivInt32(GetMarginWidth(i), evt.GetNewDPI().y, evt.GetOldDPI().y)); } + + // Hide auto-complete popup, there is no (easy) way to set it to the correct size + // and position + if ( AutoCompActive() ) + { + AutoCompCancel(); + } } diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 35210cbf1b..a3987c47fe 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -973,6 +973,13 @@ void wxStyledTextCtrl::OnDPIChanged(wxDPIChangedEvent& evt) { { SetMarginWidth(i, (int)wxMulDivInt32(GetMarginWidth(i), evt.GetNewDPI().y, evt.GetOldDPI().y)); } + + // Hide auto-complete popup, there is no (easy) way to set it to the correct size + // and position + if ( AutoCompActive() ) + { + AutoCompCancel(); + } }