From 00bfb206eecfa3191063ed3bbf99370ce1770d7c Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Wed, 20 Sep 2006 15:02:01 +0000 Subject: [PATCH] always update the bin_window position and size in size_allocate, even if Wed Sep 20 16:59:38 2006 Tim Janik * gtk/gtkviewport.c: always update the bin_window position and size in size_allocate, even if we don't have a visible child. this fixes expose artefacts as described in #313508. * gtk/gtkscrolledwindow.c: make hiding of automatic scrollbars when we have no visible child explicit. --- ChangeLog | 9 +++++++++ gtk/gtkscrolledwindow.c | 6 +++++- gtk/gtkviewport.c | 40 +++++++++++++++------------------------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index a772038b3c..e93961289d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed Sep 20 16:59:38 2006 Tim Janik + + * gtk/gtkviewport.c: always update the bin_window position and size + in size_allocate, even if we don't have a visible child. this fixes + expose artefacts as described in #313508. + + * gtk/gtkscrolledwindow.c: make hiding of automatic scrollbars when we + have no visible child explicit. + 2006-09-19 Ryan Lortie * docs/reference/gdk/gdk-sections.txt: diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index a1b59b8e19..d130b399ad 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1348,7 +1348,11 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget, previous_vvis != scrolled_window->vscrollbar_visible); } else - gtk_scrolled_window_relative_allocation (widget, &relative_allocation); + { + scrolled_window->hscrollbar_visible = scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS; + scrolled_window->vscrollbar_visible = scrolled_window->vscrollbar_policy == GTK_POLICY_ALWAYS; + gtk_scrolled_window_relative_allocation (widget, &relative_allocation); + } if (scrolled_window->hscrollbar_visible) { diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 3d18da0c2c..eb123094c9 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -734,9 +734,9 @@ gtk_viewport_size_allocate (GtkWidget *widget, GtkBin *bin = GTK_BIN (widget); gint border_width = GTK_CONTAINER (widget)->border_width; gboolean hadjustment_value_changed, vadjustment_value_changed; - GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport); GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport); + GtkAllocation child_allocation; /* If our size changed, and we have a shadow, queue a redraw on widget->window to * redraw the shadow correctly. @@ -748,47 +748,37 @@ gtk_viewport_size_allocate (GtkWidget *widget, gdk_window_invalidate_rect (widget->window, NULL, FALSE); widget->allocation = *allocation; - + viewport_set_hadjustment_values (viewport, &hadjustment_value_changed); viewport_set_vadjustment_values (viewport, &vadjustment_value_changed); - + + child_allocation.x = 0; + child_allocation.y = 0; + child_allocation.width = hadjustment->upper; + child_allocation.height = vadjustment->upper; if (GTK_WIDGET_REALIZED (widget)) { GtkAllocation view_allocation; - - viewport_get_view_allocation (viewport, &view_allocation); - gdk_window_move_resize (widget->window, allocation->x + border_width, allocation->y + border_width, allocation->width - border_width * 2, allocation->height - border_width * 2); - + + viewport_get_view_allocation (viewport, &view_allocation); gdk_window_move_resize (viewport->view_window, view_allocation.x, view_allocation.y, view_allocation.width, view_allocation.height); + gdk_window_move_resize (viewport->bin_window, + - hadjustment->value, + - vadjustment->value, + child_allocation.width, + child_allocation.height); } - if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) - { - GtkAllocation child_allocation; - - child_allocation.x = 0; - child_allocation.y = 0; - child_allocation.width = hadjustment->upper; - child_allocation.height = vadjustment->upper; - - if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize (viewport->bin_window, - - hadjustment->value, - - vadjustment->value, - child_allocation.width, - child_allocation.height); - - gtk_widget_size_allocate (bin->child, &child_allocation); - } + gtk_widget_size_allocate (bin->child, &child_allocation); gtk_adjustment_changed (hadjustment); gtk_adjustment_changed (vadjustment);