Derp me, more incorrect error checking! But now a window shows, and the process hangs, so progress!

This commit is contained in:
Pietro Gagliardi 2014-02-11 20:23:49 -05:00
parent 88363e131c
commit ae14253c80
1 changed files with 6 additions and 8 deletions

View File

@ -90,22 +90,20 @@ func (s *sysData) show() (err error) {
} }
ret := make(chan uiret) ret := make(chan uiret)
defer close(ret) defer close(ret)
// TODO figure out how to handle error
uitask <- &uimsg{ uitask <- &uimsg{
call: _showWindow, call: _showWindow,
p: []uintptr{uintptr(s.hwnd), show}, p: []uintptr{uintptr(s.hwnd), show},
ret: ret, ret: ret,
} }
r := <-ret <-ret
if r.err != nil {
return r.err
}
if !s.shownAlready { if !s.shownAlready {
uitask <- &uimsg{ uitask <- &uimsg{
call: _updateWindow, call: _updateWindow,
p: []uintptr{uintptr(s.hwnd)}, p: []uintptr{uintptr(s.hwnd)},
ret: ret, ret: ret,
} }
r = <-ret r := <-ret
if r.ret == 0 { // failure if r.ret == 0 { // failure
return fmt.Errorf("error updating window for the first time: %v", r.err) return fmt.Errorf("error updating window for the first time: %v", r.err)
} }
@ -117,12 +115,12 @@ func (s *sysData) show() (err error) {
func (s *sysData) hide() (err error) { func (s *sysData) hide() (err error) {
ret := make(chan uiret) ret := make(chan uiret)
defer close(ret) defer close(ret)
// TODO figure out how to handle error
uitask <- &uimsg{ uitask <- &uimsg{
call: _showWindow, call: _showWindow,
p: []uintptr{uintptr(s.hwnd), _SW_HIDE}, p: []uintptr{uintptr(s.hwnd), _SW_HIDE},
ret: ret, ret: ret,
} }
r := <-ret <-ret
close(ret) return nil
return r.err
} }