summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2022-08-20 19:00:33 +0400
committerIlya Fedin <fedin-ilja2010@ya.ru>2022-08-27 04:41:04 +0400
commitf832c707caaa24528eb3048280576144eb13cda4 (patch)
tree0cdf29cddf3cb60599cc4c2c53e5b9b77ebbac3e /src/plugins/platformthemes
parente81e7c3d99a089b16929607a9d39b76608ce3b9a (diff)
QGtk3Theme: subscribe to theme hint changes
Pick-to: 6.4 Change-Id: I67a9a0d06e88384c0bb6f5008609bcfbf504705f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platformthemes')
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3theme.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
index 44d9db8530..ab607a0c6d 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
@@ -7,6 +7,7 @@
#include <QVariant>
#include <QtCore/qregularexpression.h>
#include <QGuiApplication>
+#include <qpa/qwindowsysteminterface.h>
#undef signals
#include <gtk/gtk.h>
@@ -82,6 +83,25 @@ QGtk3Theme::QGtk3Theme()
/* Use our custom log handler. */
g_log_set_handler("Gtk", G_LOG_LEVEL_MESSAGE, gtkMessageHandler, nullptr);
+
+#define SETTING_CONNECT(setting) g_signal_connect(settings, "notify::" setting, G_CALLBACK(notifyThemeChanged), nullptr)
+ auto notifyThemeChanged = [] {
+ QWindowSystemInterface::handleThemeChange();
+ };
+
+ GtkSettings *settings = gtk_settings_get_default();
+ SETTING_CONNECT("gtk-cursor-blink-time");
+ SETTING_CONNECT("gtk-double-click-distance");
+ SETTING_CONNECT("gtk-double-click-time");
+ SETTING_CONNECT("gtk-long-press-time");
+ SETTING_CONNECT("gtk-entry-password-hint-timeout");
+ SETTING_CONNECT("gtk-dnd-drag-threshold");
+ SETTING_CONNECT("gtk-icon-theme-name");
+ SETTING_CONNECT("gtk-fallback-icon-theme");
+ SETTING_CONNECT("gtk-font-name");
+ SETTING_CONNECT("gtk-application-prefer-dark-theme");
+ SETTING_CONNECT("gtk-theme-name");
+#undef SETTING_CONNECT
}
static inline QVariant gtkGetLongPressTime()