X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c2cb80c865778f940f254544a42dbb4bb2e9cae0..222702b112dcc7bebe018d6f4d66fe469fefd02c:/src/gtk/dcclient.cpp diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index d77ba5460c..339aab1a31 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -143,8 +143,6 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable, // Implement Pool of Graphic contexts. Creating them takes too much time. //----------------------------------------------------------------------------- -#define GC_POOL_SIZE 200 - enum wxPoolGCType { wxGC_ERROR = 0, @@ -1744,11 +1742,8 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, #else const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string ); if ( !wdata ) - { - if (width) (*width) = 0; - if (height) (*height) = 0; return; - } + const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata ); const char *dataUTF8 = (const char *)data; #endif @@ -1761,19 +1756,21 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) ); - int w,h; - pango_layout_get_pixel_size( m_layout, &w, &h ); - - if (width) - *width = (wxCoord) w; - if (height) - *height = (wxCoord) h; if (descent) { + int h; + pango_layout_get_pixel_size( m_layout, width, &h ); PangoLayoutIter *iter = pango_layout_get_iter(m_layout); int baseline = pango_layout_iter_get_baseline(iter); pango_layout_iter_free(iter); *descent = h - PANGO_PIXELS(baseline); + + if (height) + *height = (wxCoord) h; + } + else + { + pango_layout_get_pixel_size( m_layout, width, height ); } // Reset old font description @@ -1801,8 +1798,8 @@ wxCoord wxWindowDC::GetCharWidth() const { #ifdef __WXGTK20__ pango_layout_set_text( m_layout, "H", 1 ); - int w,h; - pango_layout_get_pixel_size( m_layout, &w, &h ); + int w; + pango_layout_get_pixel_size( m_layout, &w, NULL ); return w; #else GdkFont *font = m_font.GetInternalFont( m_scaleY ); @@ -1816,8 +1813,8 @@ wxCoord wxWindowDC::GetCharHeight() const { #ifdef __WXGTK20__ pango_layout_set_text( m_layout, "H", 1 ); - int w,h; - pango_layout_get_pixel_size( m_layout, &w, &h ); + int h; + pango_layout_get_pixel_size( m_layout, NULL, &h ); return h; #else GdkFont *font = m_font.GetInternalFont( m_scaleY ); @@ -2003,7 +2000,6 @@ void wxWindowDC::SetPen( const wxPen &pen ) } } -#if (GTK_MINOR_VERSION > 0) || (GTK_MAJOR_VERSION > 1) if (req_dash && req_nb_dash) { wxGTKDash *real_req_dash = new wxGTKDash[req_nb_dash]; @@ -2020,7 +2016,6 @@ void wxWindowDC::SetPen( const wxPen &pen ) gdk_gc_set_dashes( m_penGC, 0, (wxGTKDash*)req_dash, req_nb_dash ); } } -#endif // GTK+ > 1.0 GdkCapStyle capStyle = GDK_CAP_ROUND; switch (m_pen.GetCap()) @@ -2164,7 +2159,6 @@ void wxWindowDC::SetLogicalFunction( int function ) { case wxXOR: mode = GDK_XOR; break; case wxINVERT: mode = GDK_INVERT; break; -#if (GTK_MINOR_VERSION > 0) || (GTK_MAJOR_VERSION > 1) case wxOR_REVERSE: mode = GDK_OR_REVERSE; break; case wxAND_REVERSE: mode = GDK_AND_REVERSE; break; case wxCLEAR: mode = GDK_CLEAR; break; @@ -2181,7 +2175,6 @@ void wxWindowDC::SetLogicalFunction( int function ) // unsupported by GTK case wxNOR: mode = GDK_COPY; break; -#endif // GTK+ > 1.0 default: wxFAIL_MSG( wxT("unsupported logical function") ); mode = GDK_COPY; @@ -2392,9 +2385,13 @@ wxSize wxWindowDC::GetPPI() const int wxWindowDC::GetDepth() const { +#ifdef __WXGTK20__ + return gdk_drawable_get_depth(m_window); +#else wxFAIL_MSG(wxT("not implemented")); return -1; +#endif }