commit e0519cf6b0c4838fee4e2f9568ed0fc3ab6b8b30
parent a882955be1551c9b63b0b2303a5a6147f61e57e2
Author: stransky <stransky@redhat.com>
Date: Thu, 4 Dec 2025 06:52:46 +0000
Bug 2002455 [Linux] Guard nsLookAndFeel DBus code by MOZ_ENABLE_DBUS r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D274725
Diffstat:
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp
@@ -125,6 +125,7 @@ static float GetGtkTextScaleFactor() {
static bool sCSDAvailable;
+#ifdef MOZ_ENABLE_DBUS
static nsCString GVariantToString(GVariant* aVariant) {
nsCString ret;
gchar* s = g_variant_print(aVariant, TRUE);
@@ -325,6 +326,7 @@ void nsLookAndFeel::UnwatchDBus() {
mDBusSettingsProxy = nullptr;
nsAppShell::DBusConnectionCheck();
}
+#endif
nsLookAndFeel::nsLookAndFeel() {
static constexpr nsLiteralCString kObservedSettings[] = {
@@ -370,6 +372,7 @@ nsLookAndFeel::nsLookAndFeel() {
sCSDAvailable =
nsWindow::GetSystemGtkWindowDecoration() != nsWindow::GTK_DECORATION_NONE;
+#ifdef MOZ_ENABLE_DBUS
if (ShouldUsePortal(PortalKind::Settings)) {
mDBusID = g_bus_watch_name(
G_BUS_TYPE_SESSION, "org.freedesktop.portal.Desktop",
@@ -385,6 +388,7 @@ nsLookAndFeel::nsLookAndFeel() {
},
this, nullptr);
}
+#endif
if (IsKdeDesktopEnvironment()) {
GUniquePtr<gchar> path(
g_strconcat(g_get_user_config_dir(), "/gtk-3.0/colors.css", NULL));
@@ -402,11 +406,13 @@ nsLookAndFeel::nsLookAndFeel() {
nsLookAndFeel::~nsLookAndFeel() {
ClearRoundedCornerProvider();
+#ifdef MOZ_ENABLE_DBUS
if (mDBusID) {
g_bus_unwatch_name(mDBusID);
mDBusID = 0;
}
UnwatchDBus();
+#endif
if (GtkSettings* settings = gtk_settings_get_default()) {
g_signal_handlers_disconnect_by_func(
settings, FuncToGpointer(settings_changed_cb), nullptr);
diff --git a/widget/gtk/nsLookAndFeel.h b/widget/gtk/nsLookAndFeel.h
@@ -71,10 +71,12 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
static const nscolor kBlack = NS_RGB(0, 0, 0);
static const nscolor kWhite = NS_RGB(255, 255, 255);
+#ifdef MOZ_ENABLE_DBUS
// Returns whether any setting changed.
bool RecomputeDBusSettings();
// Returns whether the setting really changed.
bool RecomputeDBusAppearanceSetting(const nsACString& aKey, GVariant* aValue);
+#endif
struct ColorPair {
nscolor mBg = kWhite;
@@ -107,8 +109,10 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
static bool ShouldHonorThemeScrollbarColors();
mozilla::Maybe<ColorScheme> ComputeColorSchemeSetting();
+#ifdef MOZ_ENABLE_DBUS
void WatchDBus();
void UnwatchDBus();
+#endif
// We use up to two themes (one light, one dark), which might have different
// sets of fonts and colors.