{
             ControlPartCode part ;
             ControlRef control = wxMacFindControlUnderMouse( windowMouseLocation , window , &part ) ;
-            currentMouseWindow = wxFindControlFromMacControl( control ) ;
+            if ( control == 0 )
+                currentMouseWindow = (wxWindow*) data ;
+            else
+                currentMouseWindow = wxFindControlFromMacControl( control ) ;
         }        
     }
 
     // the frame window event handler
     InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
     MacInstallTopLevelWindowEventHandler() ;
-    
+
     m_macFocus = NULL ;
 
     if ( HasFlag(wxFRAME_SHAPED) )
     wxTopLevelWindowMac* win = wxFindWinFromMacWindow(window);
     if (win)
     {
-        wxRect r = win->GetRect();
-        SetRectRgn(rgn, r.GetLeft(), r.GetTop(), r.GetRight(), r.GetBottom());
+        Rect r ;
+        wxShapedMacWindowGetPos(window, &r ) ;
+        RectRgn( rgn , &r ) ;
     }
 }