Browse Source

Don't set _isModal when changing window parent. (#17742)

The modality of a window is decided at the time it is shown, and indicated by the `isDialog` parameter to `WindowImpl::Show`.

The code was also rather confusing in that `_isModal` was defined in `WindowBaseImpl` but `WindowBaseImpl.IsModal` always returned false. `WindowImpl.IsModal` then overrode `IsModal` to return WindowBaseImpl._isModal. That's messed up. Just define `_isModal` in `WindowImpl` not `WindowBaseImpl`.
pull/17765/head
Steven Kirk 1 year ago
committed by GitHub
parent
commit
d3a2b08664
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      native/Avalonia.Native/src/OSX/WindowBaseImpl.h
  2. 4
      native/Avalonia.Native/src/OSX/WindowBaseImpl.mm
  3. 1
      native/Avalonia.Native/src/OSX/WindowImpl.h

1
native/Avalonia.Native/src/OSX/WindowBaseImpl.h

@ -106,7 +106,6 @@ protected:
AvnPoint lastPositionSet;
bool _shown;
std::list<WindowBaseImpl*> _children;
bool _isModal;
public:
WindowBaseImpl* Parent = nullptr;

4
native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

@ -498,9 +498,7 @@ HRESULT WindowBaseImpl::SetParent(IAvnWindowBase *parent) {
auto cparent = dynamic_cast<WindowImpl *>(parent);
Parent = cparent;
_isModal = Parent != nullptr;
if(Parent != 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

1
native/Avalonia.Native/src/OSX/WindowImpl.h

@ -101,6 +101,7 @@ private:
bool _transitioningWindowState;
bool _isClientAreaExtended;
AvnExtendClientAreaChromeHints _extendClientHints;
bool _isModal;
};
#endif //AVALONIA_NATIVE_OSX_WINDOWIMPL_H

Loading…
Cancel
Save