+ gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, &gdk_rect, TRUE );
+ }
+ else
+ {
+ gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, NULL, TRUE );
+ }
+ }
+#endif
+}
+
+void wxWindowGTK::Update()
+{
+#ifdef __WXGTK20__
+ if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window)
+ gdk_window_process_updates( GTK_PIZZA(m_wxwindow)->bin_window, FALSE );
+#endif
+
+ if (!m_updateRegion.IsEmpty())
+ GtkSendPaintEvents();
+}
+
+void wxWindowGTK::GtkSendPaintEvents()
+{
+ if (!m_wxwindow)
+ {
+ m_clearRegion.Clear();
+ m_updateRegion.Clear();
+ return;
+ }
+
+ m_clipPaintRegion = TRUE;
+
+ // if (!m_clearRegion.IsEmpty()) // always send an erase event
+ {
+ wxWindowDC dc( (wxWindow*)this );
+ dc.SetClippingRegion( m_clearRegion );
+
+ wxEraseEvent erase_event( GetId(), &dc );
+ erase_event.SetEventObject( this );
+
+ if (!GetEventHandler()->ProcessEvent(erase_event))
+ {
+ gdk_gc_set_foreground( g_eraseGC, m_backgroundColour.GetColor() );
+
+ wxRegionIterator upd( m_clearRegion );
+ while (upd)
+ {
+ gdk_draw_rectangle( GTK_PIZZA(m_wxwindow)->bin_window, g_eraseGC, 0,
+ upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
+ upd ++;
+ }
+ }
+ m_clearRegion.Clear();
+ }
+
+ wxNcPaintEvent nc_paint_event( GetId() );
+ nc_paint_event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( nc_paint_event );
+
+ wxPaintEvent paint_event( GetId() );
+ paint_event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( paint_event );
+
+ m_clipPaintRegion = FALSE;
+
+#ifndef __WXUNIVERSAL__
+#ifndef __WXGTK20__
+ // The following code will result in all window-less widgets
+ // being redrawn because the wxWindows class is allowed to
+ // paint over the window-less widgets.
+
+ GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
+
+ GList *children = pizza->children;
+ while (children)
+ {
+ GtkPizzaChild *child = (GtkPizzaChild*) children->data;
+ children = children->next;
+
+ if (GTK_WIDGET_NO_WINDOW (child->widget) &&
+ GTK_WIDGET_DRAWABLE (child->widget))
+ {
+ // Get intersection of widget area and update region
+ wxRegion region( m_updateRegion );
+
+ GdkEventExpose gdk_event;
+ gdk_event.type = GDK_EXPOSE;
+ gdk_event.window = pizza->bin_window;
+ gdk_event.count = 0;
+
+ wxRegionIterator upd( m_updateRegion );
+ while (upd)
+ {
+ GdkRectangle rect;
+ rect.x = upd.GetX();
+ rect.y = upd.GetY();
+ rect.width = upd.GetWidth();
+ rect.height = upd.GetHeight();
+
+ if (gtk_widget_intersect (child->widget, &rect, &gdk_event.area))
+ {
+ gtk_widget_event (child->widget, (GdkEvent*) &gdk_event);
+ }
+
+ upd ++;
+ }