fepitre / rpms / gtk3

Forked from rpms/gtk3 4 years ago
Clone

Blame SOURCES/0002-scrolled-window-respect-overlay-scrolling-setting.patch

363b49
From 26b24916c8570a73bdc9d7a736584ceb68384c81 Mon Sep 17 00:00:00 2001
363b49
From: Matthias Clasen <mclasen@redhat.com>
363b49
Date: Fri, 31 May 2019 11:51:20 -0400
363b49
Subject: [PATCH 2/2] scrolled window: respect overlay-scrolling setting
363b49
363b49
If the gtk-overlay-scrolling setting is FALSE,
363b49
don't use overlay scrollbars.
363b49
---
363b49
 gtk/gtkscrolledwindow.c | 10 +++++++++-
363b49
 1 file changed, 9 insertions(+), 1 deletion(-)
363b49
363b49
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
363b49
index d52ccf646c..b2dc1d1c79 100644
363b49
--- a/gtk/gtkscrolledwindow.c
363b49
+++ b/gtk/gtkscrolledwindow.c
363b49
@@ -704,6 +704,9 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
363b49
    * is present. Otherwise, they are overlayed on top of the content,
363b49
    * as narrow indicators.
363b49
    *
363b49
+   * Note that overlay scrolling can also be globally disabled, with
363b49
+   * the #GtkSettings::gtk-overlay-scrolling setting.
363b49
+   *
363b49
    * Since: 3.16
363b49
    */
363b49
   properties[PROP_OVERLAY_SCROLLING] =
363b49
@@ -4163,6 +4166,7 @@ gtk_scrolled_window_map (GtkWidget *widget)
363b49
   GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->map (widget);
363b49
 
363b49
   gtk_scrolled_window_update_animating (scrolled_window);
363b49
+  gtk_scrolled_window_update_use_indicators (scrolled_window);
363b49
 }
363b49
 
363b49
 static void
363b49
@@ -4439,8 +4443,12 @@ gtk_scrolled_window_update_use_indicators (GtkScrolledWindow *scrolled_window)
363b49
 {
363b49
   GtkScrolledWindowPrivate *priv = scrolled_window->priv;
363b49
   gboolean use_indicators;
363b49
+  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (scrolled_window));
363b49
+  gboolean overlay_scrolling;
363b49
+
363b49
+  g_object_get (settings, "gtk-overlay-scrolling", &overlay_scrolling, NULL);
363b49
 
363b49
-  use_indicators = priv->overlay_scrolling;
363b49
+  use_indicators = overlay_scrolling && priv->overlay_scrolling;
363b49
 
363b49
   if (g_strcmp0 (g_getenv ("GTK_OVERLAY_SCROLLING"), "0") == 0)
363b49
     use_indicators = FALSE;
363b49
-- 
363b49
2.23.0
363b49