|
|
@ -56,11 +56,11 @@ WindowBaseImpl::WindowBaseImpl(IAvnWindowBaseEvents *events, bool usePanel) : To |
|
|
lastMaxSize = NSSize { CGFLOAT_MAX, CGFLOAT_MAX}; |
|
|
lastMaxSize = NSSize { CGFLOAT_MAX, CGFLOAT_MAX}; |
|
|
lastMinSize = NSSize { 0, 0 }; |
|
|
lastMinSize = NSSize { 0, 0 }; |
|
|
lastMenu = nullptr; |
|
|
lastMenu = nullptr; |
|
|
|
|
|
|
|
|
CreateNSWindow(usePanel); |
|
|
CreateNSWindow(usePanel); |
|
|
|
|
|
|
|
|
StandardContainer = [[AutoFitContentView new] initWithContent:View]; |
|
|
StandardContainer = [[AutoFitContentView new] initWithContent:View]; |
|
|
|
|
|
|
|
|
[Window setContentView:StandardContainer]; |
|
|
[Window setContentView:StandardContainer]; |
|
|
[Window setBackingType:NSBackingStoreBuffered]; |
|
|
[Window setBackingType:NSBackingStoreBuffered]; |
|
|
[Window setContentMinSize:lastMinSize]; |
|
|
[Window setContentMinSize:lastMinSize]; |
|
|
@ -89,7 +89,7 @@ HRESULT WindowBaseImpl::Show(bool activate, bool isDialog) { |
|
|
|
|
|
|
|
|
@autoreleasepool { |
|
|
@autoreleasepool { |
|
|
[Window setContentSize:lastSize]; |
|
|
[Window setContentSize:lastSize]; |
|
|
|
|
|
|
|
|
if(hasPosition) |
|
|
if(hasPosition) |
|
|
{ |
|
|
{ |
|
|
SetPosition(lastPositionSet); |
|
|
SetPosition(lastPositionSet); |
|
|
@ -110,7 +110,7 @@ HRESULT WindowBaseImpl::Show(bool activate, bool isDialog) { |
|
|
[Window setCollectionBehavior:collectionBehavior & ~NSWindowCollectionBehaviorFullScreenPrimary]; |
|
|
[Window setCollectionBehavior:collectionBehavior & ~NSWindowCollectionBehaviorFullScreenPrimary]; |
|
|
|
|
|
|
|
|
UpdateAppearance(); |
|
|
UpdateAppearance(); |
|
|
|
|
|
|
|
|
[Window invalidateShadow]; |
|
|
[Window invalidateShadow]; |
|
|
|
|
|
|
|
|
if (ShouldTakeFocusOnShow() && activate) { |
|
|
if (ShouldTakeFocusOnShow() && activate) { |
|
|
@ -124,13 +124,13 @@ HRESULT WindowBaseImpl::Show(bool activate, bool isDialog) { |
|
|
|
|
|
|
|
|
_shown = true; |
|
|
_shown = true; |
|
|
[Window setCollectionBehavior:collectionBehavior]; |
|
|
[Window setCollectionBehavior:collectionBehavior]; |
|
|
|
|
|
|
|
|
// Ensure that we call needsDisplay = YES so that AvnView.updateLayer is called after the |
|
|
// Ensure that we call needsDisplay = YES so that AvnView.updateLayer is called after the |
|
|
// window is shown: if the client is pumping messages during the window creation/show |
|
|
// window is shown: if the client is pumping messages during the window creation/show |
|
|
// process, it's possible that updateLayer gets called after the window is created but |
|
|
// process, it's possible that updateLayer gets called after the window is created but |
|
|
// before it's is shown. |
|
|
// before it's is shown. |
|
|
[View.layer setNeedsDisplay]; |
|
|
[View.layer setNeedsDisplay]; |
|
|
|
|
|
|
|
|
return S_OK; |
|
|
return S_OK; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -161,7 +161,7 @@ HRESULT WindowBaseImpl::Hide() { |
|
|
|
|
|
|
|
|
@autoreleasepool { |
|
|
@autoreleasepool { |
|
|
if (Window != nullptr) { |
|
|
if (Window != nullptr) { |
|
|
|
|
|
|
|
|
// If window is hidden without ending attached sheet first, it will stuck in "order out" state, |
|
|
// If window is hidden without ending attached sheet first, it will stuck in "order out" state, |
|
|
// and block any new sheets from being attached. |
|
|
// and block any new sheets from being attached. |
|
|
// Additionaly, we don't know if user would define any custom panels, so we only end/close file dialog sheets. |
|
|
// Additionaly, we don't know if user would define any custom panels, so we only end/close file dialog sheets. |
|
|
@ -501,18 +501,18 @@ HRESULT WindowBaseImpl::SetParent(IAvnWindowBase *parent) { |
|
|
START_COM_CALL; |
|
|
START_COM_CALL; |
|
|
|
|
|
|
|
|
@autoreleasepool { |
|
|
@autoreleasepool { |
|
|
|
|
|
|
|
|
auto oldParent = Parent.tryGet(); |
|
|
auto oldParent = Parent.tryGet(); |
|
|
|
|
|
|
|
|
if(oldParent != nullptr) |
|
|
if(oldParent != nullptr) |
|
|
{ |
|
|
{ |
|
|
oldParent->_children.remove(this); |
|
|
oldParent->_children.remove(this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
auto cparent = dynamic_cast<WindowImpl *>(parent); |
|
|
auto cparent = dynamic_cast<WindowImpl *>(parent); |
|
|
|
|
|
|
|
|
Parent = cparent; |
|
|
Parent = cparent; |
|
|
|
|
|
|
|
|
if(cparent != 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 |
|
|
// 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 |
|
|
// restored but macOS isn't kind enough to *tell* us that, so the window will be left in a non-interactive |
|
|
@ -521,9 +521,9 @@ HRESULT WindowBaseImpl::SetParent(IAvnWindowBase *parent) { |
|
|
cparent->SetWindowState(Normal); |
|
|
cparent->SetWindowState(Normal); |
|
|
|
|
|
|
|
|
[Window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; |
|
|
[Window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; |
|
|
|
|
|
|
|
|
cparent->_children.push_back(this); |
|
|
cparent->_children.push_back(this); |
|
|
|
|
|
|
|
|
UpdateAppearance(); |
|
|
UpdateAppearance(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|