]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/toplevel.cpp
Applied patch [ 603104 ] wxX11 wxClientDC, wxPaintDC fix
[wxWidgets.git] / src / mac / toplevel.cpp
index cc6cea4a30314f4bbf0c524a4015e67c97cf1a88..efcf1a737dbc511adf484459120a480d2ccde09f 100644 (file)
@@ -162,7 +162,7 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
         wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ;
     }
  
- #if TARGET_CARBON
+#if TARGET_CARBON
     if ( m_macEventHandler )
     {
         ::RemoveEventHandler((EventHandlerRef) m_macEventHandler);
@@ -171,21 +171,9 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
 #endif   
     wxRemoveMacWindowAssociation( this ) ;
 
-    wxTopLevelWindows.DeleteObject(this);
-
     if ( wxModelessWindows.Find(this) )
         wxModelessWindows.DeleteObject(this);
 
-    // If this is the last top-level window, exit.
-    if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
-    {
-        wxTheApp->SetTopWindow(NULL);
-
-        if ( wxTheApp->GetExitOnFrameDelete() )
-        {
-          wxTheApp->ExitMainLoop() ;        
-        }
-    }
     DisposeRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
 }
 
@@ -234,6 +222,8 @@ void wxTopLevelWindowMac::SetIcon(const wxIcon& icon)
 
 EventHandlerUPP wxMacWindowEventHandlerUPP = NULL ;
 
+extern long wxMacTranslateKey(unsigned char key, unsigned char code) ;
+
 pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
     OSStatus result = eventNotHandledErr ;
@@ -243,8 +233,13 @@ pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef
         case kEventClassTextInput :
             if ( wxMacConvertEventToRecord( event , &rec ) )
             {
-                wxTheApp->MacHandleOneEvent( &rec ) ;
-                result = noErr ;
+                       wxTheApp->m_macCurrentEvent = &rec ;
+                wxWindow* focus = wxWindow::FindFocus() ;
+                if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( focus , rec.message , rec.modifiers , rec.when , rec.where.h , rec.where.v ) )
+                {
+                    // was handled internally
+                    result = noErr ;
+                }
             }
             break ;
         default :