]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/textctrl.mm
attempt to get the 'new focus' window parameter of a focus kill event set correctly
[wxWidgets.git] / src / osx / cocoa / textctrl.mm
index 6c4b6c1a88460e7a83b516b36ab85933c01d0472..4d4398e2d29d464cf10404307675223b51e9bef7 100644 (file)
@@ -182,7 +182,11 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
     wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
     if ( impl )
     {
-        impl->DoNotifyFocusEvent( false, NULL );
+        NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
+        NSView* otherView = [responder isKindOfClass:[NSView class]] ? (NSView*)responder : nil;
+        
+        wxWidgetImpl* otherWindow = impl->FindFromWXWidget(otherView);
+        impl->DoNotifyFocusEvent( false, otherWindow );
     }
 }
 
@@ -336,7 +340,11 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
     wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
     if ( impl )
     {
-        impl->DoNotifyFocusEvent( false, NULL );
+        NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
+        NSView* otherView = [responder isKindOfClass:[NSView class]] ? (NSView*)responder : nil;
+        
+        wxWidgetImpl* otherWindow = impl->FindFromWXWidget(otherView);
+        impl->DoNotifyFocusEvent( false, otherWindow );
     }
 }
 
@@ -506,7 +514,11 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
             timpl->SetInternalSelection(range.location, range.location + range.length);
         }
 
-        impl->DoNotifyFocusEvent( false, NULL );
+        NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
+        NSView* otherView = [responder isKindOfClass:[NSView class]] ? (NSView*)responder : nil;
+        
+        wxWidgetImpl* otherWindow = impl->FindFromWXWidget(otherView);
+        impl->DoNotifyFocusEvent( false, otherWindow );
     }
 }
 @end