Nikita Tsukanov
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with
11 additions and
7 deletions
-
native/Avalonia.Native/src/OSX/AvnView.mm
-
native/Avalonia.Native/src/OSX/PopupImpl.mm
-
native/Avalonia.Native/src/OSX/WindowBaseImpl.h
-
native/Avalonia.Native/src/OSX/WindowBaseImpl.mm
-
native/Avalonia.Native/src/OSX/WindowImpl.mm
|
|
|
@ -363,7 +363,7 @@ static void ConvertTilt(NSPoint tilt, float* xTilt, float* yTilt) |
|
|
|
auto windowBase = _parent.tryGetWithCast<WindowBaseImpl>(); |
|
|
|
|
|
|
|
if(windowBase != nullptr){ |
|
|
|
auto parent = windowBase->Parent; |
|
|
|
auto parent = windowBase->Parent.tryGet(); |
|
|
|
|
|
|
|
if(parent != nullptr){ |
|
|
|
auto parentWindow = parent->Window; |
|
|
|
|
|
|
|
@ -45,8 +45,9 @@ public: |
|
|
|
|
|
|
|
virtual bool ShouldTakeFocusOnShow() override |
|
|
|
{ |
|
|
|
auto parent = Parent.tryGet(); |
|
|
|
// Don't steal the focus from another windows if our parent is inactive |
|
|
|
if (Parent != nullptr && Parent->Window != nullptr && ![Parent->Window isKeyWindow]) |
|
|
|
if (parent != nullptr && parent->Window != nullptr && ![parent->Window isKeyWindow]) |
|
|
|
return false; |
|
|
|
|
|
|
|
return WindowBaseImpl::ShouldTakeFocusOnShow(); |
|
|
|
|
|
|
|
@ -108,7 +108,7 @@ protected: |
|
|
|
std::list<WindowBaseImpl*> _children; |
|
|
|
|
|
|
|
public: |
|
|
|
WindowBaseImpl* Parent = nullptr; |
|
|
|
ComObjectWeakPtr<WindowBaseImpl> Parent = nullptr; |
|
|
|
NSWindow * Window; |
|
|
|
ComPtr<IAvnWindowBaseEvents> BaseEvents; |
|
|
|
}; |
|
|
|
|
|
|
|
@ -503,16 +503,19 @@ HRESULT WindowBaseImpl::SetParent(IAvnWindowBase *parent) { |
|
|
|
START_COM_CALL; |
|
|
|
|
|
|
|
@autoreleasepool { |
|
|
|
if(Parent != nullptr) |
|
|
|
|
|
|
|
auto oldParent = Parent.tryGet(); |
|
|
|
|
|
|
|
if(oldParent != nullptr) |
|
|
|
{ |
|
|
|
Parent->_children.remove(this); |
|
|
|
oldParent->_children.remove(this); |
|
|
|
} |
|
|
|
|
|
|
|
auto cparent = dynamic_cast<WindowImpl *>(parent); |
|
|
|
|
|
|
|
Parent = cparent; |
|
|
|
|
|
|
|
if(Parent != nullptr && Window != nullptr){ |
|
|
|
if(cparent != nullptr && Window != nullptr){ |
|
|
|
// If one tries to show a child window with a minimized parent window, then the parent window will be |
|
|
|
// restored but macOS isn't kind enough to *tell* us that, so the window will be left in a non-interactive |
|
|
|
// state. Detect this and explicitly restore the parent window ourselves to avoid this situation. |
|
|
|
|
|
|
|
@ -546,7 +546,7 @@ bool WindowImpl::IsModal() { |
|
|
|
} |
|
|
|
|
|
|
|
bool WindowImpl::IsOwned() { |
|
|
|
return Parent != nullptr; |
|
|
|
return Parent.tryGet() != nullptr; |
|
|
|
} |
|
|
|
|
|
|
|
NSWindowStyleMask WindowImpl::CalculateStyleMask() { |
|
|
|
|