[gtk+] ScrolledWindow—Don’t req size for auto-hidden bars



commit 901e5ff3a36b74b8ae4c19f4f20e84bc70b44913
Author: Daniel Boles <dboles src gnome org>
Date:   Fri Feb 17 19:48:42 2017 +0000

    ScrolledWindow—Don’t req size for auto-hidden bars
    
    POLICY_AUTOMATIC means scrollbars are only shown when needed, i.e. when
    the size of the window is not large enough to show the entire child. So
    when measuring the preferred size, such scrollbars should be ignored.
    
    But measure() was adding size for bars for which policy_may_be_visible()
    was TRUE, which it returns for POLICY_ALWAYS (good) & _AUTOMATIC (bad).
    So we reserved space for child plus scrollbars, & because we have enough
    space for the child, POLICY_AUTOMATIC hides the scrollbar, leaving the
    extra reserved space empty at the right/bottom sides of the child. This
    is very noticeable/inconvenient for non-overlay, automatic scrollbars.
    
    Fix this by only requesting size for scrollbars that use POLICY_ALWAYS,
    rather than basing the decision on policy_may_be_visible().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778853

 gtk/gtkscrolledwindow.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index b51875c..238f1dc 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1784,7 +1784,7 @@ gtk_scrolled_window_measure (GtkCssGadget   *gadget,
    * Now add to the requisition any additional space for surrounding scrollbars
    * and the special scrollable border.
    */
-  if (policy_may_be_visible (priv->hscrollbar_policy))
+  if (priv->hscrollbar_policy == GTK_POLICY_ALWAYS)
     {
       minimum_req.width = MAX (minimum_req.width, hscrollbar_requisition.width + sborder.left + 
sborder.right);
       natural_req.width = MAX (natural_req.width, hscrollbar_requisition.width + sborder.left + 
sborder.right);
@@ -1796,7 +1796,7 @@ gtk_scrolled_window_measure (GtkCssGadget   *gadget,
        }
     }
 
-  if (policy_may_be_visible (priv->vscrollbar_policy))
+  if (priv->vscrollbar_policy == GTK_POLICY_ALWAYS)
     {
       minimum_req.height = MAX (minimum_req.height, vscrollbar_requisition.height + sborder.top + 
sborder.bottom);
       natural_req.height = MAX (natural_req.height, vscrollbar_requisition.height + sborder.top + 
sborder.bottom);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]