[epiphany/wip/exalm/scrollbar] embed-shell: Don't use system scrollbar for Adwaita
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/exalm/scrollbar] embed-shell: Don't use system scrollbar for Adwaita
- Date: Sat, 14 Aug 2021 10:14:42 +0000 (UTC)
commit c9d350d00bad1cf02d412dd48e6f4a700d8294be
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Aug 14 15:09:10 2021 +0500
embed-shell: Don't use system scrollbar for Adwaita
WebKit's custom scrollbar looks similar enough, and provides extra features
on top, such as becoming dark for dark pages.
embed/ephy-embed-shell.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
---
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 63da08954..0d3002b80 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -887,6 +887,27 @@ enable_itp_setting_changed_cb (GSettings *settings,
EPHY_PREFS_WEB_ENABLE_ITP));
}
+static void
+update_system_scrollbars (EphyEmbedShell *shell)
+{
+ EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
+ const char *theme_name;
+ gboolean enabled;
+
+ g_object_get (gtk_settings_get_default (),
+ "gtk-theme_name", &theme_name,
+ NULL);
+
+ /* Don't enable system scrollbars for Adwaita */
+ enabled = g_strcmp0 (theme_name, "Adwaita") &&
+ g_strcmp0 (theme_name, "Adwaita-dark") &&
+ g_strcmp0 (theme_name, "HighContrast") &&
+ g_strcmp0 (theme_name, "HighContrastInverse");
+
+ webkit_web_context_set_use_system_appearance_for_scrollbars (priv->web_context,
+ enabled);
+}
+
static void
ephy_embed_shell_startup (GApplication *application)
{
@@ -979,6 +1000,13 @@ ephy_embed_shell_startup (GApplication *application)
g_signal_connect_object (EPHY_SETTINGS_WEB, "changed::enable-itp",
G_CALLBACK (enable_itp_setting_changed_cb), shell, 0);
+
+ update_system_scrollbars (shell);
+
+ g_signal_connect_swapped (gtk_settings_get_default (),
+ "notify::gtk-theme-name",
+ G_CALLBACK (update_system_scrollbars),
+ shell);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]