#include "wx/memory.h"
#include "wx/gdicmn.h"
#include "wx/module.h"
+ #include "wx/crt.h"
#endif
#include "wx/evtloop.h"
// X11 error handling
//------------------------------------------------------------------------
-#ifdef __WXDEBUG__
typedef int (*XErrorHandlerFunc)(Display *, XErrorEvent *);
XErrorHandlerFunc gs_pfnXErrorHandler = 0;
else
return 0;
}
-#endif // __WXDEBUG__
//------------------------------------------------------------------------
// wxApp
bool wxApp::Initialize(int& argC, wxChar **argV)
{
-#if defined(__WXDEBUG__) && !wxUSE_NANOX
+#if !wxUSE_NANOX
// install the X error handler
gs_pfnXErrorHandler = XSetErrorHandler( wxXErrorHandler );
-#endif // __WXDEBUG__
+#endif
wxString displayName;
bool syncDisplay = false;
return false;
}
-#ifdef __WXDEBUG__
- wxString windowClass = win->GetClassInfo()->GetClassName();
-#endif
switch (event->type)
{
// wxLogDebug( "OnKey from %s", win->GetName().c_str() );
// We didn't process wxEVT_KEY_DOWN, so send wxEVT_CHAR
- if (win->GetEventHandler()->ProcessEvent( keyEvent ))
+ if (win->HandleWindowEvent( keyEvent ))
return true;
keyEvent.SetEventType(wxEVT_CHAR);
// Do the translation again, retaining the ASCII
// code.
if (wxTranslateKeyEvent(keyEvent, win, window, event, true) &&
- win->GetEventHandler()->ProcessEvent( keyEvent ))
+ win->HandleWindowEvent( keyEvent ))
return true;
if ( (keyEvent.m_keyCode == WXK_TAB) &&
/* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
new_event.SetWindowChange( keyEvent.ControlDown() );
new_event.SetCurrentFocus( win );
- return win->GetParent()->GetEventHandler()->ProcessEvent( new_event );
+ return win->GetParent()->HandleWindowEvent( new_event );
}
return false;
wxKeyEvent keyEvent(wxEVT_KEY_UP);
wxTranslateKeyEvent(keyEvent, win, window, event);
- return win->GetEventHandler()->ProcessEvent( keyEvent );
+ return win->HandleWindowEvent( keyEvent );
}
case ConfigureNotify:
{
wxSizeEvent sizeEvent( wxSize(XConfigureEventGetWidth(event), XConfigureEventGetHeight(event)), win->GetId() );
sizeEvent.SetEventObject( win );
- return win->GetEventHandler()->ProcessEvent( sizeEvent );
+ return win->HandleWindowEvent( sizeEvent );
}
}
return false;
}
#if !wxUSE_NANOX
case PropertyNotify:
- {
- //wxLogDebug("PropertyNotify: %s", windowClass.c_str());
return HandlePropertyChange(_event);
- }
+
case ClientMessage:
{
if (!win->IsEnabled())
wxSizeEvent sizeEvent(sz, win->GetId());
sizeEvent.SetEventObject(win);
- return win->GetEventHandler()->ProcessEvent( sizeEvent );
+ return win->HandleWindowEvent( sizeEvent );
}
#endif
#endif
#endif
wxMouseEvent wxevent;
wxTranslateMouseEvent(wxevent, win, window, event);
- return win->GetEventHandler()->ProcessEvent( wxevent );
+ return win->HandleWindowEvent( wxevent );
}
case FocusIn:
#if !wxUSE_NANOX
focusEvent.SetWindow( g_prevFocus );
g_prevFocus = NULL;
- return win->GetEventHandler()->ProcessEvent(focusEvent);
+ return win->HandleWindowEvent(focusEvent);
}
}
return false;
focusEvent.SetEventObject(win);
focusEvent.SetWindow( g_nextFocus );
g_nextFocus = NULL;
- return win->GetEventHandler()->ProcessEvent(focusEvent);
+ return win->HandleWindowEvent(focusEvent);
}
return false;
-
-#ifdef __WXDEBUG__
- default:
- //wxString eventName = wxGetXEventName(XEvent& event);
- //wxLogDebug(wxT("Event %s not handled"), eventName.c_str());
- break;
-#endif // __WXDEBUG__
}
return false;
wxAppConsole::Exit();
}
-// Yield to other processes
-
-bool wxApp::Yield(bool onlyIfNeeded)
-{
- // Sometimes only 2 yields seem
- // to do the trick, e.g. in the
- // progress dialog
- int i;
- for (i = 0; i < 2; i++)
- {
- static bool s_inYield = false;
-
- if ( s_inYield )
- {
- if ( !onlyIfNeeded )
- {
- wxFAIL_MSG( wxT("wxYield called recursively" ) );
- }
-
- return false;
- }
-
- s_inYield = true;
-
- // Make sure we have an event loop object,
- // or Pending/Dispatch will fail
- wxEventLoopBase * const eventLoop = wxEventLoop::GetActive();
- wxEventLoop* newEventLoop = NULL;
- if (!eventLoop)
- {
- newEventLoop = new wxEventLoop;
- wxEventLoop::SetActive(newEventLoop);
- }
-
- // Call dispatch at least once so that sockets
- // can be tested
- wxTheApp->Dispatch();
-
- while (wxTheApp && wxTheApp->Pending())
- wxTheApp->Dispatch();
-
-#if wxUSE_TIMER
- wxGenericTimerImpl::NotifyTimers();
-#endif
- ProcessIdle();
-
- if (newEventLoop)
- {
- wxEventLoop::SetActive(NULL);
- delete newEventLoop;
- }
-
- s_inYield = false;
- }
-
- return true;
-}
-
-#ifdef __WXDEBUG__
-
-void wxApp::OnAssert(const wxChar *file, int line, const wxChar* cond, const wxChar *msg)
-{
- // While the GUI isn't working that well, just print out the
- // message.
-#if 1
- wxAppBase::OnAssert(file, line, cond, msg);
-#else
- wxString msg2;
- msg2.Printf("At file %s:%d: %s", file, line, msg);
- wxLogDebug(msg2);
-#endif
-}
-
-#endif // __WXDEBUG__