Diff
Modified: trunk/Source/WebKit/ChangeLog (280076 => 280077)
--- trunk/Source/WebKit/ChangeLog 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/ChangeLog 2021-07-20 11:08:00 UTC (rev 280077)
@@ -1,3 +1,89 @@
+2021-07-20 Alexander Mikhaylenko <[email protected]>
+
+ [GTK] Propagate GtkSettings to web process
+ https://bugs.webkit.org/show_bug.cgi?id=227854
+
+ Reviewed by Carlos Garcia Campos.
+
+ There's a number of properties in GtkSettings that web process uses:
+
+ - gtk-cursor-blink
+ - gtk-cursor-blink-time
+ - gtk-font-name
+ - gtk-primary-button-warps-slider
+ - gtk-theme-name
+ - gtk-xft-antialias
+ - gtk-xft-dpi
+ - gtk-xft-hinting
+ - gtk-xft-hintstyle
+ - gtk-xft-rgba
+
+ While we do propagate gtk-theme-name, we don't do it for any of the other settings.
+ This means that they can only be fetched from XSettings/GSettings/settings portal
+ by GTK itself, but if the app changes them or if they are changed from inspector,
+ web processes won't see that.
+
+ Introduce GtkSettingsManager as a specific place that listens to preferences
+ changes and notifies the web process, where GtkSettingsManagerProxy updates
+ GtkSettings on that side. Keep the dark mode preference separate since there's
+ existing cross-platform infrastructure for it.
+
+ Apply settings after reinitializing as well, it was only done after initialization
+ so failed with PSON.
+
+ * PlatformGTK.cmake:
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode const):
+ (WebKit::WebPageCreationParameters::decode):
+ * Shared/WebPageCreationParameters.h:
+ * Shared/gtk/GtkSettingsState.cpp: Added.
+ (WebKit::GtkSettingsState::encode const):
+ (WebKit::GtkSettingsState::decode):
+ * Shared/gtk/GtkSettingsState.h: Added.
+ * Shared/gtk/NativeWebTouchEventGtk.cpp:
+ * SourcesGTK.txt:
+ * UIProcess/API/gtk/PageClientImpl.cpp:
+ * UIProcess/API/gtk/PageClientImpl.h:
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (webkitWebViewBaseSetToplevelOnScreenWindow):
+ (webkitWebViewBaseRoot):
+ (webkitWebViewBaseUnroot):
+ (webkitWebViewBaseConstructed):
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::creationParameters):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/gtk/GtkSettingsManager.cpp: Added.
+ (WebKit::GtkSettingsManager::singleton):
+ (WebKit::GtkSettingsManager::themeName const):
+ (WebKit::GtkSettingsManager::fontName const):
+ (WebKit::GtkSettingsManager::xftAntialias const):
+ (WebKit::GtkSettingsManager::xftHinting const):
+ (WebKit::GtkSettingsManager::xftHintStyle const):
+ (WebKit::GtkSettingsManager::xftRGBA const):
+ (WebKit::GtkSettingsManager::xftDPI const):
+ (WebKit::GtkSettingsManager::cursorBlink const):
+ (WebKit::GtkSettingsManager::cursorBlinkTime const):
+ (WebKit::GtkSettingsManager::primaryButtonWarpsSlider const):
+ (WebKit::GtkSettingsManager::settingsDidChange):
+ (WebKit::GtkSettingsManager::GtkSettingsManager):
+ * UIProcess/gtk/GtkSettingsManager.h: Added.
+ (WebKit::GtkSettingsManager::settingsState const):
+ * UIProcess/gtk/WebPageProxyGtk.cpp:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_appHighlightsVisible):
+ (WebKit::WebPage::reinitializeWebPage):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+ * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+ * WebProcess/gtk/GtkSettingsManagerProxy.cpp: Added.
+ (WebKit::GtkSettingsManagerProxy::singleton):
+ (WebKit::GtkSettingsManagerProxy::GtkSettingsManagerProxy):
+ (WebKit::GtkSettingsManagerProxy::settingsDidChange):
+ (WebKit::GtkSettingsManagerProxy::applySettings):
+ * WebProcess/gtk/GtkSettingsManagerProxy.h: Added.
+ * WebProcess/gtk/GtkSettingsManagerProxy.messages.in: Added.
+
2021-07-20 Víctor Manuel Jáquez Leal <[email protected]>
[GTK][WPE] Fix compilation when ATK is not used
Modified: trunk/Source/WebKit/PlatformGTK.cmake (280076 => 280077)
--- trunk/Source/WebKit/PlatformGTK.cmake 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/PlatformGTK.cmake 2021-07-20 11:08:00 UTC (rev 280077)
@@ -36,6 +36,7 @@
list(APPEND WebKit_MESSAGES_IN_FILES
UIProcess/ViewGestureController
+ WebProcess/gtk/GtkSettingsManagerProxy
WebProcess/WebPage/ViewGestureGeometryCollector
)
Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (280076 => 280077)
--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -178,7 +178,7 @@
encoder << canUseCredentialStorage;
#if PLATFORM(GTK)
- encoder << themeName;
+ encoder << gtkSettings;
#endif
encoder << httpsUpgradeEnabled;
@@ -591,7 +591,7 @@
return std::nullopt;
#if PLATFORM(GTK)
- if (!decoder.decode(parameters.themeName))
+ if (!decoder.decode(parameters.gtkSettings))
return std::nullopt;
#endif
Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (280076 => 280077)
--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h 2021-07-20 11:08:00 UTC (rev 280077)
@@ -55,6 +55,10 @@
#include <WebCore/ApplicationManifest.h>
#endif
+#if PLATFORM(GTK)
+#include "GtkSettingsState.h"
+#endif
+
namespace IPC {
class Decoder;
class Encoder;
@@ -248,7 +252,7 @@
WebCore::ShouldRelaxThirdPartyCookieBlocking shouldRelaxThirdPartyCookieBlocking { WebCore::ShouldRelaxThirdPartyCookieBlocking::No };
#if PLATFORM(GTK)
- String themeName;
+ GtkSettingsState gtkSettings;
#endif
bool httpsUpgradeEnabled { true };
Added: trunk/Source/WebKit/Shared/gtk/GtkSettingsState.cpp (0 => 280077)
--- trunk/Source/WebKit/Shared/gtk/GtkSettingsState.cpp (rev 0)
+++ trunk/Source/WebKit/Shared/gtk/GtkSettingsState.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GtkSettingsState.h"
+
+#include "ArgumentCoders.h"
+
+namespace WebKit {
+
+void GtkSettingsState::encode(IPC::Encoder& encoder) const
+{
+ encoder << themeName;
+ encoder << fontName;
+ encoder << xftAntialias;
+ encoder << xftHinting;
+ encoder << xftHintStyle;
+ encoder << xftRGBA;
+ encoder << xftDPI;
+ encoder << cursorBlink;
+ encoder << cursorBlinkTime;
+ encoder << primaryButtonWarpsSlider;
+}
+
+std::optional<GtkSettingsState> GtkSettingsState::decode(IPC::Decoder& decoder)
+{
+ GtkSettingsState state;
+
+ if (!decoder.decode(state.themeName))
+ return std::nullopt;
+
+ if (!decoder.decode(state.fontName))
+ return std::nullopt;
+
+ if (!decoder.decode(state.xftAntialias))
+ return std::nullopt;
+
+ if (!decoder.decode(state.xftHinting))
+ return std::nullopt;
+
+ if (!decoder.decode(state.xftHintStyle))
+ return std::nullopt;
+
+ if (!decoder.decode(state.xftRGBA))
+ return std::nullopt;
+
+ if (!decoder.decode(state.xftDPI))
+ return std::nullopt;
+
+ if (!decoder.decode(state.cursorBlink))
+ return std::nullopt;
+
+ if (!decoder.decode(state.cursorBlinkTime))
+ return std::nullopt;
+
+ if (!decoder.decode(state.primaryButtonWarpsSlider))
+ return std::nullopt;
+
+ return state;
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/Shared/gtk/GtkSettingsState.h (0 => 280077)
--- trunk/Source/WebKit/Shared/gtk/GtkSettingsState.h (rev 0)
+++ trunk/Source/WebKit/Shared/gtk/GtkSettingsState.h 2021-07-20 11:08:00 UTC (rev 280077)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/text/WTFString.h>
+
+namespace IPC {
+class Decoder;
+class Encoder;
+}
+
+namespace WebKit {
+
+struct GtkSettingsState {
+ GtkSettingsState() = default;
+
+ void encode(IPC::Encoder&) const;
+ static std::optional<GtkSettingsState> decode(IPC::Decoder&);
+
+ std::optional<String> themeName;
+ std::optional<String> fontName;
+ std::optional<int> xftAntialias;
+ std::optional<int> xftHinting;
+ std::optional<String> xftHintStyle;
+ std::optional<String> xftRGBA;
+ std::optional<int> xftDPI;
+ std::optional<bool> cursorBlink;
+ std::optional<int> cursorBlinkTime;
+ std::optional<bool> primaryButtonWarpsSlider;
+};
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/Shared/gtk/NativeWebTouchEventGtk.cpp (280076 => 280077)
--- trunk/Source/WebKit/Shared/gtk/NativeWebTouchEventGtk.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/Shared/gtk/NativeWebTouchEventGtk.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -28,6 +28,7 @@
#if ENABLE(TOUCH_EVENTS)
+#include <WebCore/GtkVersioning.h>
#include "WebEventFactory.h"
#include <gdk/gdk.h>
Modified: trunk/Source/WebKit/SourcesGTK.txt (280076 => 280077)
--- trunk/Source/WebKit/SourcesGTK.txt 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/SourcesGTK.txt 2021-07-20 11:08:00 UTC (rev 280077)
@@ -87,6 +87,7 @@
Shared/glib/WebContextMenuItemGlib.cpp
Shared/gtk/ArgumentCodersGtk.cpp
+Shared/gtk/GtkSettingsState.cpp
Shared/gtk/NativeWebKeyboardEventGtk.cpp
Shared/gtk/NativeWebMouseEventGtk.cpp
Shared/gtk/NativeWebTouchEventGtk.cpp
@@ -253,6 +254,7 @@
UIProcess/gtk/ClipboardGtk3.cpp @no-unify
UIProcess/gtk/ClipboardGtk4.cpp @no-unify
UIProcess/gtk/WebDateTimePickerGtk.cpp
+UIProcess/gtk/GtkSettingsManager.cpp
UIProcess/gtk/HardwareAccelerationManager.cpp
UIProcess/gtk/KeyBindingTranslator.cpp
UIProcess/gtk/PointerLockManager.cpp @no-unify
@@ -439,5 +441,6 @@
WebProcess/glib/WebProcessGLib.cpp
+WebProcess/gtk/GtkSettingsManagerProxy.cpp
WebProcess/gtk/WaylandCompositorDisplay.cpp
WebProcess/gtk/WebProcessMainGtk.cpp
Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp (280076 => 280077)
--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -594,23 +594,6 @@
webkitWebViewDidChangePageID(WEBKIT_WEB_VIEW(m_viewWidget));
}
-String PageClientImpl::themeName() const
-{
- if (auto* themeNameEnv = g_getenv("GTK_THEME")) {
- String name = String::fromUTF8(themeNameEnv);
- if (name.endsWith("-dark") || name.endsWith("-Dark") || name.endsWith(":dark"))
- return name.substring(0, name.length() - 5);
- return name;
- }
-
- GUniqueOutPtr<char> themeNameSetting;
- g_object_get(gtk_widget_get_settings(m_viewWidget), "gtk-theme-name", &themeNameSetting.outPtr(), nullptr);
- String name = String::fromUTF8(themeNameSetting.get());
- if (name.endsWith("-dark") || name.endsWith("-Dark"))
- return name.substring(0, name.length() - 5);
- return name;
-}
-
void PageClientImpl::makeViewBlank(bool makeBlank)
{
webkitWebViewBaseMakeBlank(WEBKIT_WEB_VIEW_BASE(m_viewWidget), makeBlank);
Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h (280076 => 280077)
--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2021-07-20 11:08:00 UTC (rev 280077)
@@ -176,8 +176,6 @@
void didChangeWebPageID() const override;
- String themeName() const override;
-
void makeViewBlank(bool) override;
// Members of PageClientImpl class
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (280076 => 280077)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -298,8 +298,6 @@
unsigned long toplevelWindowStateEventID { 0 };
#endif
unsigned long toplevelWindowRealizedID { 0 };
- unsigned long themeChangedID { 0 };
- unsigned long applicationPreferDarkThemeID { 0 };
// View State.
OptionSet<ActivityState::Flag> activityState;
@@ -401,16 +399,6 @@
return FALSE;
}
-static void themeChanged(WebKitWebViewBase* webViewBase)
-{
- webViewBase->priv->pageProxy->themeDidChange();
-}
-
-static void applicationPreferDarkThemeChanged(WebKitWebViewBase* webViewBase)
-{
- webViewBase->priv->pageProxy->effectiveAppearanceDidChange();
-}
-
static void toplevelWindowRealized(WebKitWebViewBase* webViewBase)
{
gtk_widget_realize(GTK_WIDGET(webViewBase));
@@ -444,17 +432,6 @@
g_signal_handler_disconnect(priv->toplevelOnScreenWindow, priv->toplevelWindowRealizedID);
priv->toplevelWindowRealizedID = 0;
}
- if (priv->themeChangedID || priv->applicationPreferDarkThemeID) {
- auto* settings = gtk_widget_get_settings(GTK_WIDGET(priv->toplevelOnScreenWindow));
- if (priv->themeChangedID) {
- g_signal_handler_disconnect(settings, priv->themeChangedID);
- priv->themeChangedID = 0;
- }
- if (priv->applicationPreferDarkThemeID) {
- g_signal_handler_disconnect(settings, priv->applicationPreferDarkThemeID);
- priv->applicationPreferDarkThemeID = 0;
- }
- }
priv->toplevelOnScreenWindow = window;
@@ -483,12 +460,6 @@
priv->toplevelWindowStateEventID =
g_signal_connect(priv->toplevelOnScreenWindow, "window-state-event", G_CALLBACK(toplevelWindowStateEvent), webViewBase);
- auto* settings = gtk_widget_get_settings(GTK_WIDGET(priv->toplevelOnScreenWindow));
- priv->themeChangedID =
- g_signal_connect_swapped(settings, "notify::gtk-theme-name", G_CALLBACK(themeChanged), webViewBase);
- priv->applicationPreferDarkThemeID =
- g_signal_connect_swapped(settings, "notify::gtk-application-prefer-dark-theme", G_CALLBACK(applicationPreferDarkThemeChanged), webViewBase);
-
if (gtk_widget_get_realized(GTK_WIDGET(window)))
gtk_widget_realize(GTK_WIDGET(webViewBase));
else
@@ -1782,16 +1753,6 @@
}
priv->toplevelWindowUnrealizedID =
g_signal_connect_swapped(priv->toplevelOnScreenWindow, "unrealize", G_CALLBACK(toplevelWindowUnrealized), widget);
-
- auto* settings = gtk_widget_get_settings(GTK_WIDGET(priv->toplevelOnScreenWindow));
- priv->themeChangedID =
- g_signal_connect_swapped(settings, "notify::gtk-theme-name", G_CALLBACK(+[](WebKitWebViewBase* webViewBase) {
- webViewBase->priv->pageProxy->themeDidChange();
- }), widget);
- priv->applicationPreferDarkThemeID =
- g_signal_connect_swapped(settings, "notify::gtk-application-prefer-dark-theme", G_CALLBACK(+[](WebKitWebViewBase* webViewBase) {
- webViewBase->priv->pageProxy->effectiveAppearanceDidChange();
- }), widget);
}
static void webkitWebViewBaseUnroot(GtkWidget* widget)
@@ -1805,9 +1766,6 @@
g_clear_signal_handler(&priv->toplevelWindowUnrealizedID, priv->toplevelOnScreenWindow);
if (gtk_widget_get_realized(GTK_WIDGET(priv->toplevelOnScreenWindow)))
g_clear_signal_handler(&priv->toplevelWindowStateChangedID, gtk_native_get_surface(GTK_NATIVE(priv->toplevelOnScreenWindow)));
- auto* settings = gtk_widget_get_settings(GTK_WIDGET(priv->toplevelOnScreenWindow));
- g_clear_signal_handler(&priv->themeChangedID, settings);
- g_clear_signal_handler(&priv->applicationPreferDarkThemeID, settings);
priv->toplevelOnScreenWindow = nullptr;
OptionSet<ActivityState::Flag> flagsToUpdate;
@@ -2155,6 +2113,13 @@
gtk_gesture_group(gesture, priv->touchGestureGroup);
gtk_gesture_single_set_touch_only(GTK_GESTURE_SINGLE(gesture), TRUE);
g_signal_connect_object(gesture, "swipe", G_CALLBACK(webkitWebViewBaseTouchSwipe), viewWidget, G_CONNECT_SWAPPED);
+
+ auto* settings = gtk_settings_get_default();
+ auto callback = +[](WebKitWebViewBase* webViewBase) {
+ webViewBase->priv->pageProxy->effectiveAppearanceDidChange();
+ };
+ g_signal_connect_object(settings, "notify::gtk-theme-name", G_CALLBACK(callback), viewWidget, G_CONNECT_SWAPPED);
+ g_signal_connect_object(settings, "notify::gtk-application-prefer-dark-theme", G_CALLBACK(callback), viewWidget, G_CONNECT_SWAPPED);
}
static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebViewBaseClass)
Modified: trunk/Source/WebKit/UIProcess/PageClient.h (280076 => 280077)
--- trunk/Source/WebKit/UIProcess/PageClient.h 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/PageClient.h 2021-07-20 11:08:00 UTC (rev 280077)
@@ -625,10 +625,6 @@
virtual void didChangeWebPageID() const { }
-#if PLATFORM(GTK)
- virtual String themeName() const = 0;
-#endif
-
#if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS)
virtual bool canHandleContextMenuTranslation() const = 0;
virtual void handleContextMenuTranslation(const WebCore::TranslationContextMenuInfo&) = 0;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (280076 => 280077)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -244,6 +244,7 @@
#endif
#if PLATFORM(GTK)
+#include "GtkSettingsManager.h"
#include <WebCore/SelectionData.h>
#endif
@@ -8232,7 +8233,7 @@
parameters.canUseCredentialStorage = m_canUseCredentialStorage;
#if PLATFORM(GTK)
- parameters.themeName = pageClient().themeName();
+ parameters.gtkSettings = GtkSettingsManager::singleton().settingsState();
#endif
#if ENABLE(ATTACHMENT_ELEMENT) && PLATFORM(COCOA)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (280076 => 280077)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-07-20 11:08:00 UTC (rev 280077)
@@ -965,7 +965,6 @@
#if PLATFORM(GTK)
PlatformViewWidget viewWidget();
bool makeGLContextCurrent();
- void themeDidChange();
#endif
const std::optional<WebCore::Color>& backgroundColor() const { return m_backgroundColor; }
Added: trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.cpp (0 => 280077)
--- trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.cpp (rev 0)
+++ trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GtkSettingsManager.h"
+
+#include "GtkSettingsManagerProxyMessages.h"
+#include "WebProcessPool.h"
+
+namespace WebKit {
+using namespace WebCore;
+
+GtkSettingsManager& GtkSettingsManager::singleton()
+{
+ static NeverDestroyed<GtkSettingsManager> manager;
+ return manager;
+}
+
+String GtkSettingsManager::themeName() const
+{
+ if (auto* themeNameEnv = g_getenv("GTK_THEME")) {
+ String name = String::fromUTF8(themeNameEnv);
+ if (name.endsWith("-dark") || name.endsWith("-Dark") || name.endsWith(":dark"))
+ return name.substring(0, name.length() - 5);
+ return name;
+ }
+
+ GUniqueOutPtr<char> themeNameSetting;
+ g_object_get(m_settings, "gtk-theme-name", &themeNameSetting.outPtr(), nullptr);
+ String name = String::fromUTF8(themeNameSetting.get());
+ if (name.endsWith("-dark") || name.endsWith("-Dark"))
+ return name.substring(0, name.length() - 5);
+ return name;
+}
+
+String GtkSettingsManager::fontName() const
+{
+ GUniqueOutPtr<char> fontNameSetting;
+ g_object_get(m_settings, "gtk-font-name", &fontNameSetting.outPtr(), nullptr);
+ return String::fromUTF8(fontNameSetting.get());
+}
+
+int GtkSettingsManager::xftAntialias() const
+{
+ int antialiasSetting;
+ g_object_get(m_settings, "gtk-xft-antialias", &antialiasSetting, nullptr);
+ return antialiasSetting;
+}
+
+int GtkSettingsManager::xftHinting() const
+{
+ int hintingSetting;
+ g_object_get(m_settings, "gtk-xft-hinting", &hintingSetting, nullptr);
+ return hintingSetting;
+}
+
+String GtkSettingsManager::xftHintStyle() const
+{
+ GUniqueOutPtr<char> hintStyleSetting;
+ g_object_get(m_settings, "gtk-xft-hintstyle", &hintStyleSetting.outPtr(), nullptr);
+ return String::fromUTF8(hintStyleSetting.get());
+}
+
+String GtkSettingsManager::xftRGBA() const
+{
+ GUniqueOutPtr<char> rgbaSetting;
+ g_object_get(m_settings, "gtk-xft-rgba", &rgbaSetting.outPtr(), nullptr);
+ return String::fromUTF8(rgbaSetting.get());
+}
+
+int GtkSettingsManager::xftDPI() const
+{
+ int dpiSetting;
+ g_object_get(m_settings, "gtk-xft-dpi", &dpiSetting, nullptr);
+ return dpiSetting;
+}
+
+bool GtkSettingsManager::cursorBlink() const
+{
+ gboolean cursorBlinkSetting;
+ g_object_get(m_settings, "gtk-cursor-blink", &cursorBlinkSetting, nullptr);
+ return cursorBlinkSetting ? true : false;
+}
+
+int GtkSettingsManager::cursorBlinkTime() const
+{
+ int cursorBlinkTimeSetting;
+ g_object_get(m_settings, "gtk-cursor-blink-time", &cursorBlinkTimeSetting, nullptr);
+ return cursorBlinkTimeSetting;
+}
+
+bool GtkSettingsManager::primaryButtonWarpsSlider() const
+{
+ gboolean buttonSetting;
+ g_object_get(m_settings, "gtk-primary-button-warps-slider", &buttonSetting, nullptr);
+ return buttonSetting ? true : false;
+}
+
+void GtkSettingsManager::settingsDidChange()
+{
+ GtkSettingsState state;
+
+ auto themeName = this->themeName();
+ if (m_settingsState.themeName != themeName)
+ m_settingsState.themeName = state.themeName = themeName;
+
+ auto fontName = this->fontName();
+ if (m_settingsState.fontName != fontName)
+ m_settingsState.fontName = state.fontName = fontName;
+
+ auto xftAntialias = this->xftAntialias();
+ if (m_settingsState.xftAntialias != xftAntialias)
+ m_settingsState.xftAntialias = state.xftAntialias = xftAntialias;
+
+ auto xftHinting = this->xftHinting();
+ if (m_settingsState.xftHinting != xftHinting)
+ m_settingsState.xftHinting = state.xftHinting = xftHinting;
+
+ auto xftHintStyle = this->xftHintStyle();
+ if (m_settingsState.xftHintStyle != xftHintStyle)
+ m_settingsState.xftHintStyle = state.xftHintStyle = xftHintStyle;
+
+ auto xftRGBA = this->xftRGBA();
+ if (m_settingsState.xftRGBA != xftRGBA)
+ m_settingsState.xftRGBA = state.xftRGBA = xftRGBA;
+
+ auto xftDPI = this->xftDPI();
+ if (m_settingsState.xftDPI != xftDPI)
+ m_settingsState.xftDPI = state.xftDPI = xftDPI;
+
+ auto cursorBlink = this->cursorBlink();
+ if (m_settingsState.cursorBlink != cursorBlink)
+ m_settingsState.cursorBlink = state.cursorBlink = cursorBlink;
+
+ auto cursorBlinkTime = this->cursorBlinkTime();
+ if (m_settingsState.cursorBlinkTime != cursorBlinkTime)
+ m_settingsState.cursorBlinkTime = state.cursorBlinkTime = cursorBlinkTime;
+
+ auto primaryButtonWarpsSlider = this->primaryButtonWarpsSlider();
+ if (m_settingsState.primaryButtonWarpsSlider != primaryButtonWarpsSlider)
+ m_settingsState.primaryButtonWarpsSlider = state.primaryButtonWarpsSlider = primaryButtonWarpsSlider;
+
+ for (auto& processPool : WebProcessPool::allProcessPools())
+ processPool->sendToAllProcesses(Messages::GtkSettingsManagerProxy::SettingsDidChange(state));
+}
+
+GtkSettingsManager::GtkSettingsManager()
+ : m_settings(gtk_settings_get_default())
+{
+ auto settingsChangedCallback = +[](GtkSettingsManager* settingsManager) {
+ settingsManager->settingsDidChange();
+ };
+
+ m_settingsState.themeName = themeName();
+ m_settingsState.fontName = fontName();
+ m_settingsState.xftAntialias = xftAntialias();
+ m_settingsState.xftHinting = xftHinting();
+ m_settingsState.xftHintStyle = xftHintStyle();
+ m_settingsState.xftRGBA = xftRGBA();
+ m_settingsState.xftDPI = xftDPI();
+ m_settingsState.cursorBlink = cursorBlink();
+ m_settingsState.cursorBlinkTime = cursorBlinkTime();
+ m_settingsState.primaryButtonWarpsSlider = primaryButtonWarpsSlider();
+
+ g_signal_connect_swapped(m_settings, "notify::gtk-theme-name", G_CALLBACK(settingsChangedCallback), this);
+ g_signal_connect_swapped(m_settings, "notify::gtk-font-name", G_CALLBACK(settingsChangedCallback), this);
+ g_signal_connect_swapped(m_settings, "notify::gtk-xft-antialias", G_CALLBACK(settingsChangedCallback), this);
+ g_signal_connect_swapped(m_settings, "notify::gtk-xft-dpi", G_CALLBACK(settingsChangedCallback), this);
+ g_signal_connect_swapped(m_settings, "notify::gtk-xft-hinting", G_CALLBACK(settingsChangedCallback), this);
+ g_signal_connect_swapped(m_settings, "notify::gtk-xft-hintstyle", G_CALLBACK(settingsChangedCallback), this);
+ g_signal_connect_swapped(m_settings, "notify::gtk-xft-rgba", G_CALLBACK(settingsChangedCallback), this);
+ g_signal_connect_swapped(m_settings, "notify::gtk-cursor-blink", G_CALLBACK(settingsChangedCallback), this);
+ g_signal_connect_swapped(m_settings, "notify::gtk-cursor-blink-time", G_CALLBACK(settingsChangedCallback), this);
+ g_signal_connect_swapped(m_settings, "notify::gtk-primary-button-warps-slider", G_CALLBACK(settingsChangedCallback), this);
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.h (0 => 280077)
--- trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/gtk/GtkSettingsManager.h 2021-07-20 11:08:00 UTC (rev 280077)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "GtkSettingsState.h"
+#include <gtk/gtk.h>
+#include <wtf/NeverDestroyed.h>
+
+namespace WebKit {
+
+class GtkSettingsManager {
+ WTF_MAKE_NONCOPYABLE(GtkSettingsManager);
+ friend NeverDestroyed<GtkSettingsManager>;
+public:
+ static GtkSettingsManager& singleton();
+
+ const GtkSettingsState& settingsState() const { return m_settingsState; }
+private:
+ GtkSettingsManager();
+
+ void settingsDidChange();
+
+ String themeName() const;
+ String fontName() const;
+ int xftAntialias() const;
+ int xftHinting() const;
+ String xftHintStyle() const;
+ String xftRGBA() const;
+ int xftDPI() const;
+ bool cursorBlink() const;
+ int cursorBlinkTime() const;
+ bool primaryButtonWarpsSlider() const;
+
+ GtkSettings* m_settings;
+ GtkSettingsState m_settingsState;
+};
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp (280076 => 280077)
--- trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -97,13 +97,4 @@
sendMessageToWebViewWithReply(WTFMove(message), [](UserMessage&&) { });
}
-void WebPageProxy::themeDidChange()
-{
- if (!hasRunningProcess())
- return;
-
- send(Messages::WebPage::ThemeDidChange(pageClient().themeName()));
- effectiveAppearanceDidChange();
-}
-
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (280076 => 280077)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -310,6 +310,7 @@
#endif
#if PLATFORM(GTK)
+#include "GtkSettingsManagerProxy.h"
#include "WebPrintOperationGtk.h"
#include <WebCore/SelectionData.h>
#include <gtk/gtk.h>
@@ -734,7 +735,7 @@
setPaginationLineGridEnabled(parameters.paginationLineGridEnabled);
#if PLATFORM(GTK)
- themeDidChange(WTFMove(parameters.themeName));
+ GtkSettingsManagerProxy::singleton().applySettings(WTFMove(parameters.gtkSettings));
#endif
effectiveAppearanceDidChange(parameters.useDarkAppearance, parameters.useElevatedUserInterfaceLevel);
@@ -969,6 +970,10 @@
if (m_layerHostingMode != parameters.layerHostingMode)
setLayerHostingMode(parameters.layerHostingMode);
+#if PLATFORM(GTK)
+ GtkSettingsManagerProxy::singleton().applySettings(WTFMove(parameters.gtkSettings));
+#endif
+
platformReinitialize();
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (280076 => 280077)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-07-20 11:08:00 UTC (rev 280077)
@@ -896,8 +896,6 @@
#if PLATFORM(GTK)
void collapseSelectionInFrame(WebCore::FrameIdentifier);
void showEmojiPicker(WebCore::Frame&);
-
- void themeDidChange(String&&);
#endif
void didApplyStyle();
@@ -2340,10 +2338,6 @@
String m_processDisplayName;
WebCore::AllowsContentJavaScript m_allowsContentJavaScriptFromMostRecentNavigation { WebCore::AllowsContentJavaScript::Yes };
-#if PLATFORM(GTK)
- String m_themeName;
-#endif
-
#if ENABLE(APP_BOUND_DOMAINS)
bool m_limitsNavigationsToAppBoundDomains { false };
bool m_navigationHasOccured { false };
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (280076 => 280077)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2021-07-20 11:08:00 UTC (rev 280077)
@@ -515,10 +515,6 @@
EffectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel)
-#if PLATFORM(GTK)
- ThemeDidChange(String themeName)
-#endif
-
#if PLATFORM(COCOA)
RequestActiveNowPlayingSessionInfo() -> (bool active, bool registeredAsNowPlayingApplication, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier) Async
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp (280076 => 280077)
--- trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp 2021-07-20 11:04:07 UTC (rev 280076)
+++ trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -45,7 +45,6 @@
#include <WebCore/PlatformKeyboardEvent.h>
#include <WebCore/PlatformScreen.h>
#include <WebCore/PointerCharacteristics.h>
-#include <WebCore/RenderTheme.h>
#include <WebCore/Settings.h>
#include <WebCore/SharedBuffer.h>
#include <WebCore/WindowsKeyboardCodes.h>
@@ -178,15 +177,4 @@
sendWithAsyncReply(Messages::WebPageProxy::ShowEmojiPicker(frame.view()->contentsToRootView(frame.selection().absoluteCaretBounds())), WTFMove(completionHandler));
}
-void WebPage::themeDidChange(String&& themeName)
-{
- if (m_themeName == themeName)
- return;
-
- m_themeName = WTFMove(themeName);
- g_object_set(gtk_settings_get_default(), "gtk-theme-name", m_themeName.utf8().data(), nullptr);
- RenderTheme::singleton().platformColorsDidChange();
- Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
-}
-
} // namespace WebKit
Added: trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.cpp (0 => 280077)
--- trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.cpp 2021-07-20 11:08:00 UTC (rev 280077)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GtkSettingsManagerProxy.h"
+
+#include "GtkSettingsManagerProxyMessages.h"
+#include <WebCore/Page.h>
+#include <WebCore/RenderTheme.h>
+
+namespace WebKit {
+using namespace WebCore;
+
+GtkSettingsManagerProxy& GtkSettingsManagerProxy::singleton()
+{
+ static NeverDestroyed<GtkSettingsManagerProxy> manager;
+ return manager;
+}
+
+GtkSettingsManagerProxy::GtkSettingsManagerProxy()
+ : m_settings(gtk_settings_get_default())
+{
+ WebProcess::singleton().addMessageReceiver(Messages::GtkSettingsManagerProxy::messageReceiverName(), *this);
+}
+
+void GtkSettingsManagerProxy::settingsDidChange(GtkSettingsState&& state)
+{
+ applySettings(WTFMove(state));
+}
+
+void GtkSettingsManagerProxy::applySettings(GtkSettingsState&& state)
+{
+ if (state.themeName) {
+ g_object_set(m_settings, "gtk-theme-name", state.fontName->utf8().data(), nullptr);
+ RenderTheme::singleton().platformColorsDidChange();
+ Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
+ }
+
+ if (state.fontName)
+ g_object_set(m_settings, "gtk-font-name", state.fontName->utf8().data(), nullptr);
+
+ if (state.xftAntialias)
+ g_object_set(m_settings, "gtk-xft-antialias", *state.xftAntialias, nullptr);
+
+ if (state.xftHinting)
+ g_object_set(m_settings, "gtk-xft-hinting", *state.xftHinting, nullptr);
+
+ if (state.xftHintStyle)
+ g_object_set(m_settings, "gtk-xft-hintstyle", state.xftHintStyle->utf8().data(), nullptr);
+
+ if (state.xftRGBA)
+ g_object_set(m_settings, "gtk-xft-rgba", state.xftRGBA->utf8().data(), nullptr);
+
+ if (state.xftDPI)
+ g_object_set(m_settings, "gtk-xft-dpi", *state.xftDPI, nullptr);
+
+ if (state.cursorBlink)
+ g_object_set(m_settings, "gtk-cursor-blink", *state.cursorBlink, nullptr);
+
+ if (state.cursorBlinkTime)
+ g_object_set(m_settings, "gtk-cursor-blink-time", *state.cursorBlinkTime, nullptr);
+
+ if (state.primaryButtonWarpsSlider)
+ g_object_set(m_settings, "gtk-primary-button-warps-slider", *state.primaryButtonWarpsSlider, nullptr);
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.h (0 => 280077)
--- trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.h 2021-07-20 11:08:00 UTC (rev 280077)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "GtkSettingsState.h"
+#include "MessageReceiver.h"
+#include <gtk/gtk.h>
+#include <wtf/NeverDestroyed.h>
+
+namespace WebKit {
+
+class GtkSettingsManagerProxy : private IPC::MessageReceiver {
+ WTF_MAKE_NONCOPYABLE(GtkSettingsManagerProxy);
+ friend NeverDestroyed<GtkSettingsManagerProxy>;
+public:
+ static GtkSettingsManagerProxy& singleton();
+
+ void applySettings(GtkSettingsState&&);
+private:
+ GtkSettingsManagerProxy();
+
+ // IPC::MessageReceiver.
+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
+
+ void settingsDidChange(GtkSettingsState&&);
+
+ GtkSettings* m_settings;
+};
+
+} // namespace WebKit
Added: trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.messages.in (0 => 280077)
--- trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.messages.in (rev 0)
+++ trunk/Source/WebKit/WebProcess/gtk/GtkSettingsManagerProxy.messages.in 2021-07-20 11:08:00 UTC (rev 280077)
@@ -0,0 +1,25 @@
+# Copyright (C) 2021 Purism SPC
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> GtkSettingsManagerProxy NotRefCounted {
+ SettingsDidChange(struct WebKit::GtkSettingsState settingsState)
+}