]> git.saurik.com Git - wxWidgets.git/commitdiff
do minimal invalidations to get border to redraw properly
authorPaul Cornett <paulcor@bullseye.com>
Wed, 7 Jan 2009 05:26:25 +0000 (05:26 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Wed, 7 Jan 2009 05:26:25 +0000 (05:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57874 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/win_gtk.cpp

index 9e5a1e6ffdb183b66a9d37d5105ec1d1f97d651e..5f37b12dead833bd3e2a296980881982bdbc8f14 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,16 +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 ((border_x > 0) || (border_y > 0))
+
+            if (is_resize && (border_x || border_y))
             {
-                // Otherwise we get can redraw artefacts from
-                // the border.
-                GtkWidget *parent = gtk_widget_get_parent( widget );
-                gtk_widget_queue_draw( parent );
+                // 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;
+                const GdkRectangle r1 = { a1.x, a1.y, a1.width, a1.height };
+                const 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)
     {