Commit 93d68270 authored by Daniel Boles's avatar Daniel Boles

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
parent 16b9e826
......@@ -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)
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)
/* 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 +=;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment