]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/window.mm
attempt to get the 'new focus' window parameter of a focus kill event set correctly
[wxWidgets.git] / src / osx / cocoa / window.mm
index a9efa584854166d3ca87c8347ec233ba4d1aa0c1..c46dcd273f3d4065242d64308403381b407419a1 100644 (file)
@@ -1347,10 +1347,10 @@ bool wxWidgetCocoaImpl::resignFirstResponder(WXWidget slf, void *_cmd)
 {
     wxOSX_FocusHandlerPtr superimpl = (wxOSX_FocusHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
     BOOL r = superimpl(slf, (SEL)_cmd);
-    // get the current focus after running resignFirstResponder
-    // note that this value isn't reliable, it might return the same view that
-    // is resigning
-    NSView* otherView = FindFocus();
+    NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
+    NSView* otherView = [responder isKindOfClass:[NSView class]] ? (NSView*)responder : nil;
+
     wxWidgetImpl* otherWindow = FindFromWXWidget(otherView);
 
     // CS: the fix for #12267 leads to missed focus events like in #14938 , as #12267 doesn't seem to happen anymore even