attempt to get the 'new focus' window parameter of a focus kill event set correctly
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -258,6 +258,8 @@ public :
|
|||||||
|
|
||||||
CGWindowLevel GetWindowLevel() const { return m_macWindowLevel; }
|
CGWindowLevel GetWindowLevel() const { return m_macWindowLevel; }
|
||||||
void RestoreWindowLevel();
|
void RestoreWindowLevel();
|
||||||
|
|
||||||
|
static WX_NSResponder GetNextFirstResponder() ;
|
||||||
protected :
|
protected :
|
||||||
CGWindowLevel m_macWindowLevel;
|
CGWindowLevel m_macWindowLevel;
|
||||||
WXWindow m_macWindow;
|
WXWindow m_macWindow;
|
||||||
|
@@ -145,6 +145,8 @@ bool shouldHandleSelector(SEL selector)
|
|||||||
// wx native implementation
|
// wx native implementation
|
||||||
//
|
//
|
||||||
|
|
||||||
|
static NSResponder* s_nextFirstResponder = NULL;
|
||||||
|
|
||||||
@interface wxNSWindow : NSWindow
|
@interface wxNSWindow : NSWindow
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -152,6 +154,7 @@ bool shouldHandleSelector(SEL selector)
|
|||||||
- (void) sendEvent:(NSEvent *)event;
|
- (void) sendEvent:(NSEvent *)event;
|
||||||
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen;
|
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen;
|
||||||
- (void)noResponderFor: (SEL) selector;
|
- (void)noResponderFor: (SEL) selector;
|
||||||
|
- (BOOL)makeFirstResponder:(NSResponder *)aResponder;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation wxNSWindow
|
@implementation wxNSWindow
|
||||||
@@ -206,6 +209,14 @@ bool shouldHandleSelector(SEL selector)
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)makeFirstResponder:(NSResponder *)aResponder
|
||||||
|
{
|
||||||
|
s_nextFirstResponder = aResponder;
|
||||||
|
BOOL retval = [super makeFirstResponder:aResponder];
|
||||||
|
s_nextFirstResponder = nil;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface wxNSPanel : NSPanel
|
@interface wxNSPanel : NSPanel
|
||||||
@@ -215,6 +226,7 @@ bool shouldHandleSelector(SEL selector)
|
|||||||
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen;
|
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen;
|
||||||
- (void)noResponderFor: (SEL) selector;
|
- (void)noResponderFor: (SEL) selector;
|
||||||
- (void)sendEvent:(NSEvent *)event;
|
- (void)sendEvent:(NSEvent *)event;
|
||||||
|
- (BOOL)makeFirstResponder:(NSResponder *)aResponder;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation wxNSPanel
|
@implementation wxNSPanel
|
||||||
@@ -265,6 +277,14 @@ bool shouldHandleSelector(SEL selector)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)makeFirstResponder:(NSResponder *)aResponder
|
||||||
|
{
|
||||||
|
s_nextFirstResponder = aResponder;
|
||||||
|
BOOL retval = [super makeFirstResponder:aResponder];
|
||||||
|
s_nextFirstResponder = nil;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@@ -1041,6 +1061,12 @@ void wxNonOwnedWindowCocoaImpl::RestoreWindowLevel()
|
|||||||
[m_macWindow setLevel:m_macWindowLevel];
|
[m_macWindow setLevel:m_macWindowLevel];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WX_NSResponder wxNonOwnedWindowCocoaImpl::GetNextFirstResponder()
|
||||||
|
{
|
||||||
|
return s_nextFirstResponder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@@ -182,7 +182,11 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
|
|||||||
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
if ( impl )
|
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 );
|
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
if ( impl )
|
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);
|
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
|
@end
|
||||||
|
@@ -1347,10 +1347,10 @@ bool wxWidgetCocoaImpl::resignFirstResponder(WXWidget slf, void *_cmd)
|
|||||||
{
|
{
|
||||||
wxOSX_FocusHandlerPtr superimpl = (wxOSX_FocusHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
|
wxOSX_FocusHandlerPtr superimpl = (wxOSX_FocusHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
|
||||||
BOOL r = superimpl(slf, (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
|
NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
|
||||||
// is resigning
|
NSView* otherView = [responder isKindOfClass:[NSView class]] ? (NSView*)responder : nil;
|
||||||
NSView* otherView = FindFocus();
|
|
||||||
wxWidgetImpl* otherWindow = FindFromWXWidget(otherView);
|
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
|
// CS: the fix for #12267 leads to missed focus events like in #14938 , as #12267 doesn't seem to happen anymore even
|
||||||
|
Reference in New Issue
Block a user