[gtk+/gtk-3-22] ScrolledWindow: Don’t check if child is Scrollable
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] ScrolledWindow: Don’t check if child is Scrollable
- Date: Mon, 20 Mar 2017 23:26:22 +0000 (UTC)
commit 93d68270c468c5102e6dac795b4aa1ed43ba9627
Author: Daniel Boles <dboles src gnome org>
Date: Fri Mar 10 20:37:27 2017 +0000
ScrolledWindow: Don’t check if child is Scrollable
If the child added is not a Scrollable, it gets wrapped in a ViewPort –
which is. So it is impossible to end up with a non-Scrollable child.
Just check we have /any/ child where needed, which is semantically nicer
https://bugzilla.gnome.org/show_bug.cgi?id=778853
gtk/gtkscrolledwindow.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 7fec8b0..69faa06 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1545,12 +1545,13 @@ gtk_scrolled_window_allocate (GtkCssGadget *gadget,
gboolean previous_hvis;
gboolean previous_vvis;
guint count = 0;
+ GtkScrollable *scrollable_child = GTK_SCROLLABLE (child);
- hscroll_policy = GTK_IS_SCROLLABLE (child)
- ? gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (child))
+ hscroll_policy = scrollable_child != NULL
+ ? gtk_scrollable_get_hscroll_policy (scrollable_child)
: GTK_SCROLL_MINIMUM;
- vscroll_policy = GTK_IS_SCROLLABLE (child)
- ? gtk_scrollable_get_vscroll_policy (GTK_SCROLLABLE (child))
+ vscroll_policy = scrollable_child != NULL
+ ? gtk_scrollable_get_vscroll_policy (scrollable_child)
: GTK_SCROLL_MINIMUM;
/* Determine scrollbar visibility first via hfw apis */
@@ -1812,7 +1813,7 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget,
child = gtk_bin_get_child (bin);
- if (GTK_IS_SCROLLABLE (child))
+ if (child)
gtk_scrollable_get_border (GTK_SCROLLABLE (child), &sborder);
/*
@@ -2284,7 +2285,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
gtk_scrolled_window_adjustment_value_changed (hadjustment, scrolled_window);
child = gtk_bin_get_child (bin);
- if (GTK_IS_SCROLLABLE (child))
+ if (child)
gtk_scrollable_set_hadjustment (GTK_SCROLLABLE (child), hadjustment);
if (gtk_widget_should_animate (GTK_WIDGET (scrolled_window)))
@@ -2352,7 +2353,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
gtk_scrolled_window_adjustment_value_changed (vadjustment, scrolled_window);
child = gtk_bin_get_child (bin);
- if (GTK_IS_SCROLLABLE (child))
+ if (child)
gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (child), vadjustment);
if (gtk_widget_should_animate (GTK_WIDGET (scrolled_window)))
@@ -2969,8 +2970,7 @@ gtk_scrolled_window_inner_allocation (GtkWidget *widget,
gtk_scrolled_window_relative_allocation (widget, rect);
child = gtk_bin_get_child (GTK_BIN (widget));
- if (GTK_IS_SCROLLABLE (child) &&
- gtk_scrollable_get_border (GTK_SCROLLABLE (child), &border))
+ if (child && gtk_scrollable_get_border (GTK_SCROLLABLE (child), &border))
{
rect->x += border.left;
rect->y += border.top;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]