Skip to content

Commit 67efd4a

Browse files
committed
Make name of minimize/maximize button hidden options clearly
1 parent 442ea0e commit 67efd4a

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

app/os.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ type Config struct {
4646
// Decorated reports whether window decorations are provided automatically.
4747
Decorated bool
4848

49-
// HiddenMinimizeButton hide the window's minimize button (only works for windows and macOS)
50-
HiddenMinimizeButton bool
51-
// HiddenMaximizeButton hide the window's maximize button (only works for windows and macOS)
52-
HiddenMaximizeButton bool
49+
// MinimizeButtonHidden hide the window's minimize button (only works for windows and macOS)
50+
MinimizeButtonHidden bool
51+
// MaximizeButtonHidden hide the window's maximize button (only works for windows and macOS)
52+
MaximizeButtonHidden bool
5353

5454
// Focused reports whether has the keyboard focus.
5555
Focused bool

app/os_macos.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,10 @@ func (w *window) Configure(options []Option) {
470470
C.setWindowStyleMask(window, mask)
471471
C.setWindowStandardButtonHidden(window, C.NSWindowCloseButton, barTrans)
472472
// no decorated or hide minimize and maximize buttons
473-
w.config.HiddenMinimizeButton = cnf.HiddenMinimizeButton
474-
w.config.HiddenMaximizeButton = cnf.HiddenMaximizeButton
475-
C.setWindowStandardButtonHidden(window, C.NSWindowMiniaturizeButton, toInt(!cnf.Decorated || cnf.HiddenMinimizeButton))
476-
C.setWindowStandardButtonHidden(window, C.NSWindowZoomButton, toInt(!cnf.Decorated || cnf.HiddenMaximizeButton))
473+
w.config.MinimizeButtonHidden = cnf.MinimizeButtonHidden
474+
w.config.MaximizeButtonHidden = cnf.MaximizeButtonHidden
475+
C.setWindowStandardButtonHidden(window, C.NSWindowMiniaturizeButton, toInt(!cnf.Decorated || cnf.MinimizeButtonHidden))
476+
C.setWindowStandardButtonHidden(window, C.NSWindowZoomButton, toInt(!cnf.Decorated || cnf.MaximizeButtonHidden))
477477
// When toggling the titlebar, the layer doesn't update its frame
478478
// until the next resize. Force it.
479479
C.resetLayerFrame(w.view)

app/os_windows.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -747,12 +747,12 @@ func (w *window) Configure(options []Option) {
747747
swpStyle |= windows.SWP_NOMOVE | windows.SWP_NOSIZE
748748
showMode = windows.SW_SHOWMAXIMIZED
749749
}
750-
if w.config.HiddenMinimizeButton {
750+
if w.config.MinimizeButtonHidden {
751751
style &^= windows.WS_MINIMIZEBOX
752752
} else {
753753
style |= windows.WS_MINIMIZEBOX
754754
}
755-
if w.config.HiddenMaximizeButton {
755+
if w.config.MaximizeButtonHidden {
756756
style &^= windows.WS_MAXIMIZEBOX
757757
} else {
758758
style |= windows.WS_MAXIMIZEBOX

app/window.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -970,17 +970,21 @@ func Decorated(enabled bool) Option {
970970
}
971971
}
972972

973-
// HiddenMinimizeButton controls whether show minimize button on macos and windows
974-
func HiddenMinimizeButton(hidden bool) Option {
973+
// MinimizeButtonHidden hides the minimize button of the window.
974+
//
975+
// MinimizeButtonHidden is supported on Windows and macOS.
976+
func MinimizeButtonHidden(hidden bool) Option {
975977
return func(_ unit.Metric, cnf *Config) {
976-
cnf.HiddenMinimizeButton = hidden
978+
cnf.MinimizeButtonHidden = hidden
977979
}
978980
}
979981

980-
// HiddenMaximizeButton controls whether show maximize button on macos and windows
981-
func HiddenMaximizeButton(hidden bool) Option {
982+
// MaximizeButtonHidden hides the maximize button of the window.
983+
//
984+
// MaximizeButtonHidden is supported on Windows and macOS.
985+
func MaximizeButtonHidden(hidden bool) Option {
982986
return func(_ unit.Metric, cnf *Config) {
983-
cnf.HiddenMaximizeButton = hidden
987+
cnf.MaximizeButtonHidden = hidden
984988
}
985989
}
986990

0 commit comments

Comments
 (0)