X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c96faa7c9b1926d63a2fff32ac4508d3138a7bee..ea804aadf91c963d97a56e152d8372c9e689affe:/src/gtk1/dcclient.cpp diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 2cdeb7137a..a5ee2b008c 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -109,10 +109,24 @@ wxWindowDC::wxWindowDC( wxWindow *window ) m_owner = (wxWindow *)NULL; if (!window) return; + GtkWidget *widget = window->m_wxwindow; - if (!widget) return; + if (!widget) + return; + m_window = widget->window; + + /* not realized ? */ + if (!m_window) + { + /* force realization */ + gtk_widget_realize( widget ); + m_window = widget->window; + } + + /* still not realized ? */ if (!m_window) return; + if (window->m_wxwindow) m_cmap = gtk_widget_get_colormap( window->m_wxwindow ); else @@ -618,13 +632,13 @@ bool wxWindowDC::Blit( long xdest, long ydest, long width, long height, { /* we HAVE TO use the direct way for memory dcs that have mask since the XCopyArea doesn't know - about masks and */ + about masks */ use_bitmap_method = TRUE; } else if (memDC->m_selected.GetDepth() == 1) { /* we HAVE TO use the direct way for memory dcs - that are bitmaps because XCopyArea doesn't copy + that are bitmaps because XCopyArea doesn't cope with different bit depths */ use_bitmap_method = TRUE; } @@ -825,8 +839,6 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh long *descent, long *externalLeading, wxFont *theFont, bool WXUNUSED(use16) ) { - wxCHECK_RET( Ok(), _T("invalid window dc") ); - wxFont fontToUse = m_font; if (theFont) fontToUse = *theFont; @@ -839,16 +851,12 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh long wxWindowDC::GetCharWidth() { - wxCHECK_MSG( Ok(), 0, _T("invalid window dc") ); - GdkFont *font = m_font.GetInternalFont( m_scaleY ); return long(gdk_string_width( font, "H" ) / m_scaleX); } long wxWindowDC::GetCharHeight() { - wxCHECK_MSG( Ok(), 0, _T("invalid window dc") ); - GdkFont *font = m_font.GetInternalFont( m_scaleY ); return long((font->ascent + font->descent) / m_scaleY); } @@ -883,8 +891,6 @@ void wxWindowDC::Clear() void wxWindowDC::SetFont( const wxFont &font ) { - wxCHECK_RET( Ok(), _T("invalid window dc") ); - m_font = font; }