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() )
|
if ( !IsVisible() )
|
||||||
{
|
{
|
||||||
// It's useless to call canBecomeKeyView in this case, it will always
|
// canBecomeKeyView always returns false for hidden windows, but this
|
||||||
// return false. Try to return something reasonable ourselves, knowing
|
// could be wrong because the window could still accept focus once it
|
||||||
// that most controls are not focusable when full keyboard access if
|
// becomes visible, so we have no choice but to return true here to
|
||||||
// off and wxNSTextViewControl overrides CanFocus() to always return
|
// avoid situations in which the expected window doesn't get the focus.
|
||||||
// true anyhow.
|
return true;
|
||||||
return [NSApp isFullKeyboardAccessEnabled];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSView* targetView = m_osxView;
|
NSView* targetView = m_osxView;
|
||||||
|
Reference in New Issue
Block a user