wxX11:
Rewrote wxRegion. Killed backing store Pixmap. Killed wxRectList. Adapted wxWindow to the above. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
c3e44503cf
commit
1934d291cd
@ -13,10 +13,12 @@
|
||||
#define _WX_PRIVATE_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/utils.h"
|
||||
#include "X11/Xlib.h"
|
||||
|
||||
class wxMouseEvent;
|
||||
class wxKeyEvent;
|
||||
class wxWindow;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// common callbacks
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Modified by:
|
||||
// Created: 17/09/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Copyright: (c) Julian Smart, Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -20,135 +20,148 @@
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// A list of rectangles type used by wxRegion and wxWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_LIST(wxRect, wxRectList);
|
||||
class wxRegion;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
enum wxRegionContain {
|
||||
wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
|
||||
enum wxRegionContain
|
||||
{
|
||||
wxOutRegion = 0,
|
||||
wxPartRegion = 1,
|
||||
wxInRegion = 2
|
||||
};
|
||||
|
||||
// So far, for internal use only
|
||||
enum wxRegionOp {
|
||||
wxRGN_AND, // Creates the intersection of the two combined regions.
|
||||
wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1.
|
||||
wxRGN_DIFF, // Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.
|
||||
wxRGN_OR, // Creates the union of two combined regions.
|
||||
wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas.
|
||||
enum wxRegionOp
|
||||
{
|
||||
wxRGN_AND, // Creates the intersection of the two combined regions.
|
||||
wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1.
|
||||
wxRGN_DIFF, // Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.
|
||||
wxRGN_OR, // Creates the union of two combined regions.
|
||||
wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas.
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxRegion : public wxGDIObject {
|
||||
DECLARE_DYNAMIC_CLASS(wxRegion)
|
||||
friend class WXDLLEXPORT wxRegionIterator;
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRegion
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxRegion : public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRegion(const wxRect& rect);
|
||||
wxRegion();
|
||||
wxRegion() { }
|
||||
|
||||
wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
||||
{
|
||||
InitRect(x, y, w, h);
|
||||
}
|
||||
|
||||
wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
|
||||
{
|
||||
InitRect(topLeft.x, topLeft.y,
|
||||
bottomRight.x - topLeft.x, bottomRight.y - topLeft.y);
|
||||
}
|
||||
|
||||
wxRegion( const wxRect& rect )
|
||||
{
|
||||
InitRect(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
|
||||
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
||||
~wxRegion();
|
||||
|
||||
//# Copying
|
||||
inline wxRegion(const wxRegion& r)
|
||||
{ Ref(r); }
|
||||
inline wxRegion& operator = (const wxRegion& r)
|
||||
{ Ref(r); return (*this); }
|
||||
|
||||
//# Modify region
|
||||
// Clear current region
|
||||
|
||||
wxRegion( const wxRegion& region ) { Ref(region); }
|
||||
wxRegion& operator = ( const wxRegion& region ) { Ref(region); return *this; }
|
||||
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
bool operator == ( const wxRegion& region );
|
||||
bool operator != ( const wxRegion& region ) { return !(*this == region); }
|
||||
|
||||
void Clear();
|
||||
|
||||
// Union rectangle or region with this.
|
||||
inline bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_OR); }
|
||||
inline bool Union(const wxRect& rect) { return Combine(rect, wxRGN_OR); }
|
||||
inline bool Union(const wxRegion& region) { return Combine(region, wxRGN_OR); }
|
||||
|
||||
// Intersect rectangle or region with this.
|
||||
inline bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_AND); }
|
||||
inline bool Intersect(const wxRect& rect) { return Combine(rect, wxRGN_AND); }
|
||||
inline bool Intersect(const wxRegion& region) { return Combine(region, wxRGN_AND); }
|
||||
|
||||
// Subtract rectangle or region from this:
|
||||
// Combines the parts of 'this' that are not part of the second region.
|
||||
inline bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_DIFF); }
|
||||
inline bool Subtract(const wxRect& rect) { return Combine(rect, wxRGN_DIFF); }
|
||||
inline bool Subtract(const wxRegion& region) { return Combine(region, wxRGN_DIFF); }
|
||||
|
||||
// XOR: the union of two combined regions except for any overlapping areas.
|
||||
inline bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_XOR); }
|
||||
inline bool Xor(const wxRect& rect) { return Combine(rect, wxRGN_XOR); }
|
||||
inline bool Xor(const wxRegion& region) { return Combine(region, wxRGN_XOR); }
|
||||
|
||||
//# Information on region
|
||||
// Outer bounds of region
|
||||
void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const;
|
||||
|
||||
bool Offset( wxCoord x, wxCoord y );
|
||||
|
||||
bool Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
||||
bool Union( const wxRect& rect );
|
||||
bool Union( const wxRegion& region );
|
||||
|
||||
bool Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
||||
bool Intersect( const wxRect& rect );
|
||||
bool Intersect( const wxRegion& region );
|
||||
|
||||
bool Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
||||
bool Subtract( const wxRect& rect );
|
||||
bool Subtract( const wxRegion& region );
|
||||
|
||||
bool Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
||||
bool Xor( const wxRect& rect );
|
||||
bool Xor( const wxRegion& region );
|
||||
|
||||
void GetBox( wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h ) const;
|
||||
wxRect GetBox() const ;
|
||||
|
||||
// Is region empty?
|
||||
|
||||
bool Empty() const;
|
||||
inline bool IsEmpty() const { return Empty(); }
|
||||
bool Ok() const { return (m_refData != NULL) ; }
|
||||
|
||||
//# Tests
|
||||
// Does the region contain the point (x,y)?
|
||||
wxRegionContain Contains(wxCoord x, wxCoord y) const;
|
||||
// Does the region contain the point pt?
|
||||
bool IsEmpty() const { return Empty(); }
|
||||
|
||||
wxRegionContain Contains( wxCoord x, wxCoord y ) const;
|
||||
wxRegionContain Contains( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) const;
|
||||
wxRegionContain Contains(const wxPoint& pt) const;
|
||||
// Does the region contain the rectangle (x, y, w, h)?
|
||||
wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const;
|
||||
// Does the region contain the rectangle rect?
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
|
||||
public:
|
||||
WXRegion *GetX11Region() const;
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
// Internal
|
||||
bool Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op);
|
||||
bool Combine(const wxRegion& region, wxRegionOp op);
|
||||
bool Combine(const wxRect& rect, wxRegionOp op);
|
||||
|
||||
// Get the internal Region handle
|
||||
WXRegion GetXRegion() const;
|
||||
|
||||
// 'Naughty' functions that allow wxWindows to use a list of rects
|
||||
// instead of the region, in certain circumstances (e.g. when
|
||||
// making a region out of the update rectangles).
|
||||
// These are used by wxPaintDC::wxPaintDC and wxRegionIterator::Reset.
|
||||
bool UsingRects() const;
|
||||
wxRect* GetRects();
|
||||
int GetRectCount() const;
|
||||
void SetRects(const wxRectList& rectList);
|
||||
void SetRects(int count, const wxRect* rects);
|
||||
// common part of ctors for a rectangle region
|
||||
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxRegion);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxRegionIterator : public wxObject {
|
||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator)
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRegionIterator: decomposes a region into rectangles
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxRegionIterator: public wxObject
|
||||
{
|
||||
public:
|
||||
wxRegionIterator();
|
||||
wxRegionIterator(const wxRegion& region);
|
||||
~wxRegionIterator();
|
||||
|
||||
void Reset() { m_current = 0; }
|
||||
|
||||
void Reset() { m_current = 0u; }
|
||||
void Reset(const wxRegion& region);
|
||||
|
||||
operator bool () const { return m_current < m_numRects; }
|
||||
bool HaveRects() const { return m_current < m_numRects; }
|
||||
|
||||
|
||||
operator bool () const;
|
||||
bool HaveRects() const;
|
||||
|
||||
void operator ++ ();
|
||||
void operator ++ (int);
|
||||
|
||||
|
||||
wxCoord GetX() const;
|
||||
wxCoord GetY() const;
|
||||
wxCoord GetW() const;
|
||||
wxCoord GetWidth() const { return GetW(); }
|
||||
wxCoord GetH() const;
|
||||
wxCoord GetHeight() const { return GetH(); }
|
||||
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
||||
|
||||
wxRect GetRect() const;
|
||||
|
||||
private:
|
||||
size_t m_current;
|
||||
size_t m_numRects;
|
||||
size_t m_current;
|
||||
wxRegion m_region;
|
||||
wxRect* m_rects;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -123,12 +123,6 @@ public:
|
||||
WXWindow GetXWindow() const;
|
||||
WXDisplay *GetXDisplay() const;
|
||||
|
||||
// called from Motif callbacks - and should only be called from there
|
||||
|
||||
void SetButton1(bool pressed) { m_button1Pressed = pressed; }
|
||||
void SetButton2(bool pressed) { m_button2Pressed = pressed; }
|
||||
void SetButton3(bool pressed) { m_button3Pressed = pressed; }
|
||||
|
||||
void SetLastClick(int button, long timestamp)
|
||||
{ m_lastButton = button; m_lastTS = timestamp; }
|
||||
|
||||
@ -139,25 +133,8 @@ public:
|
||||
// arrange status bar, toolbar etc.
|
||||
virtual bool PreResize();
|
||||
|
||||
// Generates a paint event
|
||||
virtual void DoPaint();
|
||||
|
||||
// update rectangle/region manipulation
|
||||
// (for wxWindowDC and Motif callbacks only)
|
||||
// -----------------------------------------
|
||||
|
||||
// read/write access to the update rect list
|
||||
const wxRectList& GetUpdateRects() const { return m_updateRects; }
|
||||
|
||||
// Adds a recangle to the updates list
|
||||
void AddUpdateRect(int x, int y, int w, int h)
|
||||
{ m_updateRects.Append(new wxRect(x, y, w, h)); }
|
||||
|
||||
// Empties the m_updateRects list
|
||||
void ClearUpdateRects();
|
||||
|
||||
void ClearUpdateRegion() { m_updateRegion.Clear(); }
|
||||
void SetUpdateRegion(const wxRegion& region) { m_updateRegion = region; }
|
||||
// Generates paint events
|
||||
void X11SendPaintEvents();
|
||||
|
||||
// sets the fore/background colour for the given widget
|
||||
static void DoChangeForegroundColour(WXWindow widget, wxColour& foregroundColour);
|
||||
@ -187,13 +164,6 @@ protected:
|
||||
void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; }
|
||||
|
||||
public:
|
||||
WXPixmap GetBackingPixmap() const { return m_backingPixmap; }
|
||||
void SetBackingPixmap(WXPixmap pixmap) { m_backingPixmap = pixmap; }
|
||||
int GetPixmapWidth() const { return m_pixmapWidth; }
|
||||
int GetPixmapHeight() const { return m_pixmapHeight; }
|
||||
void SetPixmapWidth(int w) { m_pixmapWidth = w; }
|
||||
void SetPixmapHeight(int h) { m_pixmapHeight = h; }
|
||||
|
||||
// Change properties
|
||||
virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
|
||||
|
||||
@ -245,19 +215,17 @@ protected:
|
||||
|
||||
bool m_needsRefresh:1; // repaint backing store?
|
||||
bool m_canAddEventHandler:1; // ???
|
||||
bool m_button1Pressed:1;
|
||||
bool m_button2Pressed:1;
|
||||
bool m_button3Pressed:1;
|
||||
|
||||
// For double-click detection
|
||||
long m_lastTS; // last timestamp
|
||||
int m_lastButton; // last pressed button
|
||||
|
||||
// List of wxRects representing damaged region
|
||||
wxRectList m_updateRects;
|
||||
|
||||
protected:
|
||||
WXWindow m_mainWidget;
|
||||
|
||||
wxRegion m_clearRegion;
|
||||
bool m_clipPaintRegion;
|
||||
|
||||
WXWindow m_hScrollBar;
|
||||
WXWindow m_vScrollBar;
|
||||
WXWindow m_borderWidget;
|
||||
@ -266,11 +234,6 @@ protected:
|
||||
bool m_winCaptured;
|
||||
bool m_hScroll;
|
||||
bool m_vScroll;
|
||||
WXPixmap m_backingPixmap;
|
||||
int m_pixmapWidth;
|
||||
int m_pixmapHeight;
|
||||
int m_pixmapOffsetX;
|
||||
int m_pixmapOffsetY;
|
||||
|
||||
// Store the last scroll pos, since in wxWin the pos isn't set automatically
|
||||
// by system
|
||||
|
@ -402,13 +402,11 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
{
|
||||
if (win)
|
||||
{
|
||||
win->AddUpdateRect(event->xexpose.x, event->xexpose.y,
|
||||
event->xexpose.width, event->xexpose.height);
|
||||
|
||||
if (event -> xexpose.count == 0)
|
||||
win->GetUpdateRegion().Union( event->xexpose.x, event->xexpose.y,
|
||||
event->xexpose.width, event->xexpose.height);
|
||||
if (event->xexpose.count == 0)
|
||||
{
|
||||
win->DoPaint();
|
||||
win->ClearUpdateRects();
|
||||
win->X11SendPaintEvents(); // TODO let an idle handler do that
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,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
|
||||
@ -209,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)
|
||||
@ -269,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);
|
||||
}
|
||||
@ -293,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 )
|
||||
@ -369,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)
|
||||
@ -381,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);
|
||||
@ -416,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)
|
||||
@ -427,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);
|
||||
}
|
||||
@ -445,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);
|
||||
}
|
||||
|
||||
@ -472,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;
|
||||
}
|
||||
}
|
||||
@ -516,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)
|
||||
@ -530,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;
|
||||
@ -562,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)
|
||||
@ -574,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);
|
||||
}
|
||||
@ -663,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)
|
||||
@ -710,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);
|
||||
@ -780,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)
|
||||
@ -792,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);
|
||||
@ -840,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;
|
||||
@ -939,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(),
|
||||
@ -949,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)) )
|
||||
{
|
||||
@ -977,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;
|
||||
@ -1107,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
|
||||
@ -1166,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
|
||||
@ -1184,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);
|
||||
@ -1319,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
|
||||
|
||||
@ -1432,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
|
||||
{
|
||||
@ -1456,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;
|
||||
}
|
||||
|
||||
@ -1474,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;
|
||||
}
|
||||
|
||||
@ -1491,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;
|
||||
}
|
||||
@ -1502,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 )
|
||||
@ -1615,18 +1402,12 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1659,9 +1440,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()))
|
||||
@ -1717,17 +1495,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())
|
||||
@ -1741,8 +1513,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!
|
||||
@ -1786,14 +1556,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1848,15 +1614,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1911,17 +1673,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!
|
||||
@ -1975,14 +1732,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2012,8 +1765,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 )
|
||||
@ -2080,8 +1831,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 */
|
||||
@ -2152,11 +1901,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)
|
||||
@ -2185,18 +1934,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 )
|
||||
@ -2209,21 +1946,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2239,8 +1964,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
|
||||
@ -2262,53 +1985,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();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -1,10 +1,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// File: region.cpp
|
||||
// Purpose: Region class
|
||||
// Author: Markus Holzem/Julian Smart
|
||||
// Author: Markus Holzem, Julian Smart, Robert Roebling
|
||||
// Created: Fri Oct 24 10:46:34 MET 1997
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1997 Markus Holzem/Julian Smart
|
||||
// Copyright: (c) 1997 Markus Holzem, Julian Smart, Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#include "wx/region.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/window.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#ifdef __VMS__
|
||||
#pragma message disable nosimpint
|
||||
@ -25,514 +25,517 @@
|
||||
#pragma message enable nosimpint
|
||||
#endif
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// list types
|
||||
// wxRegionRefData: private class containing the information about the region
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/listimpl.cpp"
|
||||
|
||||
WX_DEFINE_LIST(wxRectList);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxRegionRefData implementation
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData {
|
||||
class wxRegionRefData : public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
wxRegionRefData()
|
||||
{
|
||||
m_region = XCreateRegion();
|
||||
m_usingRects = FALSE;
|
||||
m_rects = (wxRect*) NULL;
|
||||
m_rectCount = 0;
|
||||
m_region = NULL;
|
||||
}
|
||||
|
||||
wxRegionRefData(const wxRegionRefData& data)
|
||||
|
||||
wxRegionRefData(const wxRegionRefData& refData)
|
||||
{
|
||||
m_region = XCreateRegion();
|
||||
m_rects = (wxRect*) NULL;
|
||||
m_rectCount = 0;
|
||||
XUnionRegion(m_region, data.m_region, m_region);
|
||||
|
||||
SetRects(data.m_rectCount, data.m_rects);
|
||||
XUnionRegion( refData.m_region, m_region, m_region );
|
||||
}
|
||||
|
||||
|
||||
~wxRegionRefData()
|
||||
{
|
||||
XDestroyRegion(m_region);
|
||||
DeleteRects();
|
||||
if (m_region)
|
||||
XDestroyRegion( m_region );
|
||||
}
|
||||
|
||||
wxRect* GetRects() { return m_rects; };
|
||||
void SetRects(const wxRectList& rectList);
|
||||
void SetRects(int count, const wxRect* rects);
|
||||
bool UsingRects() const { return m_usingRects; }
|
||||
int GetRectCount() const { return m_rectCount; }
|
||||
|
||||
void DeleteRects();
|
||||
|
||||
Region m_region;
|
||||
wxRect* m_rects;
|
||||
int m_rectCount;
|
||||
bool m_usingRects; // TRUE if we're using the above.
|
||||
Region m_region;
|
||||
};
|
||||
|
||||
void wxRegionRefData::SetRects(const wxRectList& rectList)
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
|
||||
#define M_REGIONDATA_OF(rgn) ((wxRegionRefData *)(rgn.m_refData))
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRegion construction
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
|
||||
|
||||
void wxRegion::InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
||||
{
|
||||
DeleteRects();
|
||||
m_usingRects = (rectList.Number() > 0);
|
||||
if (m_usingRects)
|
||||
{
|
||||
m_rectCount = rectList.Number();
|
||||
m_rects = new wxRect[m_rectCount];
|
||||
}
|
||||
|
||||
wxRectList::Node* node = rectList.GetFirst();
|
||||
int i = 0;
|
||||
while (node) {
|
||||
wxRect* rect = node->GetData();
|
||||
m_rects[i] = * rect;
|
||||
node = node->GetNext();
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
|
||||
void wxRegionRefData::SetRects(int count, const wxRect* rects)
|
||||
{
|
||||
DeleteRects();
|
||||
m_usingRects = (count > 0);
|
||||
if (m_usingRects)
|
||||
{
|
||||
m_rectCount = count;
|
||||
m_rects = new wxRect[m_rectCount];
|
||||
int i;
|
||||
for (i = 0; i < m_rectCount; i++)
|
||||
m_rects[i] = rects[i];
|
||||
}
|
||||
}
|
||||
|
||||
void wxRegionRefData::DeleteRects()
|
||||
{
|
||||
if (m_rects)
|
||||
{
|
||||
delete[] m_rects;
|
||||
m_rects = (wxRect*) NULL;
|
||||
}
|
||||
m_rectCount = 0;
|
||||
m_usingRects = FALSE;
|
||||
}
|
||||
|
||||
#define M_REGION (((wxRegionRefData*)m_refData)->m_region)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxRegion
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
* Create an empty region.
|
||||
*/
|
||||
wxRegion::wxRegion()
|
||||
{
|
||||
}
|
||||
|
||||
wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
|
||||
XRectangle rect;
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = w;
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = w;
|
||||
rect.height = h;
|
||||
XUnionRectWithRegion(&rect, M_REGION, M_REGION);
|
||||
|
||||
m_refData = new wxRegionRefData();
|
||||
|
||||
M_REGIONDATA->m_region = XCreateRegion();
|
||||
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
|
||||
}
|
||||
|
||||
wxRegion::wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight)
|
||||
wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
#if 0
|
||||
XPoint *xpoints = new XPoint[n];
|
||||
for ( size_t i = 0 ; i < n ; i++ )
|
||||
{
|
||||
xpoints[i].x = points[i].x;
|
||||
xpoints[i].y = points[i].y;
|
||||
}
|
||||
|
||||
XRectangle rect;
|
||||
rect.x = topLeft.x;
|
||||
rect.y = topLeft.y;
|
||||
rect.width = bottomRight.x - topLeft.x;
|
||||
rect.height = bottomRight.y - topLeft.y;
|
||||
XUnionRectWithRegion(&rect, M_REGION, M_REGION);
|
||||
m_refData = new wxRegionRefData();
|
||||
|
||||
Region* reg = gdk_region_polygon
|
||||
(
|
||||
gdkpoints,
|
||||
n,
|
||||
fillStyle == wxWINDING_RULE ? GDK_WINDING_RULE
|
||||
: GDK_EVEN_ODD_RULE
|
||||
);
|
||||
|
||||
M_REGIONDATA->m_region = reg;
|
||||
|
||||
delete [] xpoints;
|
||||
#endif
|
||||
}
|
||||
|
||||
wxRegion::wxRegion(const wxRect& rect)
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
|
||||
XRectangle rect1;
|
||||
rect1.x = rect.x;
|
||||
rect1.y = rect.y;
|
||||
rect1.width = rect.width;
|
||||
rect1.height = rect.height;
|
||||
XUnionRectWithRegion(&rect1, M_REGION, M_REGION);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Destroy the region.
|
||||
*/
|
||||
wxRegion::~wxRegion()
|
||||
{
|
||||
// m_refData unrefed in ~wxObject
|
||||
}
|
||||
|
||||
// Get the internal region handle
|
||||
WXRegion wxRegion::GetXRegion() const
|
||||
wxObjectRefData *wxRegion::CreateRefData() const
|
||||
{
|
||||
wxASSERT( m_refData !=NULL );
|
||||
|
||||
return (WXRegion) ((wxRegionRefData*)m_refData)->m_region;
|
||||
return new wxRegionRefData;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Modify region
|
||||
//-----------------------------------------------------------------------------
|
||||
wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const
|
||||
{
|
||||
return new wxRegionRefData(*(wxRegionRefData *)data);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRegion comparison
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxRegion::operator==( const wxRegion& region )
|
||||
{
|
||||
if (m_refData == region.m_refData) return TRUE;
|
||||
|
||||
if (!m_refData || !region.m_refData) return FALSE;
|
||||
|
||||
// compare the regions themselves, not the pointers to ref data!
|
||||
return XEqualRegion( M_REGIONDATA->m_region,
|
||||
M_REGIONDATA_OF(region)->m_region );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRegion operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//! Clear current region
|
||||
void wxRegion::Clear()
|
||||
{
|
||||
UnRef();
|
||||
}
|
||||
|
||||
//! Combine rectangle (x, y, w, h) with this.
|
||||
bool wxRegion::Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op)
|
||||
bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||
{
|
||||
// Don't change shared data
|
||||
if (!m_refData) {
|
||||
m_refData = new wxRegionRefData();
|
||||
} else if (m_refData->GetRefCount() > 1) {
|
||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||
UnRef();
|
||||
m_refData = new wxRegionRefData(*ref);
|
||||
}
|
||||
// If ref count is 1, that means it's 'ours' anyway so no action.
|
||||
|
||||
Region rectRegion = XCreateRegion();
|
||||
|
||||
XRectangle rect;
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = width;
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = width;
|
||||
rect.height = height;
|
||||
XUnionRectWithRegion(&rect, rectRegion, rectRegion);
|
||||
|
||||
switch (op)
|
||||
|
||||
if (!m_refData)
|
||||
{
|
||||
case wxRGN_AND:
|
||||
XIntersectRegion(M_REGION, rectRegion, M_REGION);
|
||||
break ;
|
||||
case wxRGN_OR:
|
||||
XUnionRegion(M_REGION, rectRegion, M_REGION);
|
||||
break ;
|
||||
case wxRGN_XOR:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_DIFF:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_COPY: // Don't have to do this one
|
||||
default:
|
||||
// TODO
|
||||
break ;
|
||||
m_refData = new wxRegionRefData();
|
||||
M_REGIONDATA->m_region = XCreateRegion();
|
||||
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
|
||||
}
|
||||
else
|
||||
{
|
||||
AllocExclusive();
|
||||
|
||||
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//! Union /e region with this.
|
||||
bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
|
||||
bool wxRegion::Union( const wxRect& rect )
|
||||
{
|
||||
if (region.Empty())
|
||||
return Union( rect.x, rect.y, rect.width, rect.height );
|
||||
}
|
||||
|
||||
bool wxRegion::Union( const wxRegion& region )
|
||||
{
|
||||
if (region.IsNull())
|
||||
return FALSE;
|
||||
|
||||
// Don't change shared data
|
||||
if (!m_refData) {
|
||||
m_refData = new wxRegionRefData();
|
||||
} else if (m_refData->GetRefCount() > 1) {
|
||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||
UnRef();
|
||||
m_refData = new wxRegionRefData(*ref);
|
||||
}
|
||||
|
||||
switch (op)
|
||||
if (!m_refData)
|
||||
{
|
||||
case wxRGN_AND:
|
||||
XIntersectRegion(M_REGION, ((wxRegionRefData*)region.m_refData)->m_region,
|
||||
M_REGION);
|
||||
break ;
|
||||
case wxRGN_OR:
|
||||
XUnionRegion(M_REGION, ((wxRegionRefData*)region.m_refData)->m_region,
|
||||
M_REGION);
|
||||
break ;
|
||||
case wxRGN_XOR:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_DIFF:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_COPY: // Don't have to do this one
|
||||
default:
|
||||
// TODO
|
||||
break ;
|
||||
m_refData = new wxRegionRefData();
|
||||
M_REGIONDATA->m_region = XCreateRegion();
|
||||
}
|
||||
else
|
||||
{
|
||||
AllocExclusive();
|
||||
}
|
||||
|
||||
XUnionRegion( M_REGIONDATA->m_region,
|
||||
M_REGIONDATA_OF(region)->m_region,
|
||||
M_REGIONDATA->m_region );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||
{
|
||||
wxRegion reg( x, y, width, height );
|
||||
|
||||
return Intersect( reg );
|
||||
}
|
||||
|
||||
bool wxRegion::Intersect( const wxRect& rect )
|
||||
{
|
||||
wxRegion reg( rect );
|
||||
|
||||
return Intersect( reg );
|
||||
}
|
||||
|
||||
bool wxRegion::Intersect( const wxRegion& region )
|
||||
{
|
||||
if (region.IsNull())
|
||||
return FALSE;
|
||||
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxRegionRefData();
|
||||
M_REGIONDATA->m_region = XCreateRegion();
|
||||
|
||||
// leave here
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
AllocExclusive();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
XIntersectRegion( M_REGIONDATA->m_region,
|
||||
M_REGIONDATA_OF(region)->m_region,
|
||||
M_REGIONDATA->m_region );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
|
||||
bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||
{
|
||||
return Combine(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight(), op);
|
||||
wxRegion reg( x, y, width, height );
|
||||
return Subtract( reg );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Information on region
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Outer bounds of region
|
||||
void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const
|
||||
bool wxRegion::Subtract( const wxRect& rect )
|
||||
{
|
||||
if (m_refData) {
|
||||
wxRegion reg( rect );
|
||||
return Subtract( reg );
|
||||
}
|
||||
|
||||
bool wxRegion::Subtract( const wxRegion& region )
|
||||
{
|
||||
if (region.IsNull())
|
||||
return FALSE;
|
||||
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxRegionRefData();
|
||||
M_REGIONDATA->m_region = XCreateRegion();
|
||||
}
|
||||
else
|
||||
{
|
||||
AllocExclusive();
|
||||
}
|
||||
|
||||
XSubtractRegion( M_REGIONDATA->m_region,
|
||||
M_REGIONDATA_OF(region)->m_region,
|
||||
M_REGIONDATA->m_region );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxRegion::Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||
{
|
||||
wxRegion reg( x, y, width, height );
|
||||
return Xor( reg );
|
||||
}
|
||||
|
||||
bool wxRegion::Xor( const wxRect& rect )
|
||||
{
|
||||
wxRegion reg( rect );
|
||||
return Xor( reg );
|
||||
}
|
||||
|
||||
bool wxRegion::Xor( const wxRegion& region )
|
||||
{
|
||||
if (region.IsNull())
|
||||
return FALSE;
|
||||
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxRegionRefData();
|
||||
M_REGIONDATA->m_region = XCreateRegion();
|
||||
}
|
||||
else
|
||||
{
|
||||
AllocExclusive();
|
||||
}
|
||||
|
||||
XXorRegion( M_REGIONDATA->m_region,
|
||||
M_REGIONDATA_OF(region)->m_region,
|
||||
M_REGIONDATA->m_region );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRegion tests
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxRegion::GetBox( wxCoord &x, wxCoord &y, wxCoord &w, wxCoord &h ) const
|
||||
{
|
||||
if (m_refData)
|
||||
{
|
||||
XRectangle rect;
|
||||
XClipBox(M_REGION, &rect);
|
||||
XClipBox( M_REGIONDATA->m_region, &rect );
|
||||
x = rect.x;
|
||||
y = rect.y;
|
||||
w = rect.width;
|
||||
h = rect.height;
|
||||
} else {
|
||||
x = y = w = h = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = -1;
|
||||
h = -1;
|
||||
}
|
||||
}
|
||||
|
||||
wxRect wxRegion::GetBox() const
|
||||
{
|
||||
wxCoord x, y, w, h;
|
||||
GetBox(x, y, w, h);
|
||||
return wxRect(x, y, w, h);
|
||||
GetBox( x, y, w, h );
|
||||
return wxRect( x, y, w, h );
|
||||
}
|
||||
|
||||
bool wxRegion::Offset( wxCoord x, wxCoord y )
|
||||
{
|
||||
if (!m_refData)
|
||||
return FALSE;
|
||||
|
||||
AllocExclusive();
|
||||
|
||||
XOffsetRegion( M_REGIONDATA->m_region, x, y );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Is region empty?
|
||||
bool wxRegion::Empty() const
|
||||
{
|
||||
return m_refData ? XEmptyRegion(M_REGION) : TRUE;
|
||||
if (!m_refData)
|
||||
return TRUE;
|
||||
|
||||
return XEmptyRegion( M_REGIONDATA->m_region );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Tests
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Does the region contain the point (x,y)?
|
||||
wxRegionContain wxRegion::Contains(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) const
|
||||
wxRegionContain wxRegion::Contains( wxCoord x, wxCoord y ) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
// TODO. Return wxInRegion if within region.
|
||||
if (0)
|
||||
if (XPointInRegion( M_REGIONDATA->m_region, x, y ))
|
||||
return wxInRegion;
|
||||
return wxOutRegion;
|
||||
else
|
||||
return wxOutRegion;
|
||||
}
|
||||
|
||||
// Does the region contain the point pt?
|
||||
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
||||
wxRegionContain wxRegion::Contains( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
return XPointInRegion(M_REGION, pt.x, pt.y) ? wxInRegion : wxOutRegion;
|
||||
}
|
||||
|
||||
// Does the region contain the rectangle (x, y, w, h)?
|
||||
wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
switch (XRectInRegion(M_REGION, x, y, w, h)) {
|
||||
case RectangleIn: return wxInRegion;
|
||||
int res = XRectInRegion( M_REGIONDATA->m_region, x, y, w, h );
|
||||
switch (res)
|
||||
{
|
||||
case RectangleIn: return wxInRegion;
|
||||
case RectangleOut: return wxOutRegion;
|
||||
case RectanglePart: return wxPartRegion;
|
||||
}
|
||||
return wxOutRegion;
|
||||
}
|
||||
|
||||
// Does the region contain the rectangle rect
|
||||
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
||||
{
|
||||
return Contains( pt.x, pt.y );
|
||||
}
|
||||
|
||||
wxRegionContain wxRegion::Contains(const wxRect& rect) const
|
||||
{
|
||||
return Contains( rect.x, rect.y, rect.width, rect.height );
|
||||
}
|
||||
|
||||
WXRegion *wxRegion::GetX11Region() const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
return (WXRegion*) NULL;
|
||||
|
||||
wxCoord x, y, w, h;
|
||||
x = rect.x;
|
||||
y = rect.y;
|
||||
w = rect.GetWidth();
|
||||
h = rect.GetHeight();
|
||||
return Contains(x, y, w, h);
|
||||
return (WXRegion*) M_REGIONDATA->m_region;
|
||||
}
|
||||
|
||||
bool wxRegion::UsingRects() const
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRegionIterator
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the following structures must match the private structures
|
||||
// in X11 region code ( xc/lib/X11/region.h )
|
||||
|
||||
// this makes the Region type transparent
|
||||
// and we have access to the region rectangles
|
||||
|
||||
struct _XBox {
|
||||
short x1, x2, y1, y2;
|
||||
};
|
||||
|
||||
struct _XRegion {
|
||||
long size , numRects;
|
||||
_XBox *rects, extents;
|
||||
};
|
||||
|
||||
class wxRIRefData: public wxObjectRefData
|
||||
{
|
||||
return ((wxRegionRefData*)m_refData)->UsingRects();
|
||||
}
|
||||
public:
|
||||
|
||||
/*
|
||||
wxRectList& wxRegion::GetRectList()
|
||||
wxRIRefData() : m_rects(0), m_numRects(0){}
|
||||
~wxRIRefData();
|
||||
|
||||
wxRect *m_rects;
|
||||
size_t m_numRects;
|
||||
|
||||
void CreateRects( const wxRegion& r );
|
||||
};
|
||||
|
||||
wxRIRefData::~wxRIRefData()
|
||||
{
|
||||
return ((wxRegionRefData*)m_refData)->GetRectList();
|
||||
}
|
||||
*/
|
||||
|
||||
wxRect* wxRegion::GetRects()
|
||||
{
|
||||
return ((wxRegionRefData*)m_refData)->GetRects();
|
||||
delete m_rects;
|
||||
}
|
||||
|
||||
int wxRegion::GetRectCount() const
|
||||
{
|
||||
return ((wxRegionRefData*)m_refData)->GetRectCount();
|
||||
}
|
||||
|
||||
void wxRegion::SetRects(const wxRectList& rectList)
|
||||
{
|
||||
((wxRegionRefData*)m_refData)->SetRects(rectList);
|
||||
}
|
||||
|
||||
void wxRegion::SetRects(int count, const wxRect* rects)
|
||||
{
|
||||
((wxRegionRefData*)m_refData)->SetRects(count, rects);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// wxRegionIterator //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*!
|
||||
* Initialize empty iterator
|
||||
*/
|
||||
wxRegionIterator::wxRegionIterator() : m_current(0), m_numRects(0), m_rects(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
wxRegionIterator::~wxRegionIterator()
|
||||
void wxRIRefData::CreateRects( const wxRegion& region )
|
||||
{
|
||||
if (m_rects)
|
||||
delete[] m_rects;
|
||||
}
|
||||
delete m_rects;
|
||||
|
||||
/*!
|
||||
* Initialize iterator for region
|
||||
*/
|
||||
wxRegionIterator::wxRegionIterator(const wxRegion& region)
|
||||
{
|
||||
m_rects = NULL;
|
||||
|
||||
Reset(region);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Reset iterator for a new /e region.
|
||||
*/
|
||||
void wxRegionIterator::Reset(const wxRegion& region)
|
||||
{
|
||||
m_current = 0;
|
||||
m_region = region;
|
||||
|
||||
if (m_rects)
|
||||
delete[] m_rects;
|
||||
|
||||
m_rects = NULL;
|
||||
|
||||
if (m_region.Empty())
|
||||
m_numRects = 0;
|
||||
else
|
||||
m_rects = 0;
|
||||
m_numRects = 0;
|
||||
|
||||
if (region.IsEmpty()) return;
|
||||
|
||||
Region r = (Region) region.GetX11Region();
|
||||
if (r)
|
||||
{
|
||||
// Create m_rects and fill with rectangles for this region.
|
||||
// Since we can't find the rectangles in a region, we cheat
|
||||
// by retrieving the rectangles explicitly set in wxPaintDC::wxPaintDC
|
||||
// (dcclient.cpp).
|
||||
if (m_region.UsingRects())
|
||||
m_numRects = r->numRects;
|
||||
if (m_numRects)
|
||||
{
|
||||
wxRect* rects = m_region.GetRects();
|
||||
int count = m_region.GetRectCount();
|
||||
m_numRects = count;
|
||||
m_rects = new wxRect[m_numRects];
|
||||
|
||||
for (size_t i = 0; i < m_numRects; i++)
|
||||
m_rects[i] = rects[i];
|
||||
|
||||
/*
|
||||
int i = 0;
|
||||
wxRectList::Node* node = rectList.GetFirst();
|
||||
while (node) {
|
||||
wxRect* rect = node->GetData();
|
||||
m_rects[i] = * rect;
|
||||
node = node->GetNext();
|
||||
i ++;
|
||||
for (size_t i=0; i < m_numRects; ++i)
|
||||
{
|
||||
_XBox &xr = r->rects[i];
|
||||
wxRect &wr = m_rects[i];
|
||||
wr.x = xr.x1;
|
||||
wr.y = xr.y1;
|
||||
wr.width = xr.x2-xr.x1;
|
||||
wr.height = xr.y2-xr.y1;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
// For now, fudge by getting the whole bounding box.
|
||||
m_rects = new wxRect[1];
|
||||
m_numRects = 1;
|
||||
m_rects[0] = m_region.GetBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Increment iterator. The rectangle returned is the one after the
|
||||
* incrementation.
|
||||
*/
|
||||
void wxRegionIterator::operator ++ ()
|
||||
wxRegionIterator::wxRegionIterator()
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
++m_current;
|
||||
m_refData = new wxRIRefData();
|
||||
Reset();
|
||||
}
|
||||
|
||||
wxRegionIterator::wxRegionIterator( const wxRegion& region )
|
||||
{
|
||||
m_refData = new wxRIRefData();
|
||||
Reset(region);
|
||||
}
|
||||
|
||||
void wxRegionIterator::Reset( const wxRegion& region )
|
||||
{
|
||||
m_region = region;
|
||||
((wxRIRefData*)m_refData)->CreateRects(region);
|
||||
Reset();
|
||||
}
|
||||
|
||||
bool wxRegionIterator::HaveRects() const
|
||||
{
|
||||
return m_current < ((wxRIRefData*)m_refData)->m_numRects;
|
||||
}
|
||||
|
||||
wxRegionIterator::operator bool () const
|
||||
{
|
||||
return HaveRects();
|
||||
}
|
||||
|
||||
void wxRegionIterator::operator ++ ()
|
||||
{
|
||||
if (HaveRects()) ++m_current;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Increment iterator. The rectangle returned is the one before the
|
||||
* incrementation.
|
||||
*/
|
||||
void wxRegionIterator::operator ++ (int)
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
++m_current;
|
||||
if (HaveRects()) ++m_current;
|
||||
}
|
||||
|
||||
wxCoord wxRegionIterator::GetX() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].x;
|
||||
return 0;
|
||||
if( !HaveRects() ) return 0;
|
||||
return ((wxRIRefData*)m_refData)->m_rects[m_current].x;
|
||||
}
|
||||
|
||||
wxCoord wxRegionIterator::GetY() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].y;
|
||||
return 0;
|
||||
if( !HaveRects() ) return 0;
|
||||
return ((wxRIRefData*)m_refData)->m_rects[m_current].y;
|
||||
}
|
||||
|
||||
wxCoord wxRegionIterator::GetW() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].width ;
|
||||
return 0;
|
||||
if( !HaveRects() ) return -1;
|
||||
return ((wxRIRefData*)m_refData)->m_rects[m_current].width;
|
||||
}
|
||||
|
||||
wxCoord wxRegionIterator::GetH() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].height;
|
||||
return 0;
|
||||
if( !HaveRects() ) return -1;
|
||||
return ((wxRIRefData*)m_refData)->m_rects[m_current].height;
|
||||
}
|
||||
|
||||
wxRect wxRegionIterator::GetRect() const
|
||||
{
|
||||
wxRect r;
|
||||
if( HaveRects() )
|
||||
r = ((wxRIRefData*)m_refData)->m_rects[m_current];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -103,10 +103,6 @@ void wxWindowX11::Init()
|
||||
m_needsRefresh = TRUE;
|
||||
m_mainWidget = (WXWindow) 0;
|
||||
|
||||
m_button1Pressed =
|
||||
m_button2Pressed =
|
||||
m_button3Pressed = FALSE;
|
||||
|
||||
m_winCaptured = FALSE;
|
||||
|
||||
m_isShown = TRUE;
|
||||
@ -124,13 +120,6 @@ void wxWindowX11::Init()
|
||||
m_scrollPosX =
|
||||
m_scrollPosY = 0;
|
||||
|
||||
m_backingPixmap = (WXPixmap) 0;
|
||||
m_pixmapWidth =
|
||||
m_pixmapHeight = 0;
|
||||
|
||||
m_pixmapOffsetX =
|
||||
m_pixmapOffsetY = 0;
|
||||
|
||||
m_lastTS = 0;
|
||||
m_lastButton = 0;
|
||||
m_canAddEventHandler = FALSE;
|
||||
@ -231,8 +220,6 @@ wxWindowX11::~wxWindowX11()
|
||||
//DetachWidget(wMain);
|
||||
}
|
||||
|
||||
ClearUpdateRects();
|
||||
|
||||
if ( m_parent )
|
||||
m_parent->RemoveChild( this );
|
||||
|
||||
@ -1280,31 +1267,39 @@ void wxWindowX11::Clear()
|
||||
dc.Clear();
|
||||
}
|
||||
|
||||
void wxWindowX11::ClearUpdateRects()
|
||||
void wxWindowX11::X11SendPaintEvents()
|
||||
{
|
||||
wxRectList::Node* node = m_updateRects.GetFirst();
|
||||
while (node)
|
||||
m_clipPaintRegion = TRUE;
|
||||
|
||||
if (!m_clearRegion.IsEmpty())
|
||||
{
|
||||
wxRect* rect = node->GetData();
|
||||
delete rect;
|
||||
node = node->GetNext();
|
||||
wxWindowDC dc( (wxWindow*)this );
|
||||
dc.SetClippingRegion( m_clearRegion );
|
||||
|
||||
wxEraseEvent erase_event( GetId(), &dc );
|
||||
erase_event.SetEventObject( this );
|
||||
|
||||
if (!GetEventHandler()->ProcessEvent(erase_event))
|
||||
{
|
||||
wxRegionIterator upd( m_clearRegion );
|
||||
while (upd)
|
||||
{
|
||||
// XClearArea( ... , upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
|
||||
upd ++;
|
||||
}
|
||||
}
|
||||
m_clearRegion.Clear();
|
||||
}
|
||||
|
||||
m_updateRects.Clear();
|
||||
}
|
||||
wxNcPaintEvent nc_paint_event( GetId() );
|
||||
nc_paint_event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent( nc_paint_event );
|
||||
|
||||
void wxWindowX11::DoPaint()
|
||||
{
|
||||
// Set an erase event first
|
||||
wxEraseEvent eraseEvent(GetId());
|
||||
eraseEvent.SetEventObject(this);
|
||||
GetEventHandler()->ProcessEvent(eraseEvent);
|
||||
|
||||
wxPaintEvent event(GetId());
|
||||
event.SetEventObject(this);
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
m_needsRefresh = FALSE;
|
||||
wxPaintEvent paint_event( GetId() );
|
||||
paint_event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent( paint_event );
|
||||
|
||||
m_clipPaintRegion = FALSE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1600,19 +1595,16 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
|
||||
if (xevent->xbutton.button == Button1)
|
||||
{
|
||||
eventType = wxEVT_LEFT_DOWN;
|
||||
win->SetButton1(TRUE);
|
||||
button = 1;
|
||||
}
|
||||
else if (xevent->xbutton.button == Button2)
|
||||
{
|
||||
eventType = wxEVT_MIDDLE_DOWN;
|
||||
win->SetButton2(TRUE);
|
||||
button = 2;
|
||||
}
|
||||
else if (xevent->xbutton.button == Button3)
|
||||
{
|
||||
eventType = wxEVT_RIGHT_DOWN;
|
||||
win->SetButton3(TRUE);
|
||||
button = 3;
|
||||
}
|
||||
|
||||
@ -1646,17 +1638,14 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
|
||||
if (xevent->xbutton.button == Button1)
|
||||
{
|
||||
eventType = wxEVT_LEFT_UP;
|
||||
win->SetButton1(FALSE);
|
||||
}
|
||||
else if (xevent->xbutton.button == Button2)
|
||||
{
|
||||
eventType = wxEVT_MIDDLE_UP;
|
||||
win->SetButton2(FALSE);
|
||||
}
|
||||
else if (xevent->xbutton.button == Button3)
|
||||
{
|
||||
eventType = wxEVT_RIGHT_UP;
|
||||
win->SetButton3(FALSE);
|
||||
}
|
||||
else return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user