Browse Source

restore _canBecomeKeyWindow flag, important to distinguish behavior of a window and a popup.

pull/8180/head
Dan Walmsley 4 years ago
parent
commit
e4bbebac7d
  1. 34
      native/Avalonia.Native/src/OSX/AvnWindow.mm

34
native/Avalonia.Native/src/OSX/AvnWindow.mm

@ -31,6 +31,7 @@
ComPtr<WindowBaseImpl> _parent; ComPtr<WindowBaseImpl> _parent;
bool _closed; bool _closed;
bool _isEnabled; bool _isEnabled;
bool _canBecomeKeyWindow;
bool _isExtended; bool _isExtended;
AvnMenu* _menu; AvnMenu* _menu;
} }
@ -216,29 +217,38 @@
-(BOOL)canBecomeKeyWindow -(BOOL)canBecomeKeyWindow
{ {
// If the window has a child window being shown as a dialog then don't allow it to become the key window. if(_canBecomeKeyWindow)
for(NSWindow* uch in [self childWindows])
{ {
if (![uch conformsToProtocol:@protocol(AvnWindowProtocol)]) // If the window has a child window being shown as a dialog then don't allow it to become the key window.
for(NSWindow* uch in [self childWindows])
{ {
continue; if (![uch conformsToProtocol:@protocol(AvnWindowProtocol)])
} {
continue;
}
id <AvnWindowProtocol> ch = (id <AvnWindowProtocol>) uch; id <AvnWindowProtocol> ch = (id <AvnWindowProtocol>) uch;
return !ch.isDialog; if(ch.isDialog)
} return true;
}
return true; return true;
}
return false;
} }
#ifndef IS_NSPANEL
-(BOOL)canBecomeMainWindow -(BOOL)canBecomeMainWindow
{ {
#ifdef IS_NSPANEL
return false;
#else
return true; return true;
}
#endif #endif
-(void)setCanBecomeKeyWindow:(bool)value
{
_canBecomeKeyWindow = value;
} }
-(bool)shouldTryToHandleEvents -(bool)shouldTryToHandleEvents

Loading…
Cancel
Save