X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/83df96d63a52ebb08b9e32549dc255354b4a18d0..4a46a5df879c4f820d0a0a435b34c7d5e4793991:/src/x11/dcclient.cpp diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index f442f9ebca..20875caf01 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -51,12 +51,13 @@ #ifdef __VMS__ #pragma message disable nosimpint #endif -#include +#include "X11/Xlib.h" +#include "X11/Xutil.h" #ifdef __VMS__ #pragma message enable nosimpint #endif -#include "wx/motif/private.h" +#include "wx/x11/private.h" #ifdef __EMX__ #include // for M_PI @@ -134,7 +135,7 @@ wxWindowDC::wxWindowDC() m_currentPenWidth = 1; m_currentPenJoin = -1; m_currentPenDashCount = -1; - m_currentPenDash = (wxMOTIFDash*) NULL; + m_currentPenDash = (wxX11Dash*) NULL; m_currentStyle = -1; m_currentFill = -1; // m_currentBkMode = wxTRANSPARENT; @@ -159,7 +160,7 @@ wxWindowDC::wxWindowDC( wxWindow *window ) m_currentPenWidth = 1; m_currentPenJoin = -1; m_currentPenDashCount = -1; - m_currentPenDash = (wxMOTIFDash*) NULL; + m_currentPenDash = (wxX11Dash*) NULL; m_currentStyle = -1; m_currentFill = -1; // m_currentBkMode = wxTRANSPARENT; @@ -185,14 +186,6 @@ wxWindowDC::wxWindowDC( wxWindow *window ) GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); - if (m_window->GetBackingPixmap()) - { - m_gcBacking = (WXGC) XCreateGC (display, RootWindow (display, - DefaultScreen (display)), - GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, - &gcvalues); - } - m_backgroundPixel = (int) gcvalues.background; // Get the current Font so we can set it back later @@ -208,9 +201,6 @@ wxWindowDC::~wxWindowDC() if (m_gc && (m_oldFont != (WXFont) 0) && ((long) m_oldFont != -1)) { XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont); - - if (m_window && m_window->GetBackingPixmap()) - XSetFont ((Display*) m_display,(GC) m_gcBacking, (Font) m_oldFont); } if (m_gc) @@ -268,11 +258,6 @@ void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, x1d, y1d, x2d, y2d); - if (m_window && m_window->GetBackingPixmap()) - XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, - XLOG2DEV_2(x1), YLOG2DEV_2(y1), - XLOG2DEV_2(x2), YLOG2DEV_2(y2)); - CalcBoundingBox(x1, y1); CalcBoundingBox(x2, y2); } @@ -292,18 +277,6 @@ void wxWindowDC::DoCrossHair( wxCoord x, wxCoord y ) ww, yy); XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xx, 0, xx, hh); - - if (m_window && m_window->GetBackingPixmap()) - { - xx = XLOG2DEV_2 (x); - yy = YLOG2DEV_2 (y); - XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, - 0, yy, - ww, yy); - XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, - xx, 0, - xx, hh); - } } void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc ) @@ -368,10 +341,6 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) (GC) m_gc, xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2); - if (m_window && m_window->GetBackingPixmap()) - XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, - xxc_2 - r, yyc_2 - r, 2 * r, 2 * r, alpha1, alpha2); - } if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT) @@ -380,10 +349,6 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo SetPen (m_pen); XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2); - - if (m_window && m_window->GetBackingPixmap()) - XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, - xxc_2 - r, yyc_2 - r, 2 * r, 2 * r, alpha1, alpha2); } CalcBoundingBox (x1, y1); CalcBoundingBox (x2, y2); @@ -415,10 +380,6 @@ void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord SetBrush (m_brush); XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, start, end); - - if (m_window && m_window->GetBackingPixmap()) - XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y),wd,hd,start,end); } if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT) @@ -426,10 +387,8 @@ void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord if (m_autoSetting) SetPen (m_pen); XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, start,end); - if (m_window && m_window->GetBackingPixmap()) - XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y),wd,hd,start,end); } + CalcBoundingBox (x, y); CalcBoundingBox (x + width, y + height); } @@ -444,9 +403,7 @@ void wxWindowDC::DoDrawPoint( wxCoord x, wxCoord y ) SetPen (m_pen); XDrawPoint ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y)); - if (m_window && m_window->GetBackingPixmap()) - XDrawPoint ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, XLOG2DEV_2 (x), YLOG2DEV_2 (y)); - + CalcBoundingBox (x, y); } @@ -471,15 +428,6 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord } XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints, n, 0); - if (m_window && m_window->GetBackingPixmap()) - { - for (i = 0; i < n; i++) - { - xpoints[i].x = XLOG2DEV_2 (points[i].x + xoffset); - xpoints[i].y = YLOG2DEV_2 (points[i].y + yoffset); - } - XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints, n, 0); - } delete[]xpoints; } } @@ -515,13 +463,6 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], XSetFillRule ((Display*) m_display, (GC) m_gc, fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule); XFillPolygon ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n, Complex, 0); XSetFillRule ((Display*) m_display, (GC) m_gc, EvenOddRule); // default mode - if (m_window && m_window->GetBackingPixmap()) - { - XSetFillRule ((Display*) m_display,(GC) m_gcBacking, - fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule); - XFillPolygon ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2, n, Complex, 0); - XSetFillRule ((Display*) m_display,(GC) m_gcBacking, EvenOddRule); // default mode - } } if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT) @@ -529,9 +470,6 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], if (m_autoSetting) SetPen (m_pen); XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n + 1, 0); - - if (m_window && m_window->GetBackingPixmap()) - XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2, n + 1, 0); } delete[]xpoints1; @@ -561,11 +499,6 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h { SetBrush (m_brush); XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wfd, hfd); - - if (m_window && m_window->GetBackingPixmap()) - XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y), - wfd, hfd); } if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT) @@ -573,12 +506,8 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h if (m_autoSetting) SetPen (m_pen); XDrawRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd); - - if (m_window && m_window->GetBackingPixmap()) - XDrawRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y), - wd, hd); } + CalcBoundingBox (x, y); CalcBoundingBox (x + width, y + height); } @@ -662,29 +591,6 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx // Bottom-left XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + hd - rh_d, rw_d, rh_d, 180 * 64, 90 * 64); - - if (m_window && m_window->GetBackingPixmap()) - { - XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2 + rd2, yd2, wd2 - rw_d2, hd2); - XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2, yd2 + rd2, wd2, hd2 - rh_d2); - - XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2, yd2, rw_d2, rh_d2, 90 * 64, 90 * 64); - XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2 + wd2 - rw_d2, yd2, - // rw_d2, rh_d2, 0, 90 * 64); - rw_d2, rh_d2, 0, 91 * 64); - XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2 + wd2 - rw_d2, - yd2 + hd2 - rh_d2, - // rw_d2, rh_d2, 270 * 64, 90 * 64); - rw_d2, rh_d2, 269 * 64, 92 * 64); - XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2, yd2 + hd2 - rh_d2, - rw_d2, rh_d2, 180 * 64, 90 * 64); - } } if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT) @@ -709,37 +615,6 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx rw_d, rh_d, 269 * 64, 92 * 64); XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + hd - rh_d, rw_d, rh_d, 180 * 64, 90 * 64); - - if (m_window && m_window->GetBackingPixmap()) - { - XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2 + rd2, yd2, - xd2 + wd2 - rd2 + 1, yd2); - XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2 + rd2, yd2 + hd2, - xd2 + wd2 - rd2, yd2 + hd2); - - XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2, yd2 + rd2, - xd2, yd2 + hd2 - rd2); - XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2 + wd2, yd2 + rd2, - xd2 + wd2, yd2 + hd2 - rd2 + 1); - XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2, yd2, - rw_d2, rh_d2, 90 * 64, 90 * 64); - XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2 + wd2 - rw_d2, yd2, - // rw_d2, rh_d2, 0, 90 * 64); - rw_d2, rh_d2, 0, 91 * 64); - XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2 + wd2 - rw_d2, - yd2 + hd2 - rh_d2, - rw_d2, rh_d2, 269 * 64, 92 * 64); - XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - xd2, yd2 + hd2 - rh_d2, - rw_d2, rh_d2, 180 * 64, 90 * 64); - } } CalcBoundingBox (x, y); CalcBoundingBox (x + width, y + height); @@ -779,11 +654,6 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei { SetBrush (m_brush); XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle); - if (m_window && m_window->GetBackingPixmap()) - XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y), - XLOG2DEVREL (width) - WX_GC_CF, - YLOG2DEVREL (height) - WX_GC_CF, 0, angle); } if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT) @@ -791,11 +661,6 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei if (m_autoSetting) SetPen (m_pen); XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle); - if (m_window && m_window->GetBackingPixmap()) - XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y), - XLOG2DEVREL (width) - WX_GC_CF, - YLOG2DEVREL (height) - WX_GC_CF, 0, angle); } CalcBoundingBox (x, y); CalcBoundingBox (x + width, y + height); @@ -839,21 +704,6 @@ void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y) 0, 0, width, height, (int) XLOG2DEV (x), (int) YLOG2DEV (y)); } - - - if (m_window && m_window->GetBackingPixmap()) - { - if (icon.GetDepth() <= 1) - { - XCopyPlane ((Display*) m_display, iconPixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - 0, 0, width, height, (int) XLOG2DEV_2 (x), (int) YLOG2DEV_2 (y), 1); - } - else - { - XCopyArea ((Display*) m_display, iconPixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - 0, 0, width, height, - (int) XLOG2DEV_2 (x), (int) YLOG2DEV_2 (y)); - } } } else { /* Remote copy (different (Display*) m_displays) */ XImage *cache = NULL; @@ -938,6 +788,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he { XImage *cache = NULL; +#if 0 if (m_window && m_window->GetBackingPixmap()) XCopyRemote((Display*) sourceDC->m_display, (Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(), @@ -948,6 +799,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he source->LogicalToDeviceYRel(height), XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest), TRUE, &cache); +#endif if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) ) { @@ -976,28 +828,6 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he } else { - if (m_window && m_window->GetBackingPixmap()) - { - // +++ MARKUS (mho@comnets.rwth-aachen): error on blitting bitmaps with depth 1 - if (source->IsKindOf(CLASSINFO(wxMemoryDC)) && ((wxMemoryDC*) source)->GetBitmap().GetDepth() == 1) - { - XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - source->LogicalToDeviceX (xsrc), - source->LogicalToDeviceY (ysrc), - source->LogicalToDeviceXRel(width), - source->LogicalToDeviceYRel(height), - XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest), 1); - } - else - { - XCopyArea ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - source->LogicalToDeviceX (xsrc), - source->LogicalToDeviceY (ysrc), - source->LogicalToDeviceXRel(width), - source->LogicalToDeviceYRel(height), - XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest)); - } - } if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) ) { wxMemoryDC *memDC = (wxMemoryDC *)source; @@ -1106,17 +936,12 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) if (pixel > -1) { XSetForeground ((Display*) m_display, (GC) m_gc, pixel); - if (m_window && m_window->GetBackingPixmap()) - XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel); } } else m_textBackgroundColour = oldPenColour ; XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y), cx, cy); - if (m_window && m_window->GetBackingPixmap()) - XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y), cx, cy); } // Now set the text foreground and draw the text @@ -1165,8 +990,6 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) if (pixel > -1) { XSetForeground ((Display*) m_display, (GC) m_gc, pixel); - if (m_window && m_window->GetBackingPixmap()) - XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel); } } else @@ -1183,18 +1006,6 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) #endif // 0 XDrawString((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y) + ascent, text, slen); - if (m_window && m_window->GetBackingPixmap()) { -#if 0 - if (use16) - XDrawString16((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y) + ascent, - (XChar2b *)(char*) (const char*) text, slen); - else -#endif // 0 - XDrawString((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y) + ascent, (char*) (const char*) text, slen); - } - wxCoord w, h; GetTextExtent (text, &w, &h); CalcBoundingBox (x + w, y + h); @@ -1318,17 +1129,12 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, if (pixel > -1) { XSetForeground ((Display*) m_display, (GC) m_gc, pixel); - if (m_window && m_window->GetBackingPixmap()) - XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel); } } else m_textBackgroundColour = oldPenColour ; XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y), cx, cy); - if (m_window && m_window->GetBackingPixmap()) - XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, - XLOG2DEV_2 (x), YLOG2DEV_2 (y), cx, cy); } #endif @@ -1431,12 +1237,6 @@ void wxWindowDC::Clear() if (m_window) { m_window->GetSize(&w, &h); - - if (m_window && m_window->GetBackingPixmap()) - { - w = m_window->GetPixmapWidth(); - h = m_window->GetPixmapHeight(); - } } else { @@ -1455,9 +1255,6 @@ void wxWindowDC::Clear() XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, 0, 0, w, h); - if (m_window && m_window->GetBackingPixmap()) - XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, 0, 0, w, h); - m_brush = saveBrush; } @@ -1473,9 +1270,6 @@ void wxWindowDC::Clear(const wxRect& rect) XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, x, y, w, h); - if (m_window && m_window->GetBackingPixmap()) - XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, x, y, w, h); - m_brush = saveBrush; } @@ -1490,9 +1284,6 @@ void wxWindowDC::SetFont( const wxFont &font ) if ((m_oldFont != (WXFont) 0) && ((wxCoord) m_oldFont != -1)) { XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont); - - if (m_window && m_window->GetBackingPixmap()) - XSetFont ((Display*) m_display,(GC) m_gcBacking, (Font) m_oldFont); } return; } @@ -1501,9 +1292,6 @@ void wxWindowDC::SetFont( const wxFont &font ) Font fontId = ((XFontStruct*)pFontStruct)->fid; XSetFont ((Display*) m_display, (GC) m_gc, fontId); - - if (m_window && m_window->GetBackingPixmap()) - XSetFont ((Display*) m_display,(GC) m_gcBacking, fontId); } void wxWindowDC::SetPen( const wxPen &pen ) @@ -1521,7 +1309,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) int old_pen_join = m_currentPenJoin; int old_pen_cap = m_currentPenCap; int old_pen_nb_dash = m_currentPenDashCount; - wxMOTIFDash *old_pen_dash = m_currentPenDash; + wxX11Dash *old_pen_dash = m_currentPenDash; wxColour oldPenColour = m_currentColour; m_currentColour = m_pen.GetColour (); @@ -1531,10 +1319,13 @@ void wxWindowDC::SetPen( const wxPen &pen ) m_currentPenJoin = m_pen.GetJoin (); m_currentPenCap = m_pen.GetCap (); m_currentPenDashCount = m_pen.GetDashCount(); - m_currentPenDash = (wxMOTIFDash*)m_pen.GetDash(); + m_currentPenDash = (wxX11Dash*)m_pen.GetDash(); +#if 0 + // TODO if (m_currentStyle == wxSTIPPLE) m_currentStipple = * m_pen.GetStipple (); +#endif bool sameStyle = (oldStyle == m_currentStyle && oldFill == m_currentFill && @@ -1559,15 +1350,15 @@ void wxWindowDC::SetPen( const wxPen &pen ) int style; int join; int cap; - static const wxMOTIFDash dotted[] = {2, 5}; - static const wxMOTIFDash short_dashed[] = {4, 4}; - static const wxMOTIFDash long_dashed[] = {4, 8}; - static const wxMOTIFDash dotted_dashed[] = {6, 6, 2, 6}; + static const wxX11Dash dotted[] = {2, 5}; + static const wxX11Dash short_dashed[] = {4, 4}; + static const wxX11Dash long_dashed[] = {4, 8}; + static const wxX11Dash dotted_dashed[] = {6, 6, 2, 6}; // We express dash pattern in pen width unit, so we are // independent of zoom factor and so on... int req_nb_dash; - const wxMOTIFDash *req_dash; + const wxX11Dash *req_dash; switch (m_pen.GetStyle ()) { @@ -1601,31 +1392,25 @@ void wxWindowDC::SetPen( const wxPen &pen ) case wxTRANSPARENT: default: style = LineSolid; - req_dash = (wxMOTIFDash*)NULL; + req_dash = (wxX11Dash*)NULL; req_nb_dash = 0; } if (req_dash && req_nb_dash) { - wxMOTIFDash *real_req_dash = new wxMOTIFDash[req_nb_dash]; + wxX11Dash *real_req_dash = new wxX11Dash[req_nb_dash]; if (real_req_dash) { int factor = scaled_width == 0 ? 1 : scaled_width; for (int i = 0; i < req_nb_dash; i++) real_req_dash[i] = req_dash[i] * factor; XSetDashes ((Display*) m_display, (GC) m_gc, 0, real_req_dash, req_nb_dash); - - if (m_window && m_window->GetBackingPixmap()) - XSetDashes ((Display*) m_display,(GC) m_gcBacking, 0, real_req_dash, req_nb_dash); delete[]real_req_dash; } else { // No Memory. We use non-scaled dash pattern... XSetDashes ((Display*) m_display, (GC) m_gc, 0, req_dash, req_nb_dash); - - if (m_window && m_window->GetBackingPixmap()) - XSetDashes ((Display*) m_display,(GC) m_gcBacking, 0, req_dash, req_nb_dash); } } @@ -1658,9 +1443,6 @@ void wxWindowDC::SetPen( const wxPen &pen ) } XSetLineAttributes ((Display*) m_display, (GC) m_gc, scaled_width, style, cap, join); - - if (m_window && m_window->GetBackingPixmap()) - XSetLineAttributes ((Display*) m_display,(GC) m_gcBacking, scaled_width, style, cap, join); } if (IS_HATCH(m_currentFill) && ((m_currentFill != oldFill) || !GetOptimization())) @@ -1716,17 +1498,11 @@ void wxWindowDC::SetPen( const wxPen &pen ) break; } XSetStipple ((Display*) m_display, (GC) m_gc, myStipple); - - if (m_window && m_window->GetBackingPixmap()) - XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple); } else if (m_currentStipple.Ok() && ((m_currentStipple != oldStipple) || !GetOptimization())) { XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetPixmap()); - - if (m_window && m_window->GetBackingPixmap()) - XSetStipple ((Display*) m_display,(GC) m_gcBacking, (Pixmap) m_currentStipple.GetPixmap()); } if ((m_currentFill != oldFill) || !GetOptimization()) @@ -1740,8 +1516,6 @@ void wxWindowDC::SetPen( const wxPen &pen ) else fill_style = FillSolid; XSetFillStyle ((Display*) m_display, (GC) m_gc, fill_style); - if (m_window && m_window->GetBackingPixmap()) - XSetFillStyle ((Display*) m_display,(GC) m_gcBacking, fill_style); } // must test m_logicalFunction, because it involves background! @@ -1785,14 +1559,10 @@ void wxWindowDC::SetPen( const wxPen &pen ) XGCValues values; XGetGCValues ((Display*) m_display, (GC) m_gc, GCBackground, &values); XSetForeground ((Display*) m_display, (GC) m_gc, pixel ^ values.background); - if (m_window && m_window->GetBackingPixmap()) - XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel ^ values.background); } else { XSetForeground ((Display*) m_display, (GC) m_gc, pixel); - if (m_window && m_window->GetBackingPixmap()) - XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel); } } } @@ -1847,15 +1617,11 @@ void wxWindowDC::SetBrush( const wxBrush &brush ) // fill style should be solid or transparent int style = (m_backgroundMode == wxSOLID ? FillOpaqueStippled : FillStippled); XSetFillStyle ((Display*) m_display, (GC) m_gc, style); - if (m_window && m_window->GetBackingPixmap()) - XSetFillStyle ((Display*) m_display,(GC) m_gcBacking, style); } break; case wxSOLID: default: XSetFillStyle ((Display*) m_display, (GC) m_gc, FillSolid); - if (m_window && m_window->GetBackingPixmap()) - XSetFillStyle ((Display*) m_display,(GC) m_gcBacking, FillSolid); } } @@ -1910,17 +1676,12 @@ void wxWindowDC::SetBrush( const wxBrush &brush ) break; } XSetStipple ((Display*) m_display, (GC) m_gc, myStipple); - - if (m_window && m_window->GetBackingPixmap()) - XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple); } // X can forget the stipple value when resizing a window (apparently) // so always set the stipple. else if (m_currentStipple.Ok()) // && m_currentStipple != oldStipple) { XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetPixmap()); - if (m_window && m_window->GetBackingPixmap()) - XSetStipple ((Display*) m_display,(GC) m_gcBacking, (Pixmap) m_currentStipple.GetPixmap()); } // must test m_logicalFunction, because it involves background! @@ -1974,14 +1735,10 @@ void wxWindowDC::SetBrush( const wxBrush &brush ) XGCValues values; XGetGCValues ((Display*) m_display, (GC) m_gc, GCBackground, &values); XSetForeground ((Display*) m_display, (GC) m_gc, pixel ^ values.background); - if (m_window && m_window->GetBackingPixmap()) - XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel ^ values.background); } else { XSetForeground ((Display*) m_display, (GC) m_gc, pixel); - if (m_window && m_window->GetBackingPixmap()) - XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel); } } } @@ -2011,8 +1768,6 @@ void wxWindowDC::SetBackground( const wxBrush &brush ) // Necessary for ::DrawIcon, which use fg/bg pixel or the GC. // And Blit,... (Any fct that use XCopyPlane, in fact.) XSetBackground ((Display*) m_display, (GC) m_gc, pixel); - if (m_window && m_window->GetBackingPixmap()) - XSetBackground ((Display*) m_display,(GC) m_gcBacking, pixel); } void wxWindowDC::SetLogicalFunction( int function ) @@ -2079,8 +1834,6 @@ void wxWindowDC::SetLogicalFunction( int function ) } XSetFunction((Display*) m_display, (GC) m_gc, x_function); - if (m_window && m_window->GetBackingPixmap()) - XSetFunction((Display*) m_display, (GC) m_gcBacking, x_function); if ((m_logicalFunction == wxXOR) != (function == wxXOR)) /* MATTHEW: [9] Need to redo pen simply */ @@ -2151,11 +1904,11 @@ void wxWindowDC::SetDCClipping() m_currentRegion = (WXRegion) NULL; if ((m_window && m_window->GetUpdateRegion().Ok()) && m_userRegion) - XIntersectRegion ((Region) m_window->GetUpdateRegion().GetXRegion(), (Region) m_userRegion, (Region) m_currentRegion); + XIntersectRegion ((Region) m_window->GetUpdateRegion().GetX11Region(), (Region) m_userRegion, (Region) m_currentRegion); else if (m_userRegion) XIntersectRegion ((Region) m_userRegion, (Region) m_userRegion, (Region) m_currentRegion); else if (m_window && m_window->GetUpdateRegion().Ok()) - XIntersectRegion ((Region) m_window->GetUpdateRegion().GetXRegion(), (Region) m_window->GetUpdateRegion().GetXRegion(), + XIntersectRegion ((Region) m_window->GetUpdateRegion().GetX11Region(), (Region) m_window->GetUpdateRegion().GetX11Region(), (Region) m_currentRegion); if (m_currentRegion) @@ -2184,18 +1937,6 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo XUnionRectWithRegion (&r, (Region) m_userRegion, (Region) m_userRegion); SetDCClipping (); - - // 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()) - { - XRectangle rects[1]; - rects[0].x = XLOG2DEV_2(x); - rects[0].y = YLOG2DEV_2(y); - rects[0].width = XLOG2DEVREL(width); - rects[0].height = YLOG2DEVREL(height); - XSetClipRectangles((Display*) m_display, (GC) m_gcBacking, 0, 0, rects, 1, Unsorted); - } } void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region ) @@ -2208,21 +1949,9 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region ) XDestroyRegion ((Region) m_userRegion); m_userRegion = (WXRegion) XCreateRegion (); - XUnionRegion((Region) m_userRegion, (Region) region.GetXRegion(), (Region) m_userRegion); + XUnionRegion((Region) m_userRegion, (Region) region.GetX11Region(), (Region) m_userRegion); SetDCClipping (); - - // 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()) - { - XRectangle rects[1]; - rects[0].x = XLOG2DEV_2(box.x); - rects[0].y = YLOG2DEV_2(box.y); - rects[0].width = XLOG2DEVREL(box.width); - rects[0].height = YLOG2DEVREL(box.height); - XSetClipRectangles((Display*) m_display, (GC) m_gcBacking, 0, 0, rects, 1, Unsorted); - } } @@ -2238,8 +1967,6 @@ void wxWindowDC::DestroyClippingRegion() XGCValues gc_val; gc_val.clip_mask = None; - if (m_window && m_window->GetBackingPixmap()) - XChangeGC((Display*) m_display, (GC) m_gcBacking, GCClipMask, &gc_val); } // Resolution in pixels per logical inch @@ -2261,53 +1988,14 @@ int wxWindowDC::GetDepth() const // wxPaintDC // ---------------------------------------------------------------------------- -wxPaintDC::wxPaintDC(wxWindow* win) : wxWindowDC(win) +wxPaintDC::wxPaintDC(wxWindow* win) + : wxWindowDC(win) { - wxRegion* region = NULL; - - // Combine all the update rects into a region - const wxRectList& updateRects(win->GetUpdateRects()); - if ( updateRects.GetCount() != 0 ) - { - for ( wxRectList::Node *node = updateRects.GetFirst(); - node; - node = node->GetNext() ) - { - wxRect* rect = node->GetData(); - - if (!region) - region = new wxRegion(*rect); - else - // TODO: is this correct? In SetDCClipping above, - // XIntersectRegion is used to combine paint and user - // regions. XIntersectRegion appears to work in that case... - region->Union(*rect); - } - } - else - { - int cw, ch; - win->GetClientSize(&cw, &ch); - region = new wxRegion(wxRect(0, 0, cw, ch)); - } - - win->SetUpdateRegion(*region); - - wxRegion& theRegion(win->GetUpdateRegion()); - theRegion.SetRects(updateRects); // We also store in terms of rects, for iteration to work. - - // Set the clipping region. Any user-defined region will be combined with this - // one in SetDCClipping. - XSetRegion ((Display*) m_display, (GC) m_gc, (Region) region->GetXRegion()); - - delete region; + // TODO clone GTK logic here } wxPaintDC::~wxPaintDC() { - XSetClipMask ((Display*) m_display, (GC) m_gc, None); - if (m_window) - m_window->ClearUpdateRegion(); } // ----------------------------------------------------------------------------