// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "app.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
- EVT_IDLE(wxApp::OnIdle)
+ EVT_IDLE(wxAppBase::OnIdle)
END_EVENT_TABLE()
bool wxApp::Initialize(int& argc, wxChar **argv)
gs_pfnXErrorHandler = XSetErrorHandler( wxXErrorHandler );
#endif // __WXDEBUG__
- char *displayName = NULL;
+ wxString displayName;
bool syncDisplay = FALSE;
int argcOrig = argc;
if (wxSscanf(argv[i], _T("%dx%d"), &w, &h) != 2)
{
wxLogError( _("Invalid geometry specification '%s'"),
- wxString::FromAscii(argv[i]).c_str() );
+ wxString(argv[i]).c_str() );
}
else
{
}
// X11 display stuff
- Display *xdisplay = XOpenDisplay( displayName );
+ Display *xdisplay;
+ if ( displayName.empty() )
+ xdisplay = XOpenDisplay( NULL );
+ else
+ xdisplay = XOpenDisplay( displayName.ToAscii() );
if (!xdisplay)
{
wxLogError( _("wxWindows could not open display. Exiting.") );
return FALSE;
}
-void wxApp::OnIdle(wxIdleEvent& event)
-{
- static bool s_inOnIdle = FALSE;
-
- // Avoid recursion (via ProcessEvent default case)
- if (s_inOnIdle)
- return;
-
- s_inOnIdle = TRUE;
-
- // Resend in the main thread events which have been prepared in other
- // threads
- ProcessPendingEvents();
-
- // 'Garbage' collection of windows deleted with Close()
- DeletePendingObjects();
-
- // Send OnIdle events to all windows
- bool needMore = SendIdleEvents();
-
- if (needMore)
- event.RequestMore(TRUE);
-
- s_inOnIdle = FALSE;
-}
-
void wxApp::WakeUpIdle()
{
// TODO: use wxMotif implementation?
Window wxGetWindowParent(Window window)
{
- wxASSERT_MSG( window, "invalid window" );
+ wxASSERT_MSG( window, _T("invalid window") );
return (Window) 0;