Changed storeSysData() on Windows to write the HWND to the sysData structure there. This will be important for removing some of the TODOs from areaWndProc().

This commit is contained in:
Pietro Gagliardi 2014-05-30 23:28:41 -04:00
parent 09f5c7764e
commit b13453ad9e
2 changed files with 9 additions and 2 deletions

View File

@ -60,7 +60,9 @@ func storeSysData(hwnd _HWND, uMsg uint32, wParam _WPARAM, lParam _LPARAM) _LRES
cs := (*uintptr)(unsafe.Pointer(lParam))
saddr := *cs
setWindowLongPtr(hwnd, negConst(_GWLP_USERDATA), saddr)
// don't set s; we return here
// also set s.hwnd here so it can be used by other window messages right away
s := (*sysData)(unsafe.Pointer(saddr))
s.hwnd = hwnd
}
// TODO is this correct for WM_NCCREATE? I think the above link does it but I'm not entirely sure...
return defWindowProc(hwnd, uMsg, wParam, lParam)

View File

@ -179,7 +179,12 @@ func (s *sysData) make(window *sysData) (err error) {
}
return fmt.Errorf("error actually creating window/control: %v", r.err)
}
if !ct.storeSysData { // regular control; store s.hwnd ourselves
s.hwnd = _HWND(r.ret)
} else if s.hwnd != _HWND(r.ret) { // we store sysData in storeSysData(); sanity check
// TODO really panic?
panic(fmt.Errorf("hwnd mismatch creating window/control: storeSysData() stored 0x%X but CreateWindowEx() returned 0x%X", s.hwnd, ret))
}
if !ct.doNotLoadFont {
uitask <- &uimsg{
call: _sendMessage,