From 2ae6f1a74112705ce8b5c7c0305ac4232c088f17 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 22 May 2019 19:24:24 +0000 Subject: [PATCH] Add a gtk-overlay-scrolling setting This is in preparation for letting user opt out of overlay scrolling in the control-center. --- gdk/wayland/gdkdisplay-wayland.c | 3 ++- gdk/x11/gdksettings.c | 1 + gtk/gtksettings.c | 19 ++++++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index a5370ebeeb..eb46fa42af 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -1627,6 +1627,7 @@ static TranslationEntry translations[] = { { FALSE, "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } }, { FALSE, "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE } }, { FALSE, "org.gnome.desktop.interface", "gtk-enable-primary-paste", "gtk-enable-primary-paste", G_TYPE_BOOLEAN, { .b = TRUE } }, + { FALSE, "org.gnome.desktop.interface", "overlay-scrolling", "gtk-overlay-scrolling", G_TYPE_BOOLEAN, { .b = TRUE } }, { FALSE, "org.gnome.settings-daemon.peripherals.mouse", "double-click", "gtk-double-click-time", G_TYPE_INT, { .i = 400 } }, { FALSE, "org.gnome.settings-daemon.peripherals.mouse", "drag-threshold", "gtk-dnd-drag-threshold", G_TYPE_INT, {.i = 8 } }, { FALSE, "org.gnome.desktop.sound", "theme-name", "gtk-sound-theme-name", G_TYPE_STRING, { .s = "freedesktop" } }, @@ -1644,7 +1645,7 @@ static TranslationEntry translations[] = { { FALSE, "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } }, { FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } }, { FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } }, - { FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } } + { FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } }, }; diff --git a/gdk/x11/gdksettings.c b/gdk/x11/gdksettings.c index c07df4c05e..3fe596f49e 100644 --- a/gdk/x11/gdksettings.c +++ b/gdk/x11/gdksettings.c @@ -66,6 +66,7 @@ static const struct { {"Gtk/RecentFilesMaxAge", "gtk-recent-files-max-age"}, {"Gtk/RecentFilesEnabled", "gtk-recent-files-enabled"}, {"Gtk/KeynavUseCaret", "gtk-keynav-use-caret"}, + {"Gtk/OverlayScrolling", "gtk-overlay-scrolling"}, /* These are here in order to be recognized, but are not sent to gtk as they are handled internally by gdk: */ diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index 18c3fd4eb0..77aeb3bf1b 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -191,7 +191,8 @@ enum { PROP_ENABLE_PRIMARY_PASTE, PROP_RECENT_FILES_ENABLED, PROP_LONG_PRESS_TIME, - PROP_KEYNAV_USE_CARET + PROP_KEYNAV_USE_CARET, + PROP_OVERLAY_SCROLLING }; /* --- prototypes --- */ @@ -1002,6 +1003,22 @@ gtk_settings_class_init (GtkSettingsClass *class) GTK_PARAM_READWRITE), NULL); g_assert (result == PROP_KEYNAV_USE_CARET); + + /** + * GtkSettings:gtk-overlay-scrolling: + * + * Whether scrolled windows may use overlayed scrolling indicators. + * If this is set to %FALSE, scrolled windows will have permanent + * scrollbars. + */ + result = settings_install_property_parser (class, + g_param_spec_boolean ("gtk-overlay-scrolling", + P_("Whether to use overlay scrollbars"), + P_("Whether to use overlay scrollbars"), + TRUE, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_OVERLAY_SCROLLING); } static GtkSettings *