use the right GdkWindow and origin for non-pizza widget with wxClientDC

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58675 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2009-02-05 05:45:40 +00:00
parent ea6e8ec55d
commit b666ade784

View File

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