]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/utils.cpp
removing unnecessary invalidation in Update, adding a forced update to ScrollWindow...
[wxWidgets.git] / src / mac / carbon / utils.cpp
index 45e9cde839961ad6047d6e9898cae0edc67aff48..57630eaf020384471297f40847508c3f0a83b53e 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:       wxWidgets licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -198,11 +198,15 @@ long wxGetFreeMemory()
 
 void wxUsleep(unsigned long milliseconds)
 {
+    // TODO remove if we don't encounter any other problemsy
+    /*
     clock_t start = clock() ;
     do
     {
         YieldToAnyThread() ;
     } while( clock() - start < milliseconds /  1000.0 * CLOCKS_PER_SEC ) ;
+    */
+    wxThread::Sleep( milliseconds ) ;
 }
 
 void wxSleep(int nSecs)
@@ -533,15 +537,6 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
 // wxMac Specific utility functions
 //---------------------------------------------------------------------------
 
-Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size ) 
-{
-    int x ,y , w ,h ;
-    
-    window->MacGetBoundsForControl( pos , size , x , y, w, h ) ;
-    Rect bounds =  { y , x , y+h , x+w  };
-    return bounds ;
-}
-
 void wxMacStringToPascal( const wxString&from , StringPtr to )
 {
     wxCharBuffer buf = from.mb_str( wxConvLocal ) ;
@@ -1233,6 +1228,49 @@ void wxMacConvertNewlines10To13( wxChar * data )
 }
 #endif
 
+// ----------------------------------------------------------------------------
+// Common Event Support
+// ----------------------------------------------------------------------------
+
+#endif // wxUSE_GUI
+
+#if wxUSE_BASE
+
+extern ProcessSerialNumber gAppProcess ;
+
+void wxMacWakeUp()
+{
+    ProcessSerialNumber psn ;
+    Boolean isSame ;
+    psn.highLongOfPSN = 0 ;
+    psn.lowLongOfPSN = kCurrentProcess ;
+    SameProcess( &gAppProcess , &psn , &isSame ) ;
+    if ( isSame )
+    {
+#if TARGET_CARBON
+        EventRef dummyEvent ;
+        OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
+                        kEventAttributeNone, &dummyEvent);
+        if (err == noErr) 
+        {
+            err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
+                                  kEventPriorityHigh);
+        } 
+#else
+        PostEvent( nullEvent , 0 ) ;
+#endif
+    }
+    else
+    {
+        WakeUpProcess( &gAppProcess ) ;
+    }
+}
+
+#endif // wxUSE_BASE
+
+#if wxUSE_GUI
+
+
 // ----------------------------------------------------------------------------
 // Carbon Event Support
 // ----------------------------------------------------------------------------