aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2021-09-19 11:55:08 +1000
committerNeil Hodgson <nyamatongwe@gmail.com>2021-09-19 11:55:08 +1000
commitb9ad43e8b1cfaa7213be0eb33ed179285c33c67a (patch)
tree6cda8c80b3ff5c5efb3764fbb87fa96b11848b1f
parent0e05823e5c021e2368c885743092450a199ef16e (diff)
downloadscintilla-mirror-b9ad43e8b1cfaa7213be0eb33ed179285c33c67a.tar.gz
Respond to changes in system font scaling by clearing any cached layout data.
-rw-r--r--doc/ScintillaHistory.html3
-rwxr-xr-xgtk/ScintillaGTK.cxx13
-rwxr-xr-xgtk/ScintillaGTK.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 1b16f2d18..3f9dd09e5 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -609,6 +609,9 @@
DejaVu Sans Mono 10.
</li>
<li>
+ On GTK, respond to changes in system font scaling by clearing any cached layout data.
+ </li>
+ <li>
On Cocoa, fix memory leak caused by circular references.
<a href="https://sourceforge.net/p/scintilla/bugs/2268/">Bug #2268</a>.
</li>
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 7b47d6348..92973a083 100755
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -231,6 +231,7 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) :
im_context(nullptr),
lastNonCommonScript(G_UNICODE_SCRIPT_INVALID_CODE),
settings(nullptr),
+ settingsHandlerId(0),
lastWheelMouseTime(0),
lastWheelMouseDirection(0),
wheelMouseIntensity(0),
@@ -277,6 +278,9 @@ ScintillaGTK::~ScintillaGTK() {
}
ClearPrimarySelection();
wPreedit.Destroy();
+ if (settingsHandlerId) {
+ g_signal_handler_disconnect(settings, settingsHandlerId);
+ }
if (settings) {
g_object_unref(settings);
}
@@ -357,6 +361,15 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) {
cursor = gdk_cursor_new_for_display(pdisplay, GDK_LEFT_PTR);
gdk_window_set_cursor(PWindow(scrollbarh), cursor);
UnRefCursor(cursor);
+
+ using NotifyLambda = void (*)(GObject *, GParamSpec *, ScintillaGTK *);
+ if (settings) {
+ settingsHandlerId = g_signal_connect(settings, "notify::gtk-xft-dpi",
+ G_CALLBACK(static_cast<NotifyLambda>([](GObject *, GParamSpec *, ScintillaGTK *sciThis) {
+ sciThis->InvalidateStyleRedraw();
+ })),
+ this);
+ }
}
void ScintillaGTK::Realize(GtkWidget *widget) {
diff --git a/gtk/ScintillaGTK.h b/gtk/ScintillaGTK.h
index da2f74c90..022471699 100755
--- a/gtk/ScintillaGTK.h
+++ b/gtk/ScintillaGTK.h
@@ -63,6 +63,7 @@ class ScintillaGTK : public ScintillaBase {
GUnicodeScript lastNonCommonScript;
GtkSettings *settings;
+ gulong settingsHandlerId;
// Wheel mouse support
unsigned int linesPerScroll;