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.
pull/6807/head
Tako
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
3 deletions
-
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 |
|
|
|
|
|
|
|
|