Each control may only need one event, so combine them all into a single channel whose use depends on the sysData itself. Also we won't need to save the parentWindow anymore, as the change to the make() function will take care of that for us.
This commit is contained in:
parent
4b16716e61
commit
98d56767a3
|
@ -45,8 +45,8 @@ func stdWndProc(s *sysData) func(hwnd _HWND, uMsg uint32, wParam _WPARAM, lParam
|
||||||
// TODO
|
// TODO
|
||||||
return 0
|
return 0
|
||||||
case _WM_CLOSE:
|
case _WM_CLOSE:
|
||||||
if sysData.closing != nil {
|
if s.event != nil {
|
||||||
sysData.closing <- struct{}{}
|
s.event <- struct{}{}
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
default:
|
default:
|
||||||
|
|
10
sysdata.go
10
sysdata.go
|
@ -8,15 +8,9 @@ import (
|
||||||
// The sysData type contains all system data. It provides the system-specific underlying implementation. It is guaranteed to have the following by embedding:
|
// The sysData type contains all system data. It provides the system-specific underlying implementation. It is guaranteed to have the following by embedding:
|
||||||
type cSysData struct {
|
type cSysData struct {
|
||||||
ctype int
|
ctype int
|
||||||
parentWindow *sysData
|
event chan struct{}
|
||||||
|
|
||||||
// for Window
|
|
||||||
closing chan struct{}
|
|
||||||
|
|
||||||
// for Button
|
|
||||||
clicked chan struct{}
|
|
||||||
}
|
}
|
||||||
func (c *cSysData) make(initText string, initWidth int, initHeight int) error {
|
func (c *cSysData) make(initText string, initWidth int, initHeight int, window *sysData) error {
|
||||||
panic(runtime.GOOS + " sysData does not define make()")
|
panic(runtime.GOOS + " sysData does not define make()")
|
||||||
}
|
}
|
||||||
func (c *cSysData) show() error {
|
func (c *cSysData) show() error {
|
||||||
|
|
Loading…
Reference in New Issue