Skip to content

Commit

Permalink
GetStyle => abstract CalculateStyleMask.
Browse files Browse the repository at this point in the history
- Make naming more clear - it's not getting the style mask, it's calculating what it should be in order to update the mask
- Make it abstract to prevent it being called from the ctor in future
  • Loading branch information
grokys committed Feb 7, 2023
1 parent b609ba5 commit d40041f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion native/Avalonia.Native/src/OSX/PopupImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[Window setLevel:NSPopUpMenuWindowLevel];
}
protected:
virtual NSWindowStyleMask GetStyle() override
virtual NSWindowStyleMask CalculateStyleMask() override
{
return NSWindowStyleMaskBorderless;
}
Expand Down
2 changes: 1 addition & 1 deletion native/Avalonia.Native/src/OSX/WindowBaseImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ BEGIN_INTERFACE_MAP()
virtual void BringToFront ();

protected:
virtual NSWindowStyleMask GetStyle();
virtual NSWindowStyleMask CalculateStyleMask() = 0;
virtual void UpdateStyle();

private:
Expand Down
10 changes: 1 addition & 9 deletions native/Avalonia.Native/src/OSX/WindowBaseImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,14 @@
lastSize = NSSize { 100, 100 };
lastMaxSize = NSSize { CGFLOAT_MAX, CGFLOAT_MAX};
lastMinSize = NSSize { 0, 0 };

lastMenu = nullptr;

CreateNSWindow(usePanel);

[Window setContentView:StandardContainer];
[Window setStyleMask:NSWindowStyleMaskBorderless];
[Window setBackingType:NSBackingStoreBuffered];

[Window setContentMinSize:lastMinSize];
[Window setContentMaxSize:lastMaxSize];

[Window setOpaque:false];
}

Expand Down Expand Up @@ -564,12 +560,8 @@
return false;
}

NSWindowStyleMask WindowBaseImpl::GetStyle() {
return NSWindowStyleMaskBorderless;
}

void WindowBaseImpl::UpdateStyle() {
[Window setStyleMask:GetStyle()];
[Window setStyleMask:CalculateStyleMask()];
}

void WindowBaseImpl::CleanNSWindow() {
Expand Down
2 changes: 1 addition & 1 deletion native/Avalonia.Native/src/OSX/WindowImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ BEGIN_INTERFACE_MAP()
bool CanBecomeKeyWindow ();

protected:
virtual NSWindowStyleMask GetStyle() override;
virtual NSWindowStyleMask CalculateStyleMask() override;
void UpdateStyle () override;

private:
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 @@ -553,7 +553,7 @@
return _parent != nullptr;
}

NSWindowStyleMask WindowImpl::GetStyle() {
NSWindowStyleMask WindowImpl::CalculateStyleMask() {
unsigned long s = NSWindowStyleMaskBorderless;

if(_actualWindowState == FullScreen)
Expand Down

0 comments on commit d40041f

Please sign in to comment.