Browse Source

Merge pull request #6803 from AvaloniaUI/fixes/osx/non-client-clicks-popup-crash

[OSX] fix non-client click detection causing crash on popups.
release/0.10.10
Tako 4 years ago
committed by Dan Walmsley
parent
commit
b03c0b0ac2
  1. 7
      native/Avalonia.Native/src/OSX/window.mm

7
native/Avalonia.Native/src/OSX/window.mm

@ -2389,7 +2389,10 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
- (void)sendEvent:(NSEvent *)event
{
if(_parent != nullptr)
[super sendEvent:event];
/// This is to detect non-client clicks. This can only be done on Windows... not popups, hence the dynamic_cast.
if(_parent != nullptr && dynamic_cast<WindowImpl*>(_parent.getRaw()) != nullptr)
{
switch(event.type)
{
@ -2419,8 +2422,6 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
break;
}
}
[super sendEvent:event];
}
@end

Loading…
Cancel
Save