]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/window.cpp
1. fixed bug in wxDC::SetMapMode() which broke the scrolling
[wxWidgets.git] / src / gtk / window.cpp
index 784407129e110514a4eb72837cf2fb542a0386f0..016b47c69be48934079417f3102d46f13c048542 100644 (file)
@@ -3365,14 +3365,18 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
     {
         if (m_wxwindow)
         {
-
-/*
+#if 0
             GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
             gboolean old_clear = pizza->clear_on_draw;
             gtk_pizza_set_clear( pizza, FALSE );
             gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL );
             gtk_pizza_set_clear( pizza, old_clear );
-*/
+#endif
+
+#if 1
+            // Schedule for later Updating in ::Update() or ::OnInternalIdle().
+            m_updateRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height );
+#else
             GdkEventExpose gdk_event;
             gdk_event.type = GDK_EXPOSE;
             gdk_event.window = GTK_PIZZA(m_wxwindow)->bin_window;
@@ -3382,6 +3386,7 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
             gdk_event.area.width = m_wxwindow->allocation.width;
             gdk_event.area.height = m_wxwindow->allocation.height;
             gtk_window_expose_callback( m_wxwindow, &gdk_event, (wxWindow *)this );
+#endif
         }
         else
         {
@@ -3393,7 +3398,7 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
 
         if (m_wxwindow)
         {
-/*
+#if 0
             GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
             gboolean old_clear = pizza->clear_on_draw;
             gtk_pizza_set_clear( pizza, FALSE );
@@ -3407,7 +3412,12 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
             gtk_window_draw_callback( m_wxwindow, &gdk_rect, this );
 
             gtk_pizza_set_clear( pizza, old_clear );
-*/
+#endif
+
+#if 1
+            // Schedule for later Updating in ::Update() or ::OnInternalIdle().
+            m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
+#else
             GdkEventExpose gdk_event;
             gdk_event.type = GDK_EXPOSE;
             gdk_event.window = GTK_PIZZA(m_wxwindow)->bin_window;
@@ -3417,6 +3427,7 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
             gdk_event.area.width = rect->width;
             gdk_event.area.height = rect->height;
             gtk_window_expose_callback( m_wxwindow, &gdk_event, (wxWindow *)this );
+#endif
         }
         else
         {
@@ -3434,7 +3445,7 @@ void wxWindowGTK::Update()
 {
     if (!m_updateRegion.IsEmpty())
     {
-        printf( "never gets called\n" );
+        GtkSendPaintEvents();
     }
 }
 
@@ -3442,7 +3453,7 @@ void wxWindowGTK::GtkSendPaintEvents()
 {
     m_clipPaintRegion = TRUE;
 
-    wxWindowDC dc( this );
+    wxWindowDC dc( (wxWindow*)this );
     dc.SetClippingRegion( m_updateRegion );
     wxEraseEvent erase_event( GetId(), &dc );
     erase_event.SetEventObject( this );
@@ -4077,13 +4088,29 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
 
     wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
 
+    // No scrolling requested.
     if ((dx == 0) && (dy == 0)) return;
+    
+    if (!m_updateRegion.IsEmpty())
+    {
+        m_updateRegion.Offset( dx, dy );
+        
+        int cw = 0;
+        int ch = 0;
+        GetClientSize( &cw, &ch );
+        m_updateRegion.Intersect( 0, 0, cw, ch );
+    }
+    
+#if 1
 
     m_clipPaintRegion = TRUE;
+    
     gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
+    
     m_clipPaintRegion = FALSE;
 
-/*
+#else
+
     if (m_children.GetCount() > 0)
     {
         gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
@@ -4133,7 +4160,7 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
 
         gdk_gc_unref( m_scrollGC );
     }
-*/
+#endif
 }
 
 // Find the wxWindow at the current mouse position, also returning the mouse