Fix initial focus problem for hidden windows under Mac
Assume that hidden windows do accept focus because, even if this is still wrong, in general, it is less harmful than wrongly returning false from CanFocus() for them. Closes #18987.
This commit is contained in:
committed by
Vadim Zeitlin
parent
b2675d6a60
commit
678b641950
@@ -3094,12 +3094,11 @@ bool wxWidgetCocoaImpl::CanFocus() const
|
||||
{
|
||||
if ( !IsVisible() )
|
||||
{
|
||||
// It's useless to call canBecomeKeyView in this case, it will always
|
||||
// return false. Try to return something reasonable ourselves, knowing
|
||||
// that most controls are not focusable when full keyboard access if
|
||||
// off and wxNSTextViewControl overrides CanFocus() to always return
|
||||
// true anyhow.
|
||||
return [NSApp isFullKeyboardAccessEnabled];
|
||||
// canBecomeKeyView always returns false for hidden windows, but this
|
||||
// could be wrong because the window could still accept focus once it
|
||||
// becomes visible, so we have no choice but to return true here to
|
||||
// avoid situations in which the expected window doesn't get the focus.
|
||||
return true;
|
||||
}
|
||||
|
||||
NSView* targetView = m_osxView;
|
||||
|
Reference in New Issue
Block a user