summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-12 20:55:05 -0500
committerPietro Gagliardi <[email protected]>2014-02-12 20:55:05 -0500
commit98d56767a34c3acf6beda2ef801b1daeb4c88971 (patch)
tree07677725dd8345162fa067fdbf704f3785f909fa
parent4b16716e61e6f551afd1980aa21268c976fa3886 (diff)
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.
-rw-r--r--stdwndclass_windows.go4
-rw-r--r--sysdata.go10
2 files changed, 4 insertions, 10 deletions
diff --git a/stdwndclass_windows.go b/stdwndclass_windows.go
index 035751c..38031e7 100644
--- a/stdwndclass_windows.go
+++ b/stdwndclass_windows.go
@@ -45,8 +45,8 @@ func stdWndProc(s *sysData) func(hwnd _HWND, uMsg uint32, wParam _WPARAM, lParam
// TODO
return 0
case _WM_CLOSE:
- if sysData.closing != nil {
- sysData.closing <- struct{}{}
+ if s.event != nil {
+ s.event <- struct{}{}
}
return 0
default:
diff --git a/sysdata.go b/sysdata.go
index 339d73e..c15e922 100644
--- a/sysdata.go
+++ b/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:
type cSysData struct {
ctype int
- parentWindow *sysData
-
- // for Window
- closing chan struct{}
-
- // for Button
- clicked chan struct{}
+ event 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()")
}
func (c *cSysData) show() error {