X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4eccf53dd554235876dccd4e37331d64427e84c4..0c75b29e1ed19810546de38b646b5b901be873e2:/src/gtk/win_gtk.cpp?ds=sidebyside diff --git a/src/gtk/win_gtk.cpp b/src/gtk/win_gtk.cpp index 1ad4efd4d2..841c01225f 100644 --- a/src/gtk/win_gtk.cpp +++ b/src/gtk/win_gtk.cpp @@ -8,7 +8,8 @@ /////////////////////////////////////////////////////////////////////////////// #include "wx/defs.h" -#include "wx/gtk/win_gtk.h" +#include "wx/gtk/private.h" +#include "wx/gtk/private/win_gtk.h" /* wxPizza is a custom GTK+ widget derived from GtkFixed. A custom widget @@ -341,6 +342,30 @@ void wxPizza::move(GtkWidget* widget, int x, int y) } } +struct AdjustData { + GdkWindow* window; + int dx, dy; +}; + +// Adjust allocations for all widgets using the GdkWindow which was just scrolled +extern "C" { +static void scroll_adjust(GtkWidget* widget, void* data) +{ + const AdjustData* p = static_cast(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_no_redraw(widget); + if (GTK_IS_CONTAINER(widget)) + gtk_container_forall(GTK_CONTAINER(widget), scroll_adjust, data); + } +} +} + void wxPizza::scroll(int dx, int dy) { GtkWidget* widget = GTK_WIDGET(this); @@ -349,18 +374,15 @@ void wxPizza::scroll(int dx, int dy) m_scroll_x -= dx; m_scroll_y -= dy; if (widget->window) - gdk_window_scroll(widget->window, dx, dy); - const GList* list = m_fixed.children; - if (list) { - const GtkFixedChild* child = static_cast(list->data); - // queueing a resize on any child will update them all - gtk_widget_queue_resize(child->widget); + gdk_window_scroll(widget->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. + AdjustData data = { widget->window, dx, dy }; + gtk_container_forall(GTK_CONTAINER(widget), scroll_adjust, &data); } } -extern GtkWidget *GetEntryWidget(); - void wxPizza::get_border_widths(int& x, int& y) { x = y = 0; @@ -368,7 +390,7 @@ void wxPizza::get_border_widths(int& x, int& y) x = y = 1; else if (m_border_style) { - GtkWidget *entry_widget = GetEntryWidget(); + GtkWidget *entry_widget = wxGTKPrivate::GetEntryWidget(); if (entry_widget->style) { x = entry_widget->style->xthickness;