X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3e0071d949c302b17d6459de98c5cf42600d96fe..11fe6505b848a968f4c89cb3c3fd37a6a03bcaea:/src/motif/dcclient.cpp diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index 285e7622d7..d9d24aeb46 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -88,11 +88,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC) IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC) IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) -#ifndef IS_HATCH - // IS_HATCH exists for WXWIN_COMPATIBILITY_2_4 only - // but wxMotif needs it for its internals here - #define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH) -#endif +#define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH) // FIXME: left over after removal of wxDC::GetOptimization() #define GET_OPTIMIZATION false @@ -183,8 +179,16 @@ wxWindowDC::wxWindowDC( wxWindow *window ) gcvalues.graphics_exposures = False; gcvalues.subwindow_mode = IncludeInferiors; gcvalues.line_width = 1; +#if !wxMOTIF_NEW_FONT_HANDLING + WXFontStructPtr pFontStruct = m_font.GetFontStruct(m_userScaleY*m_logicalScaleY, m_display); + gcvalues.font = ((XFontStruct*)pFontStruct)->fid; +#endif m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)), - GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, + GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode +#if !wxMOTIF_NEW_FONT_HANDLING + | GCFont +#endif + , &gcvalues); if (m_window->GetBackingPixmap()) @@ -1130,11 +1134,11 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) #if wxMOTIF_NEW_FONT_HANDLING XmbDrawString((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), fset, (GC) m_gcBacking, XLOG2DEV_2 (x), YLOG2DEV_2 (y) + ascent, - wxConstCast(text.c_str(), char), slen); + text.mb_str(), slen); #else XDrawString((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, XLOG2DEV_2 (x), YLOG2DEV_2 (y) + ascent, - wxConstCast(text.c_str(), char), slen); + text.mb_str(), slen); #endif } @@ -1293,7 +1297,7 @@ bool wxWindowDC::CanGetTextExtent() const void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading, - wxFont *font ) const + const wxFont *font ) const { wxCHECK_RET( Ok(), "invalid dc" ); @@ -1689,8 +1693,8 @@ void wxWindowDC::SetPen( const wxPen &pen ) if (m_window && m_window->GetBackingPixmap()) XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple); } - else if (m_currentStipple.Ok() - && ((m_currentStipple != oldStipple) || !GET_OPTIMIZATION)) + else if (m_currentStyle == wxSTIPPLE && m_currentStipple.Ok() + && ((!m_currentStipple.IsSameAs(oldStipple)) || !GET_OPTIMIZATION)) { XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetDrawable()); @@ -2066,7 +2070,8 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, { wxDC::DoSetClippingRegion( x, y, width, height ); - wxRegion temp(x, y, width, height); + wxRegion temp(XLOG2DEV(x), YLOG2DEV(y), + XLOG2DEVREL(width), YLOG2DEVREL(height)); SetDCClipping(temp.GetX11Region()); @@ -2086,16 +2091,14 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region ) { - wxRect box = region.GetBox(); - - wxDC::DoSetClippingRegion( box.x, box.y, box.width, box.height ); - SetDCClipping(region.GetX11Region()); // Needs to work differently for Pixmap: without this, // there's a nasty (Display*) m_display bug. 8/12/94 if (m_window && m_window->GetBackingPixmap()) { + wxRect box = region.GetBox(); + XRectangle rects[1]; rects[0].x = (short)XLOG2DEV_2(box.x); rects[0].y = (short)YLOG2DEV_2(box.y); @@ -2224,7 +2227,7 @@ install: XPutImage(dest_display, dest, destgc, destimage, 0, 0, destx, desty, w, h); XDestroyImage(destimage); - if (more) + if (more && cache) *cache = image; else XDestroyImage(image);