]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/win_gtk.cpp
don't use wxVector<wxDataFormat> from wx/clipbrd.h as wxDataFormat definition is...
[wxWidgets.git] / src / gtk / win_gtk.cpp
index 62bf3e424b517837bcd4bfa2ba2d9f581d7be766..7243df8692f4983997cf1522135155fa1c9142a2 100644 (file)
@@ -47,8 +47,6 @@ static void size_allocate(GtkWidget* widget, GtkAllocation* alloc)
         widget->allocation.x != alloc->x ||
         widget->allocation.y != alloc->y;
 
-    widget->allocation = *alloc;
-
     wxPizza* pizza = WX_PIZZA(widget);
     int border_x, border_y;
     pizza->get_border_widths(border_x, border_y);
@@ -73,8 +71,23 @@ static void size_allocate(GtkWidget* widget, GtkAllocation* alloc)
             // one window
             gdk_window_move_resize(widget->window,
                 alloc->x + border_x, alloc->y + border_y, w, h);
+
+            if (is_resize && (border_x || border_y))
+            {
+                // old and new border areas need to be invalidated,
+                // otherwise they will not be erased/redrawn properly
+                const GtkAllocation& a1 = widget->allocation;
+                const GtkAllocation& a2 = *alloc;
+                GdkRectangle r1 = { a1.x, a1.y, a1.width, a1.height };
+                GdkRectangle r2 = { a2.x, a2.y, a2.width, a2.height };
+                gdk_window_invalidate_rect(widget->parent->window, &r1, false);
+                gdk_window_invalidate_rect(widget->parent->window, &r2, false);
+            }
         }
     }
+
+    widget->allocation = *alloc;
+
     // adjust child positions
     for (const GList* list = pizza->m_fixed.children; list; list = list->next)
     {
@@ -326,10 +339,11 @@ extern "C" {
 static void scroll_adjust(GtkWidget* widget, void* data)
 {
     const AdjustData* p = static_cast<AdjustData*>(data);
+    widget->allocation.x += p->dx;
+    widget->allocation.y += p->dy;
+    
     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.