mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-02 16:06:19 +00:00
app,app/internal/window: [macOS] add app.Window.Close for closing a window
Recently support was added for multiple top-level windows. Add support for closing those windows. macOS only; all others stubbed out. Signed-off-by: Larry Clapp <larry@theclapp.org>
This commit is contained in:
@@ -208,6 +208,17 @@ func (w *Window) WriteClipboard(s string) {
|
||||
})
|
||||
}
|
||||
|
||||
// Close the window. The window's event loop should exit when it receives
|
||||
// system.DestroyEvent.
|
||||
//
|
||||
// Currently, only the macOS driver implements this functionality, all others
|
||||
// are stubbed.
|
||||
func (w *Window) Close() {
|
||||
w.driverDo(func() {
|
||||
w.driver.Close()
|
||||
})
|
||||
}
|
||||
|
||||
// driverDo calls f as soon as the window has a valid driver attached,
|
||||
// or does nothing if the window is destroyed while waiting.
|
||||
func (w *Window) driverDo(f func()) {
|
||||
|
||||
Reference in New Issue
Block a user