Browse Source
Merge pull request #5399 from AvaloniaUI/fixes/dialog-main-window-activation
Fixes/dialog main window activation
pull/5439/head
Dan Walmsley
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
12 additions and
7 deletions
-
native/Avalonia.Native/src/OSX/window.mm
|
|
|
@ -1391,17 +1391,20 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent |
|
|
|
[super viewDidChangeBackingProperties]; |
|
|
|
} |
|
|
|
|
|
|
|
- (bool) ignoreUserInput |
|
|
|
- (bool) ignoreUserInput:(bool)trigerInputWhenDisabled |
|
|
|
{ |
|
|
|
auto parentWindow = objc_cast<AvnWindow>([self window]); |
|
|
|
|
|
|
|
if(parentWindow == nil || ![parentWindow shouldTryToHandleEvents]) |
|
|
|
{ |
|
|
|
auto window = dynamic_cast<WindowImpl*>(_parent.getRaw()); |
|
|
|
|
|
|
|
if(window != nullptr) |
|
|
|
if(trigerInputWhenDisabled) |
|
|
|
{ |
|
|
|
window->WindowEvents->GotInputWhenDisabled(); |
|
|
|
auto window = dynamic_cast<WindowImpl*>(_parent.getRaw()); |
|
|
|
|
|
|
|
if(window != nullptr) |
|
|
|
{ |
|
|
|
window->WindowEvents->GotInputWhenDisabled(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return TRUE; |
|
|
|
@ -1412,7 +1415,9 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent |
|
|
|
|
|
|
|
- (void)mouseEvent:(NSEvent *)event withType:(AvnRawMouseEventType) type |
|
|
|
{ |
|
|
|
if([self ignoreUserInput]) |
|
|
|
bool triggerInputWhenDisabled = type != Move; |
|
|
|
|
|
|
|
if([self ignoreUserInput: triggerInputWhenDisabled]) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -1578,7 +1583,7 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent |
|
|
|
|
|
|
|
- (void) keyboardEvent: (NSEvent *) event withType: (AvnRawKeyEventType)type |
|
|
|
{ |
|
|
|
if([self ignoreUserInput]) |
|
|
|
if([self ignoreUserInput: false]) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|