// arrange status bar, toolbar etc.
virtual bool PreResize();
- // Generates paint events
- void X11SendPaintEvents();
+ // Generates paint events from m_updateRegion
+ void SendPaintEvents();
+
+ // Generates erase events from m_clearRegion
+ void SendEraseEvents();
// Clip to paint region?
bool GetClipPaintRegion() { return m_clipPaintRegion; }
dc.SetBrush( *wxRED_BRUSH );
dc.DrawRectangle( 100, 100, 200, 200 );
+
+ dc.DestroyClipingRegion();
+
+ dc.SetPen( *wxTRANSPARENT_PEN );
+
+ wxRegion strip( 110, 200, 30, 1 );
+ wxRegionIterator it( strip );
+ while (it)
+ {
+ dc.DrawRectangle( it.GetX(), it.GetY(), it.GetWidth(), it.GetHeight() );
+ it ++;
+ }
}
void MyCanvas::OnEraseBackground( wxEraseEvent &event )
else
{
m_refData = new wxColourRefData();
+
if (!gdk_color_parse( colourName.mb_str(), &M_COLDATA->m_color ))
{
// VZ: asserts are good in general but this one is triggered by
else
{
m_refData = new wxColourRefData();
+
if (!gdk_color_parse( colourName.mb_str(), &M_COLDATA->m_color ))
{
// VZ: asserts are good in general but this one is triggered by
win->GetClearRegion().Union( event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
-
- // if (event->xexpose.count == 0)
- // win->Update();
+
+ if (event->xexpose.count == 0)
+ {
+ // Only erase background, paint in idle time.
+ win->SendEraseEvents();
+ }
}
return;
win->GetClearRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y,
event->xgraphicsexpose.width, event->xgraphicsexpose.height);
- // if (event->xgraphicsexpose.count == 0)
- // win->Update();
+ if (event->xgraphicsexpose.count == 0)
+ {
+ // Only erase background, paint in idle time.
+ win->SendEraseEvents();
+ }
}
return;
#endif
#include "wx/gdicmn.h"
+#include "wx/app.h"
#include "wx/x11/private.h"
else
{
m_refData = new wxColourRefData();
+
+ M_COLDATA->m_colormap = wxTheApp->GetMainColormap( wxGlobalDisplay() );
+
if (!XParseColor( wxGlobalDisplay(), (Colormap) M_COLDATA->m_colormap, colourName.mb_str(), &M_COLDATA->m_color ))
{
// VZ: asserts are good in general but this one is triggered by
void wxColour::CalcPixel( WXColormap cmap )
{
- if (!Ok()) return;
+ wxCHECK_RET( Ok(), wxT("invalid colour") );
+
+ wxCHECK_RET( cmap, wxT("invalid colormap") );
M_COLDATA->AllocColour( cmap );
}
if (m_pen.GetStyle () != wxTRANSPARENT)
{
XDrawRectangle( (Display*) m_display, (Window) m_window,
- (GC) m_penGC, xx, yy, ww, hh );
+ (GC) m_penGC, xx, yy, ww-1, hh-1 );
}
}
return;
}
- wxLogDebug("Grabbed pointer");
+ /// wxLogDebug("Grabbed pointer");
#if 0
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
XUngrabKeyboard( wxGlobalDisplay(), CurrentTime );
#endif
}
- wxLogDebug("Ungrabbed pointer");
+
+ // wxLogDebug("Ungrabbed pointer");
m_winCaptured = FALSE;
}
{
if (!m_updateRegion.IsEmpty())
{
- // Actually send erase and paint events.
- X11SendPaintEvents();
+ // Actually send erase events.
+ SendEraseEvents();
+
+ // Actually send paint events.
+ SendPaintEvents();
}
}
dc.Clear();
}
-void wxWindowX11::X11SendPaintEvents()
+void wxWindowX11::SendEraseEvents()
{
- m_clipPaintRegion = TRUE;
-
if (!m_clearRegion.IsEmpty())
{
+ m_clipPaintRegion = TRUE;
+
wxWindowDC dc( (wxWindow*)this );
dc.SetClippingRegion( m_clearRegion );
XFreeGC( xdisplay, xgc );
}
m_clearRegion.Clear();
+
+ m_clipPaintRegion = FALSE;
}
+}
+
+
+void wxWindowX11::SendPaintEvents()
+{
+ m_clipPaintRegion = TRUE;
wxNcPaintEvent nc_paint_event( GetId() );
nc_paint_event.SetEventObject( this );