]> git.saurik.com Git - wxWidgets.git/commitdiff
use the right GdkWindow and origin for non-pizza widget with wxClientDC
authorPaul Cornett <paulcor@bullseye.com>
Thu, 5 Feb 2009 05:45:40 +0000 (05:45 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Thu, 5 Feb 2009 05:45:40 +0000 (05:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58675 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/dcclient.cpp

index 8ae3e61149df565126ec95016d0b4f0319fbb71c..93788ede5b965b599d393677ecf6d08ba5affdac 100644 (file)
@@ -271,16 +271,16 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) :
     GtkWidget *widget = window->m_wxwindow;
 
     // Some controls don't have m_wxwindow - like wxStaticBox, but the user
-    // code should still be able to create wxClientDCs for them, so we will
-    // use the parent window here then.
+    // code should still be able to create wxClientDCs for them
     if ( !widget )
     {
-        window = window->GetParent();
-        if (window)
-            widget = window->m_wxwindow;
-    }
+        widget = window->m_widget;
+
+        wxCHECK_RET(widget, "DC needs a widget");
 
-    wxASSERT_MSG( widget, wxT("DC needs a widget") );
+        if (GTK_WIDGET_NO_WINDOW(widget))
+            SetDeviceLocalOrigin(widget->allocation.x, widget->allocation.y);
+    }
 
     m_context = window->GtkGetPangoDefaultContext();
     m_layout = pango_layout_new( m_context );
@@ -297,7 +297,7 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) :
          return;
     }
 
-    m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
+    m_cmap = gtk_widget_get_colormap(widget);
 
     SetUpDC();