]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/app.cpp
wxString::FormatV() fix (bug 416853)
[wxWidgets.git] / src / mac / app.cpp
index 6d077eb60d705d047774462800a4c5e6c4184611..71f441209d4db3d5cbe0d8e596fc5048cf2157ce 100644 (file)
@@ -53,7 +53,7 @@
 
 #if wxUSE_SOCKETS
     #ifdef __APPLE__
-        #include <OT/OpenTransport.h>
+        #include <CoreServices/CoreServices.h>
     #else
         #include <OpenTransport.h>
         #include <OpenTptInternet.h>
@@ -360,8 +360,9 @@ bool wxApp::Initialize()
 #ifndef __UNIX__
   // test the minimal configuration necessary
 
+       #if !TARGET_CARBON
        long theSystem ;
-       long theMachine;
+       long theMachine; 
 
        if (Gestalt(gestaltMachineType, &theMachine) != noErr)
        {
@@ -379,7 +380,6 @@ bool wxApp::Initialize()
        {
                error = kMacSTROldSystem  ;
        }
-       #if !TARGET_CARBON
        else if ((long)GetApplLimit() - (long)ApplicationZone() < kMacMinHeap)
        {
                error = kMacSTRSmallSize;
@@ -855,12 +855,22 @@ void wxCYield()
 }
 
 // Yield to other processes
+
+static bool gs_inYield = FALSE;
+
 bool wxYield()
 {
+#ifdef __WXDEBUG__    
+    if (gs_inYield)
+        wxFAIL_MSG( wxT("wxYield called recursively" ) );
+#endif
+
+    gs_inYield = TRUE;
+    
 #if wxUSE_THREADS
-  YieldToAnyThread() ;
+    YieldToAnyThread() ;
 #endif
-  EventRecord event ;
+    EventRecord event ;
 
        long sleepTime = 0 ; //::GetCaretTime();
 
@@ -870,7 +880,19 @@ bool wxYield()
        }
 
        wxMacProcessNotifierAndPendingEvents() ;
-  return TRUE;
+
+    gs_inYield = FALSE;
+    
+    return TRUE;
+}
+
+// Yield to incoming messages; but fail silently if recursion is detected.
+bool wxYieldIfNeeded()
+{
+    if (gs_inYield)
+        return FALSE;
+        
+    return wxYield();
 }
 
 // platform specifics
@@ -1447,7 +1469,11 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
                case suspendResumeMessage :
                        {
                                bool isResuming = ev->message & resumeFlag ;
+#if !TARGET_CARBON
                                bool convertClipboard = ev->message & convertClipboardFlag ;
+#else
+                               bool convertClipboard = false;
+#endif
                                bool doesActivate = UMAGetProcessModeDoesActivateOnFGSwitch() ;
                                if ( isResuming )
                                {