// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "app.h"
#endif
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.") );
m_mainColormap = (WXColormap) NULL;
m_topLevelWidget = (WXWindow) NULL;
m_maxRequestSize = 0;
- m_mainLoop = NULL;
m_showIconic = FALSE;
m_initialSize = wxDefaultSize;
#endif
}
-bool wxApp::Initialized()
-{
- if (GetTopWindow())
- return TRUE;
- else
- return FALSE;
-}
-
-int wxApp::MainLoop()
-{
- int rt;
- m_mainLoop = new wxEventLoop;
-
- rt = m_mainLoop->Run();
-
- delete m_mainLoop;
- m_mainLoop = NULL;
- return rt;
-}
-
#if !wxUSE_NANOX
//-----------------------------------------------------------------------
// X11 predicate function for exposure compression
#if !wxUSE_NANOX
case GraphicsExpose:
{
- printf( "GraphicExpose event\n" );
-
wxLogTrace( _T("expose"), _T("GraphicsExpose from %s"), win->GetName().c_str());
win->GetUpdateRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y,
return win->GetEventHandler()->ProcessEvent( wxevent );
}
case FocusIn:
- {
#if !wxUSE_NANOX
- if ((event->xfocus.detail != NotifyPointer) &&
- (event->xfocus.mode == NotifyNormal))
+ if ((event->xfocus.detail != NotifyPointer) &&
+ (event->xfocus.mode == NotifyNormal))
#endif
+ {
+ wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+
+ extern wxWindow* g_GettingFocus;
+ if (g_GettingFocus && g_GettingFocus->GetParent() == win)
{
- wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+ // Ignore this, this can be a spurious FocusIn
+ // caused by a child having its focus set.
+ g_GettingFocus = NULL;
+ wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s being deliberately ignored"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+ return TRUE;
+ }
+ else
+ {
+ wxFocusEvent focusEvent(wxEVT_SET_FOCUS, win->GetId());
+ focusEvent.SetEventObject(win);
+ focusEvent.SetWindow( g_prevFocus );
+ g_prevFocus = NULL;
- extern wxWindow* g_GettingFocus;
- if (g_GettingFocus && g_GettingFocus->GetParent() == win)
- {
- // Ignore this, this can be a spurious FocusIn
- // caused by a child having its focus set.
- g_GettingFocus = NULL;
- wxLogTrace( _T("focus"), _T("FocusIn from %s of type %s being deliberately ignored"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
- return TRUE;
- }
- else
- {
- wxFocusEvent focusEvent(wxEVT_SET_FOCUS, win->GetId());
- focusEvent.SetEventObject(win);
- focusEvent.SetWindow( g_prevFocus );
- g_prevFocus = NULL;
-
- return win->GetEventHandler()->ProcessEvent(focusEvent);
- }
+ return win->GetEventHandler()->ProcessEvent(focusEvent);
}
- return FALSE;
- break;
}
+ return FALSE;
+
case FocusOut:
- {
#if !wxUSE_NANOX
- if ((event->xfocus.detail != NotifyPointer) &&
- (event->xfocus.mode == NotifyNormal))
+ if ((event->xfocus.detail != NotifyPointer) &&
+ (event->xfocus.mode == NotifyNormal))
#endif
- {
- wxLogTrace( _T("focus"), _T("FocusOut from %s of type %s"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+ {
+ wxLogTrace( _T("focus"), _T("FocusOut from %s of type %s"), win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
- wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
- focusEvent.SetEventObject(win);
- focusEvent.SetWindow( g_nextFocus );
- g_nextFocus = NULL;
- return win->GetEventHandler()->ProcessEvent(focusEvent);
- }
- return FALSE;
- break;
+ wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
+ focusEvent.SetEventObject(win);
+ focusEvent.SetWindow( g_nextFocus );
+ g_nextFocus = NULL;
+ return win->GetEventHandler()->ProcessEvent(focusEvent);
}
- default:
- {
+ return FALSE;
+
#ifdef __WXDEBUG__
+ default:
//wxString eventName = wxGetXEventName(XEvent& event);
//wxLogDebug(wxT("Event %s not handled"), eventName.c_str());
-#endif
- return FALSE;
break;
- }
+#endif // __WXDEBUG__
}
- return FALSE;
-}
-
-void wxApp::ExitMainLoop()
-{
- if (m_mainLoop)
- m_mainLoop->Exit(0);
-}
-
-// Is a message/event pending?
-bool wxApp::Pending()
-{
- return wxEventLoop::GetActive()->Pending();
-}
-// Dispatch a message.
-void wxApp::Dispatch()
-{
- wxEventLoop::GetActive()->Dispatch();
+ return FALSE;
}
// This should be redefined in a derived class for
Window wxGetWindowParent(Window window)
{
- wxASSERT_MSG( window, "invalid window" );
+ wxASSERT_MSG( window, _T("invalid window") );
return (Window) 0;
int i;
for (i = 0; i < 2; i++)
{
- bool s_inYield = FALSE;
+ static bool s_inYield = FALSE;
if ( s_inYield )
{