INtroduced OnInternalIdle as per wxGTK so that users
cannot as easily lill the internals.
Fixed pop-up transient window.
Removed some #if 0 here and there.
Made refresh code work in idle instead of directly.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14176
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// smaller
virtual wxPoint GetClientAreaOrigin() const;
// smaller
virtual wxPoint GetClientAreaOrigin() const;
-protected:
- // event handlers (not virtual by design)
- void OnIdle(wxIdleEvent& event);
+ // I don't want users to override what's done in idle so everything that
+ // has to be done in idle time in order for wxX11 to work is done in
+ // OnInternalIdle
+ virtual void OnInternalIdle();
+
+ // For compatibility across platforms (not in event table)
+ void OnIdle(wxIdleEvent& WXUNUSED(event)) {}
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
+ // Schedule update for later
win->GetUpdateRegion().Union( event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
win->GetUpdateRegion().Union( event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
- if (event->xexpose.count == 0)
- {
- win->X11SendPaintEvents(); // TODO let an idle handler do that
- }
void wxApp::OnIdle(wxIdleEvent& event)
{
void wxApp::OnIdle(wxIdleEvent& event)
{
- static bool inOnIdle = FALSE;
+ static bool s_inOnIdle = FALSE;
// Avoid recursion (via ProcessEvent default case)
// Avoid recursion (via ProcessEvent default case)
- inOnIdle = TRUE;
-
- // If there are pending events, we must process them: pending events
- // are either events to the threads other than main or events posted
- // with wxPostEvent() functions
- // GRG: I have moved this here so that all pending events are processed
- // before starting to delete any objects. This behaves better (in
- // particular, wrt wxPostEvent) and is coherent with wxGTK's current
- // behaviour. Also removed the '#if wxUSE_THREADS' around it.
- // Changed Mar/2000 before 2.1.14
- // Flush pending events.
+ // Resend in the main thread events which have been prepared in other
+ // threads
- // 'Garbage' collection of windows deleted with Close().
+ // 'Garbage' collection of windows deleted with Close()
- // flush the logged messages if any
- wxLog *pLog = wxLog::GetActiveTarget();
- if ( pLog != NULL && pLog->HasPendingMessages() )
- pLog->Flush();
-
// Send OnIdle events to all windows
bool needMore = SendIdleEvents();
if (needMore)
event.RequestMore(TRUE);
// Send OnIdle events to all windows
bool needMore = SendIdleEvents();
if (needMore)
event.RequestMore(TRUE);
wxIdleEvent event;
event.SetEventObject(win);
wxIdleEvent event;
event.SetEventObject(win);
- win->ProcessEvent(event);
+
+ win->GetEventHandler()->ProcessEvent(event);
+
+ win->OnInternalIdle();
if (event.MoreRequested())
needMore = TRUE;
if (event.MoreRequested())
needMore = TRUE;
}
void wxApp::DeletePendingObjects()
}
void wxApp::DeletePendingObjects()
m_textGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxTEXT_SCREEN );
m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBG_SCREEN );
}
m_textGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxTEXT_SCREEN );
m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBG_SCREEN );
}
else
if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1))
{
else
if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1))
{
m_textGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxTEXT_MONO );
m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBG_MONO );
}
m_textGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxTEXT_MONO );
m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBG_MONO );
}
else
{
m_penGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxPEN_COLOUR );
else
{
m_penGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxPEN_COLOUR );
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
-
- wxLogDebug("Drawing line at %d, %d -> %d, %d", XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
CalcBoundingBox( x, y );
CalcBoundingBox( x + width, y + height );
CalcBoundingBox( x, y );
CalcBoundingBox( x + width, y + height );
- wxLogDebug("Drawing rectangle at %d, %d (%dx%d)", x, y, width, height);
}
void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
}
void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
else
{
XSetFillStyle( (Display*) m_display, (GC) m_brushGC, FillStippled );
else
{
XSetFillStyle( (Display*) m_display, (GC) m_brushGC, FillStippled );
-// XSetStipple( (Display*) m_display, (GC) m_brushGC, (Pixmap) m_brush.GetStipple()->GetBitmap() );
+ XSetStipple( (Display*) m_display, (GC) m_brushGC, (Pixmap) m_brush.GetStipple()->GetBitmap() );
}
}
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{
XSetFillStyle( (Display*) m_display, (GC) m_textGC, FillOpaqueStippled );
}
}
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{
XSetFillStyle( (Display*) m_display, (GC) m_textGC, FillOpaqueStippled );
-// XSetStipple( (Display*) m_display, (GC) m_textGC, (Pixmap) m_brush.GetStipple()->GetMask()->GetBitmap() );
+ XSetStipple( (Display*) m_display, (GC) m_textGC, (Pixmap) m_brush.GetStipple()->GetMask()->GetBitmap() );
}
if (IS_HATCH(m_brush.GetStyle()))
}
if (IS_HATCH(m_brush.GetStyle()))
else
{
XSetFillStyle( (Display*) m_display, (GC) m_bgGC, FillStippled );
else
{
XSetFillStyle( (Display*) m_display, (GC) m_bgGC, FillStippled );
-// XSetStipple( (Display*) m_display, (GC) m_bgGC, (Pixmap) m_backgroundBrush.GetStipple()->GetBitmap() );
+ XSetStipple( (Display*) m_display, (GC) m_bgGC, (Pixmap) m_backgroundBrush.GetStipple()->GetBitmap() );
long xattributes_mask =
CWOverrideRedirect |
long xattributes_mask =
CWOverrideRedirect |
CWBorderPixel | CWBackPixel;
xattributes.background_pixel = BlackPixel( xdisplay, xscreen );
xattributes.border_pixel = BlackPixel( xdisplay, xscreen );
CWBorderPixel | CWBackPixel;
xattributes.background_pixel = BlackPixel( xdisplay, xscreen );
xattributes.border_pixel = BlackPixel( xdisplay, xscreen );
-
- // Trying True in order to stop WM decorating it
- //xattributes.override_redirect = False;
- xattributes.override_redirect = TRUE;
+ xattributes.override_redirect = True;
+ xattributes.save_under = True;
Window xwindow = XCreateWindow( xdisplay, xparent, pos.x, pos.y, size.x, size.y,
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
Window xwindow = XCreateWindow( xdisplay, xparent, pos.x, pos.y, size.x, size.y,
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-static const int SCROLL_MARGIN = 4;
-
// ----------------------------------------------------------------------------
// global variables for this module
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// global variables for this module
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxWindowX11, wxWindowBase)
EVT_SYS_COLOUR_CHANGED(wxWindowX11::OnSysColourChanged)
BEGIN_EVENT_TABLE(wxWindowX11, wxWindowBase)
EVT_SYS_COLOUR_CHANGED(wxWindowX11::OnSysColourChanged)
- EVT_IDLE(wxWindowX11::OnIdle)
END_EVENT_TABLE()
// ============================================================================
END_EVENT_TABLE()
// ============================================================================
int *descent, int *externalLeading,
const wxFont *theFont) const
{
int *descent, int *externalLeading,
const wxFont *theFont) const
{
- wxFont *fontToUse = (wxFont *)theFont;
- if (!fontToUse)
- fontToUse = (wxFont *) & m_font;
+ wxFont fontToUse = m_font;
+ if (theFont) fontToUse = *theFont;
- wxCHECK_RET( fontToUse->Ok(), "valid window font needed" );
-
- WXFontStructPtr pFontStruct = theFont->GetFontStruct(1.0, GetXDisplay());
+ wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") );
+
+ WXFontStructPtr pFontStruct = fontToUse.GetFontStruct(1.0, GetXDisplay());
int direction, ascent, descent2;
XCharStruct overall;
int direction, ascent, descent2;
XCharStruct overall;
&ascent, &descent2, &overall);
#endif
&ascent, &descent2, &overall);
#endif
- XTextExtents((XFontStruct*) pFontStruct, string, slen,
+ XTextExtents((XFontStruct*) pFontStruct, string.c_str(), slen,
&direction, &ascent, &descent2, &overall);
if ( x )
&direction, &ascent, &descent2, &overall);
if ( x )
- int height,width;
- GetSize( &width, &height );
+ int height,width;
+ GetSize( &width, &height );
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
m_updateRegion.Clear();
m_updateRegion.Union( 0, 0, width, height );
}
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
m_updateRegion.Clear();
m_updateRegion.Union( 0, 0, width, height );
}
-
- // Actually don't schedule yet..
- Update();
}
void wxWindowX11::Update()
}
void wxWindowX11::Update()
paint_event.SetEventObject( this );
GetEventHandler()->ProcessEvent( paint_event );
paint_event.SetEventObject( this );
GetEventHandler()->ProcessEvent( paint_event );
+ m_updateRegion.Clear();
+
m_clipPaintRegion = FALSE;
}
m_clipPaintRegion = FALSE;
}
-void wxWindowX11::OnIdle(wxIdleEvent& WXUNUSED(event))
+void wxWindowX11::OnInternalIdle()
+ // Update invalidated regions.
+ Update();
+
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
UpdateWindowUI();
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
UpdateWindowUI();