Merge branch 'overlay-scrolling-setting' into 'master'

Overlay scrolling setting

See merge request GNOME/gtk!873
This commit is contained in:
Matthias Clasen 2019-05-31 15:32:49 +00:00
commit 173ffbb547
4 changed files with 30 additions and 3 deletions

View File

@ -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 } },
};

View File

@ -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: */

View File

@ -635,6 +635,9 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
* scrollbars are only added as traditional widgets when a mouse
* is present. Otherwise, they are overlayed on top of the content,
* as narrow indicators.
*
* Note that overlay scrolling can also be globally disabled, with
* the #GtkSettings::gtk-overlay-scrolling setting.
*/
properties[PROP_OVERLAY_SCROLLING] =
g_param_spec_boolean ("overlay-scrolling",
@ -3606,6 +3609,7 @@ gtk_scrolled_window_map (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->map (widget);
gtk_scrolled_window_update_animating (scrolled_window);
gtk_scrolled_window_update_use_indicators (scrolled_window);
}
static void
@ -3833,8 +3837,12 @@ gtk_scrolled_window_update_use_indicators (GtkScrolledWindow *scrolled_window)
{
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
gboolean use_indicators;
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (scrolled_window));
gboolean overlay_scrolling;
use_indicators = priv->overlay_scrolling;
g_object_get (settings, "gtk-overlay-scrolling", &overlay_scrolling, NULL);
use_indicators = overlay_scrolling && priv->overlay_scrolling;
if (priv->use_indicators != use_indicators)
{

View File

@ -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 *