Removed that annoying log message on window close

This commit is contained in:
Sasha Koshka 2023-02-16 17:22:33 -05:00
parent e3369ab3d4
commit 270b49f825
2 changed files with 7 additions and 2 deletions

View File

@ -201,9 +201,8 @@ func (window *Window) Hide () {
}
func (window *Window) Close () {
delete(window.backend.windows, window.xWindow.Id)
if window.onClose != nil { window.onClose() }
xevent.Detach(window.xWindow.X, window.xWindow.Id)
delete(window.backend.windows, window.xWindow.Id)
window.xWindow.Destroy()
}

View File

@ -31,6 +31,8 @@ type Backend struct {
config config.Config
windows map[xproto.Window] *Window
open bool
}
// NewBackend instantiates an X backend.
@ -40,6 +42,7 @@ func NewBackend () (output tomo.Backend, err error) {
doChannel: make(chan func (), 0),
theme: theme.Default { },
config: config.Default { },
open: true,
}
// connect to X
@ -73,6 +76,9 @@ func (backend *Backend) Run () (err error) {
// Stop gracefully closes the connection and stops the event loop.
func (backend *Backend) Stop () {
backend.assert()
if !backend.open { return }
backend.open = false
toClose := []*Window { }
for _, window := range backend.windows {
toClose = append(toClose, window)