Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: Don't allow window zoom when CanResize=false. #10575

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion native/Avalonia.Native/src/OSX/AvnWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ - (void)windowDidEnterFullScreen:(NSNotification *_Nonnull)notification

- (BOOL)windowShouldZoom:(NSWindow *_Nonnull)window toFrame:(NSRect)newFrame
{
return true;
return _parent->CanZoom();
}

-(void)windowDidResignKey:(NSNotification *)notification
Expand Down
2 changes: 2 additions & 0 deletions native/Avalonia.Native/src/OSX/WindowBaseImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ BEGIN_INTERFACE_MAP()

virtual void BringToFront ();

virtual bool CanZoom() { return false; }

protected:
virtual NSWindowStyleMask CalculateStyleMask() = 0;
virtual void UpdateStyle();
Expand Down
2 changes: 2 additions & 0 deletions native/Avalonia.Native/src/OSX/WindowImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ BEGIN_INTERFACE_MAP()

bool CanBecomeKeyWindow ();

bool CanZoom() override { return _isEnabled && _canResize; }

protected:
virtual NSWindowStyleMask CalculateStyleMask() override;
void UpdateStyle () override;
Expand Down
2 changes: 1 addition & 1 deletion native/Avalonia.Native/src/OSX/WindowImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -622,5 +622,5 @@
[miniaturizeButton setHidden:!hasTrafficLights];
[miniaturizeButton setEnabled:_isEnabled];
[zoomButton setHidden:!hasTrafficLights];
[zoomButton setEnabled:_isEnabled && _canResize];
[zoomButton setEnabled:CanZoom()];
}