diff --git a/widget/gtk/GRefPtr.h b/widget/gtk/GRefPtr.h index 06d7410ed2e3..197000881136 100644 --- a/widget/gtk/GRefPtr.h +++ b/widget/gtk/GRefPtr.h @@ -27,6 +27,7 @@ struct GObjectRefPtrTraits { GOBJECT_TRAITS(GtkWidget) GOBJECT_TRAITS(GFile) +GOBJECT_TRAITS(GFileMonitor) GOBJECT_TRAITS(GMenu) GOBJECT_TRAITS(GMenuItem) GOBJECT_TRAITS(GSimpleAction) diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp index 04213c38f0f5..b9e53c96d40a 100644 --- a/widget/gtk/nsLookAndFeel.cpp +++ b/widget/gtk/nsLookAndFeel.cpp @@ -215,6 +215,17 @@ nsLookAndFeel::nsLookAndFeel() { }, this, nullptr); } + if (IsKdeDesktopEnvironment()) { + GUniquePtr path( + g_strconcat(g_get_user_config_dir(), "/gtk-3.0/colors.css", NULL)); + mKdeColors = dont_AddRef(g_file_new_for_path(path.get())); + mKdeColorsMonitor = dont_AddRef( + g_file_monitor_file(mKdeColors.get(), G_FILE_MONITOR_NONE, NULL, NULL)); + if (mKdeColorsMonitor) { + g_signal_connect(mKdeColorsMonitor.get(), "changed", + G_CALLBACK(settings_changed_cb), NULL); + } + } } nsLookAndFeel::~nsLookAndFeel() { diff --git a/widget/gtk/nsLookAndFeel.h b/widget/gtk/nsLookAndFeel.h index f27ea8e4f822..fe9e628f672c 100644 --- a/widget/gtk/nsLookAndFeel.h +++ b/widget/gtk/nsLookAndFeel.h @@ -17,6 +17,8 @@ enum WidgetNodeType : int; struct _GtkStyle; typedef struct _GDBusProxy GDBusProxy; typedef struct _GtkCssProvider GtkCssProvider; +typedef struct _GFile GFile; +typedef struct _GFileMonitor GFileMonitor; namespace mozilla { enum class StyleGtkThemeFamily : uint8_t; @@ -162,6 +164,8 @@ class nsLookAndFeel final : public nsXPLookAndFeel { uint32_t mDBusID = 0; RefPtr mDBusSettingsProxy; + RefPtr mKdeColors; + RefPtr mKdeColorsMonitor; mozilla::Maybe mColorSchemePreference; int32_t mCaretBlinkTime = 0; int32_t mCaretBlinkCount = -1;