Skip to content
Open
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
23 changes: 17 additions & 6 deletions WAYWindow/WAYWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,15 @@ - (void) setTitleBarHeight:(CGFloat)titleBarHeight {
_dummyTitlebarAccessoryViewController.fullScreenMinHeight = titleBarHeight;
[self addTitlebarAccessoryViewController:_dummyTitlebarAccessoryViewController];

NSRect frame = self.frame;
frame.size.height += delta;
frame.origin.y -= delta;

if (self.frameAutosaveName) {
[self setFrameUsingName:self.frameAutosaveName];
}
NSRect frame = self.frame;
frame.size.height += delta;
frame.size.height -= titleBarHeight; // prevent increasing the window height after every launch
frame.origin.y -= delta;
frame.origin.y += titleBarHeight; // prevent changing the window position after every launch

[self _setNeedsLayout];
[self setFrame:frame display:NO]; // NO is important.
}
Expand Down Expand Up @@ -336,8 +341,14 @@ - (void) _setNeedsLayout {
else
frame.origin.y = NSHeight(standardButton.superview.frame)-NSHeight(standardButton.frame)-_trafficLightButtonsTopMargin;

frame.origin.x = _trafficLightButtonsLeftMargin +idx*(NSWidth(frame) + 6);
[standardButton setFrame:frame];
CGFloat buttonMargin= 6;
if (NSApp.userInterfaceLayoutDirection == NSUserInterfaceLayoutDirectionLeftToRight) {
frame.origin.x = _trafficLightButtonsLeftMargin + idx*(NSWidth(frame) + buttonMargin);
} else {
frame.origin.x = NSMaxX(standardButton.superview.bounds) - _trafficLightButtonsLeftMargin - (idx+1)*NSWidth(frame) - idx*buttonMargin;
}

[standardButton setFrame:frame];
}];
}

Expand Down