]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/app.cpp
fix for crash when undocking AUI toolbars (same as r59107 in 2.8 branch)
[wxWidgets.git] / src / x11 / app.cpp
index c7ec2a5de72ec7152183b7a88a615649401a130b..e18014ec1455a74b20b7f8aeff31e407606347d0 100644 (file)
@@ -25,6 +25,7 @@
     #include "wx/memory.h"
     #include "wx/gdicmn.h"
     #include "wx/module.h"
+    #include "wx/crt.h"
 #endif
 
 #include "wx/evtloop.h"
@@ -63,7 +64,6 @@ static wxWindow *g_prevFocus = NULL;
 //   X11 error handling
 //------------------------------------------------------------------------
 
-#ifdef __WXDEBUG__
 typedef int (*XErrorHandlerFunc)(Display *, XErrorEvent *);
 
 XErrorHandlerFunc gs_pfnXErrorHandler = 0;
@@ -76,7 +76,6 @@ static int wxXErrorHandler(Display *dpy, XErrorEvent *xevent)
     else
         return 0;
 }
-#endif // __WXDEBUG__
 
 //------------------------------------------------------------------------
 //   wxApp
@@ -88,10 +87,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 
 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;
@@ -291,9 +290,6 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
             return false;
     }
 
-#ifdef __WXDEBUG__
-    wxString windowClass = win->GetClassInfo()->GetClassName();
-#endif
 
     switch (event->type)
     {
@@ -388,14 +384,14 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
             // 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) &&
@@ -408,7 +404,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
                 /* 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;
@@ -421,7 +417,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
             wxKeyEvent keyEvent(wxEVT_KEY_UP);
             wxTranslateKeyEvent(keyEvent, win, window, event);
 
-            return win->GetEventHandler()->ProcessEvent( keyEvent );
+            return win->HandleWindowEvent( keyEvent );
         }
         case ConfigureNotify:
         {
@@ -445,17 +441,15 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
                     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())
@@ -505,7 +499,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
             wxSizeEvent sizeEvent(sz, win->GetId());
             sizeEvent.SetEventObject(win);
 
-            return win->GetEventHandler()->ProcessEvent( sizeEvent );
+            return win->HandleWindowEvent( sizeEvent );
         }
 #endif
 #endif
@@ -570,7 +564,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
 #endif
             wxMouseEvent wxevent;
             wxTranslateMouseEvent(wxevent, win, window, event);
-            return win->GetEventHandler()->ProcessEvent( wxevent );
+            return win->HandleWindowEvent( wxevent );
         }
         case FocusIn:
 #if !wxUSE_NANOX
@@ -596,7 +590,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
                     focusEvent.SetWindow( g_prevFocus );
                     g_prevFocus = NULL;
 
-                    return win->GetEventHandler()->ProcessEvent(focusEvent);
+                    return win->HandleWindowEvent(focusEvent);
                 }
             }
             return false;
@@ -613,16 +607,9 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
                 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;
@@ -766,77 +753,3 @@ void wxApp::Exit()
     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__