Repository: AvaloniaUI/Avalonia
File: native/Avalonia.Native/src/OSX/WindowImpl.mm (Objective-C++)

Code before:
                case Minimized:
                    if (currentState == FullScreen) {
                        ExitFullScreenMode();
                    } else {
                        [Window miniaturize:Window];
                    }
                    break;

                case FullScreen:
                    if ([Window isMiniaturized]) {
                        [Window deminiaturize:Window];
                    }

                    EnterFullScreenMode();
                    break;

                case Normal:
                    if ([Window isMiniaturized]) {
                        [Window deminiaturize:Window];
                    }

                    if (currentState == FullScreen) {
                        ExitFullScreenMode();
                    }

                    if (IsZoomed() && shouldResize == true) {
                        if (_decorations == SystemDecorationsFull) {
                            DoZoom();
                        } else {
                            [Window setFrame:_preZoomSize display:true];
                            auto newFrame = [Window contentRectForFrameRect:[Window frame]].size;

                            [View setFrameSize:newFrame];
                        }

                    }
                    break;
            }

            WindowEvents->WindowStateChanged(_actualWindowState);
        }


        _inSetWindowState = false;

        return S_OK;
    }
}

bool WindowImpl::IsModal() {
    return _isModal;

Review comment (suggestion):
Shouldn't the whole `switch` be skipped if `shouldResize == false`? The `SetWindowState(Maximized, false)` call might move the window otherwise (it's probably a no-op currently though).

Code after:

                    case Minimized:
                        if (currentState == FullScreen) {
                            ExitFullScreenMode();
                        } else {
                            [Window miniaturize:Window];
                        }
                        break;

                    case FullScreen:
                        if ([Window isMiniaturized]) {
                            [Window deminiaturize:Window];
                        }

                        EnterFullScreenMode();
                        break;

                    case Normal:
                        if ([Window isMiniaturized]) {
                            [Window deminiaturize:Window];
                        }

                        if (currentState == FullScreen) {
                            ExitFullScreenMode();
                        }

                        if (IsZoomed()) {
                            if (_decorations == SystemDecorationsFull) {
                                DoZoom();
                            } else {
                                [Window setFrame:_preZoomSize display:true];
                                auto newFrame = [Window contentRectForFrameRect:[Window frame]].size;

                                [View setFrameSize:newFrame];
                            }

                        }
                        break;
                }
            }

            WindowEvents->WindowStateChanged(_actualWindowState);
        }


        _inSetWindowState = false;

        return S_OK;
    }
}