From 73fa611b3726fbb2f6af198e8a0744add75c4e94 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 11 Feb 2014 19:18:03 -0500 Subject: [PATCH] All build errors resolved. Now to test... --- menus_windows.go | 3 ++- stdwndclass_windows.go | 11 +++++++---- sysdata_windows.go | 2 +- uitask_windows.go | 6 ++++-- window.go | 6 ++++-- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/menus_windows.go b/menus_windows.go index 4f6c059..b1df44f 100644 --- a/menus_windows.go +++ b/menus_windows.go @@ -1,4 +1,5 @@ // 10 february 2014 +//package ui package main import ( @@ -8,5 +9,5 @@ import ( // Menu notifications. const ( - WM_COMMAND = 0x0111 + _WM_COMMAND = 0x0111 ) diff --git a/stdwndclass_windows.go b/stdwndclass_windows.go index e3eafa8..14a44aa 100644 --- a/stdwndclass_windows.go +++ b/stdwndclass_windows.go @@ -42,7 +42,7 @@ func stdWndProc(hwnd _HWND, uMsg uint32, wParam _WPARAM, lParam _LPARAM) _LRESUL uintptr(uMsg), uintptr(wParam), uintptr(lParam)) - return LRESULT(r1) + return _LRESULT(r1) } panic(fmt.Sprintf("stdWndProc message %d did not return: internal bug in ui library", uMsg)) } @@ -66,18 +66,21 @@ func registerStdWndClass() (err error) { _IDC_ARROW = 32512 ) - icon, err := user32.NewProc("LoadIconW").Call( + r1, _, err := user32.NewProc("LoadIconW").Call( uintptr(_NULL), uintptr(_IDI_APPLICATION)) if err != nil { return fmt.Errorf("error getting window icon: %v", err) } - cursor, err := user32.NewProc("LoadCursorW").Call( + icon := _HANDLE(r1) + + r1, _, err = user32.NewProc("LoadCursorW").Call( uintptr(_NULL), uintptr(_IDC_ARROW)) if err != nil { return fmt.Errorf("error getting window cursor: %v", err) } + cursor := _HANDLE(r1) wc := &_WNDCLASS{ lpszClassName: syscall.StringToUTF16Ptr(stdWndClass), @@ -88,7 +91,7 @@ func registerStdWndClass() (err error) { hbrBackground: _HBRUSH(_COLOR_BTNFACE + 1), } - r1, _, err := user32.NewProc("RegisterClassW").Call(uintptr(unsafe.Pointer(wc))) + r1, _, err = user32.NewProc("RegisterClassW").Call(uintptr(unsafe.Pointer(wc))) if r1 == 0 { // failure return fmt.Errorf("error registering class: %v", err) } diff --git a/sysdata_windows.go b/sysdata_windows.go index 2aaace3..6711c91 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -46,7 +46,7 @@ func (s *sysData) make() (err error) { p: []uintptr{ uintptr(ct.xstyle), ct.name, - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(s.title))), + uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(s.text))), uintptr(ct.style), uintptr(_CW_USEDEFAULT), // TODO uintptr(_CW_USEDEFAULT), diff --git a/uitask_windows.go b/uitask_windows.go index c0b6535..d944869 100644 --- a/uitask_windows.go +++ b/uitask_windows.go @@ -31,7 +31,7 @@ func ui(initDone chan error) { go msgloop() for m := range uitask { - r1, _, err := m.msg.Call(m.p...) + r1, _, err := m.call.Call(m.p...) m.ret <- uiret{ ret: r1, err: err, @@ -47,6 +47,8 @@ var ( _translateMessage = user32.NewProc("TranslateMessage") ) +var getMessageFail = -1 // because Go doesn't let me + func msgloop() { runtime.LockOSThread() @@ -60,7 +62,7 @@ func msgloop() { } for { - r1, _, err := getMessage.Call( + r1, _, err := _getMessage.Call( uintptr(unsafe.Pointer(&msg)), uintptr(_NULL), uintptr(0), diff --git a/window.go b/window.go index c04d276..8fb7ff8 100644 --- a/window.go +++ b/window.go @@ -24,8 +24,10 @@ type Window struct { func NewWindow(title string) *Window { return &Window{ sysData: &sysData{ - ctype: c_window, - text: title, + cSysData: cSysData{ + ctype: c_window, + text: title, + }, }, } }