]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/toplevel.cpp
add missing braces to quiet gcc warnings about missing braces around initializer
[wxWidgets.git] / src / mac / carbon / toplevel.cpp
index 5a047b14de59bf84d9944bfa3a82f47481984ef7..926a9313ae71da767cf9e51770f366d72bf5b4cb 100644 (file)
@@ -49,7 +49,9 @@
     #include "wx/sysopt.h"
 #endif
 
     #include "wx/sysopt.h"
 #endif
 
+#ifndef __DARWIN__
 #include <ToolUtils.h>
 #include <ToolUtils.h>
+#endif
 
 //For targeting OSX
 #include "wx/mac/private.h"
 
 //For targeting OSX
 #include "wx/mac/private.h"
@@ -188,7 +190,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
 #if SIZEOF_WCHAR_T == 2
         uniChar = charBuf[0] ;
 #else
 #if SIZEOF_WCHAR_T == 2
         uniChar = charBuf[0] ;
 #else
-        wxMBConvUTF16BE converter ;
+        wxMBConvUTF16 converter ;
         converter.MB2WC( &uniChar , (const char*)charBuf , 1 ) ;
 #endif
         if ( dataSize > 4 )
         converter.MB2WC( &uniChar , (const char*)charBuf , 1 ) ;
 #endif
         if ( dataSize > 4 )
@@ -447,6 +449,9 @@ ControlRef wxMacFindControlUnderMouse( wxTopLevelWindowMac* toplevelWindow , Poi
     return wxMacFindSubControl( toplevelWindow , location , rootControl , outPart ) ;
 
 }
     return wxMacFindSubControl( toplevelWindow , location , rootControl , outPart ) ;
 
 }
+
+#define NEW_CAPTURE_HANDLING 1
+
 pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
     wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
 pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
     wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
@@ -464,11 +469,23 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
     wxWindow* currentMouseWindow = NULL ;
     ControlRef control = NULL ;
 
     wxWindow* currentMouseWindow = NULL ;
     ControlRef control = NULL ;
 
+#if NEW_CAPTURE_HANDLING
+    if ( wxApp::s_captureWindow )
+    {
+        window = (WindowRef) wxApp::s_captureWindow->MacGetTopLevelWindowRef() ;
+        windowPart = inContent ;
+    }
+#endif
+    
     if ( window )
     {
         QDGlobalToLocalPoint( UMAGetWindowPort(window ) ,  &windowMouseLocation ) ;
 
     if ( window )
     {
         QDGlobalToLocalPoint( UMAGetWindowPort(window ) ,  &windowMouseLocation ) ;
 
-        if ( wxApp::s_captureWindow && wxApp::s_captureWindow->MacGetTopLevelWindowRef() == (WXWindow) window && windowPart == inContent )
+        if ( wxApp::s_captureWindow
+#if !NEW_CAPTURE_HANDLING
+             && wxApp::s_captureWindow->MacGetTopLevelWindowRef() == (WXWindow) window && windowPart == inContent
+#endif
+             )
         {
             currentMouseWindow = wxApp::s_captureWindow ;
         }
         {
             currentMouseWindow = wxApp::s_captureWindow ;
         }
@@ -802,34 +819,6 @@ DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacTopLevelEventHandler )
 
 // Find an item given the Macintosh Window Reference
 
 
 // Find an item given the Macintosh Window Reference
 
-#if KEY_wxList_DEPRECATED
-wxList wxWinMacWindowList(wxKEY_INTEGER);
-wxTopLevelWindowMac *wxFindWinFromMacWindow(WindowRef inWindowRef)
-{
-    wxNode *node = wxWinMacWindowList.Find((long)inWindowRef);
-    if (!node)
-        return NULL;
-    return (wxTopLevelWindowMac *)node->GetData();
-}
-
-void wxAssociateWinWithMacWindow(WindowRef inWindowRef, wxTopLevelWindowMac *win) ;
-void wxAssociateWinWithMacWindow(WindowRef inWindowRef, wxTopLevelWindowMac *win)
-{
-    // adding NULL WindowRef is (first) surely a result of an error and
-    // (secondly) breaks menu command processing
-    wxCHECK_RET( inWindowRef != (WindowRef) NULL, wxT("attempt to add a NULL WindowRef to window list") );
-
-    if ( !wxWinMacWindowList.Find((long)inWindowRef) )
-        wxWinMacWindowList.Append((long)inWindowRef, win);
-}
-
-void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win) ;
-void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win)
-{
-    wxWinMacWindowList.DeleteObject(win);
-}
-#else
-
 WX_DECLARE_HASH_MAP(WindowRef, wxTopLevelWindowMac*, wxPointerHash, wxPointerEqual, MacWindowMap);
 
 static MacWindowMap wxWinMacWindowList;
 WX_DECLARE_HASH_MAP(WindowRef, wxTopLevelWindowMac*, wxPointerHash, wxPointerEqual, MacWindowMap);
 
 static MacWindowMap wxWinMacWindowList;
@@ -864,7 +853,6 @@ void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win)
         }
     }
 }
         }
     }
 }
-#endif // deprecated wxList
 
 // ----------------------------------------------------------------------------
 // wxTopLevelWindowMac creation
 
 // ----------------------------------------------------------------------------
 // wxTopLevelWindowMac creation
@@ -1556,7 +1544,10 @@ bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
     {
         wxSize sz = GetClientSize();
         wxRegion rgn(0, 0, sz.x, sz.y);
     {
         wxSize sz = GetClientSize();
         wxRegion rgn(0, 0, sz.x, sz.y);
-        return SetShape(rgn);
+        if ( rgn.IsEmpty() )
+            return false ;
+        else
+            return SetShape(rgn);
     }
 
     // Make a copy of the region
     }
 
     // Make a copy of the region