fix child window redraw glitches during scrolling (bug 1944002)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2008-04-20 22:44:17 +00:00
parent 2e1f8b15ae
commit c60eb134fd

View File

@@ -682,21 +682,41 @@ gtk_pizza_allocate_child (GtkPizza *pizza,
gtk_widget_size_allocate (child->widget, &allocation);
}
typedef struct {
GdkWindow* window;
int dx, dy;
} AdjustData;
// Adjust allocations for all widgets using the GdkWindow which was just scrolled
static void scroll_adjust(GtkWidget* widget, void* data)
{
const AdjustData* p = data;
if (widget->window == p->window)
{
widget->allocation.x += p->dx;
widget->allocation.y += p->dy;
// GtkFrame requires a queue_resize, otherwise parts of
// the frame newly exposed by the scroll are not drawn.
// To be safe, do it for all widgets.
gtk_widget_queue_resize(widget);
if (GTK_IS_CONTAINER(widget))
gtk_container_forall(GTK_CONTAINER(widget), scroll_adjust, data);
}
}
void
gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
{
GList *tmp_list;
pizza->m_xoffset += dx;
pizza->m_yoffset += dy;
if (pizza->bin_window)
gdk_window_scroll( pizza->bin_window, -dx, -dy );
for (tmp_list = pizza->children; tmp_list; tmp_list = tmp_list->next)
{
GtkPizzaChild *child = tmp_list->data;
gtk_widget_queue_resize(child->widget);
AdjustData data = { pizza->bin_window, -dx, -dy };
gdk_window_scroll( pizza->bin_window, -dx, -dy );
// Adjust child allocations. Doing a queue_resize on the children is not
// enough, sometimes they redraw in the wrong place during fast scrolling.
gtk_container_forall(GTK_CONTAINER(pizza), scroll_adjust, &data);
}
}