-
Notifications
You must be signed in to change notification settings - Fork 132
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
app: add support to hidden minimize and maximize buttons on macos and … #143
base: main
Are you sure you want to change the base?
Changes from all commits
785ee0a
f78b768
59a113f
442ea0e
1997c68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,12 @@ type Config struct { | |
CustomRenderer bool | ||
// Decorated reports whether window decorations are provided automatically. | ||
Decorated bool | ||
|
||
// HiddenMinimizeButton hide the window's minimize button (only works for windows and macOS) | ||
HiddenMinimizeButton bool | ||
// HiddenMaximizeButton hide the window's maximize button (only works for windows and macOS) | ||
HiddenMaximizeButton bool | ||
Comment on lines
+51
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need this, and the |
||
|
||
// Focused reports whether has the keyboard focus. | ||
Focused bool | ||
// decoHeight is the height of the fallback decoration for platforms such | ||
|
@@ -176,6 +182,8 @@ type context interface { | |
// driver is the interface for the platform implementation | ||
// of a window. | ||
type driver interface { | ||
// DriverName get driver anme | ||
DriverName() string | ||
Comment on lines
+185
to
+186
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe |
||
// Event blocks until an event is available and returns it. | ||
Event() event.Event | ||
// Invalidate requests a FrameEvent. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,6 +272,14 @@ func (w *Window) updateState() { | |
w.updateAnimation() | ||
} | ||
|
||
// DriverName get driver name | ||
func (w *Window) DriverName() string { | ||
if w.driver == nil { | ||
return "" | ||
} | ||
return w.driver.DriverName() | ||
} | ||
|
||
// Invalidate the window such that a [FrameEvent] will be generated immediately. | ||
// If the window is inactive, an unspecified event is sent instead. | ||
// | ||
|
@@ -970,6 +978,20 @@ func Decorated(enabled bool) Option { | |
} | ||
} | ||
|
||
// HiddenMinimizeButton controls whether show minimize button on macos and windows | ||
func HiddenMinimizeButton(hidden bool) Option { | ||
Comment on lines
+981
to
+982
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: change name to
|
||
return func(_ unit.Metric, cnf *Config) { | ||
cnf.HiddenMinimizeButton = hidden | ||
} | ||
} | ||
|
||
// HiddenMaximizeButton controls whether show maximize button on macos and windows | ||
func HiddenMaximizeButton(hidden bool) Option { | ||
return func(_ unit.Metric, cnf *Config) { | ||
cnf.HiddenMaximizeButton = hidden | ||
} | ||
} | ||
|
||
// flushEvent is sent to detect when the user program | ||
// has completed processing of all prior events. Its an | ||
// [io/event.Event] but only for internal use. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: name this
MinimizeButtonHidden
and move the comment about supported platforms to itsOption
counterpart.