diff options
| author | Hayden Hamilton <hayden@hhvn.uk> | 2026-05-28 21:43:18 +0100 |
|---|---|---|
| committer | Hayden Hamilton <hayden@hhvn.uk> | 2026-05-28 21:43:18 +0100 |
| commit | 4af147be6f35e2bf39174a5db88148c7efdda9bd (patch) | |
| tree | 6c135f72f4efa10a5109ea67cdf17586c342f904 /main.go | |
| parent | 612e4fbeb14001d5eef0bb0e3e19ea65eb47cef2 (diff) | |
Don't fix X issues as events
This change was made years ago. IDK why. I just remember there being an
issue
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 36 |
1 files changed, 17 insertions, 19 deletions
@@ -45,23 +45,8 @@ func main() { case s := <-signals: common.Error("%s\n", s) break mainloop - case e := <- drw.Events: - if e.Ev == nil && e.Err == nil { - common.Error("X connection clossed\n") - break mainloop - } - - if e.Err != nil { - common.Perror("X.WaitForEvents", e.Err) - continue - } - - // switch e.Ev.(type) { - // case xproto.DestroyNotifyEvent: - // Err <- fmt.Errorf("Window destroyed") - // return - // default: - // } + case <- drw.XClosed: + break mainloop case err := <-bspc.EvErr: common.Error("Couldn't read event: %s\n", err) break mainloop @@ -91,9 +76,22 @@ func main() { common.Error("Couldn't load bspwm state: %s\n", err) break mainloop case blocks = <- status.NewBlocks: - Redraw(state, blocks) + select { + case <- drw.XClosed: + break mainloop + default: + // Will hang if X is closed + Redraw(state, blocks) + } case state = <- bspc.NewState: - Redraw(state, blocks) + // Would've used a fallthrough, + // but go doesn't allow it + select { + case <- drw.XClosed: + break mainloop + default: + Redraw(state, blocks) + } } } |