Skip to content

Commit

Permalink
Merge pull request #6803 from AvaloniaUI/fixes/osx/non-client-clicks-…
Browse files Browse the repository at this point in the history
…popup-crash

[OSX] fix non-client click detection causing crash on popups.
  • Loading branch information
Takoooooo authored and danwalmsley committed Oct 27, 2021
1 parent 6dbf015 commit b03c0b0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions native/Avalonia.Native/src/OSX/window.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2389,7 +2389,10 @@ - (AvnPoint) translateLocalPoint:(AvnPoint)pt

- (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)
{
Expand Down Expand Up @@ -2419,8 +2422,6 @@ - (void)sendEvent:(NSEvent *)event
break;
}
}

[super sendEvent:event];
}
@end

Expand Down

0 comments on commit b03c0b0

Please sign in to comment.