scrolled window: respect overlay-scrolling setting

If the gtk-overlay-scrolling setting is FALSE,
don't use overlay scrollbars.
This commit is contained in:
Matthias Clasen 2019-05-22 19:34:46 +00:00
parent 2ae6f1a741
commit 97e15b8718

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)
{