From aa3e2788f3b4db21c13cf17d7d9155408d20e622 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 11 Feb 2014 18:36:13 -0500 Subject: [PATCH] Moved some more data structures to common_windows.go and made more things private. --- common_windows.go | 50 ++++++++++++++++++++------------ unmigrated/rectangles_windows.go | 21 -------------- 2 files changed, 32 insertions(+), 39 deletions(-) delete mode 100644 unmigrated/rectangles_windows.go diff --git a/common_windows.go b/common_windows.go index 79d6fc9..fafdc1c 100644 --- a/common_windows.go +++ b/common_windows.go @@ -15,46 +15,47 @@ var ( gdi32 = syscall.NewLazyDLL("gdi32.dll") ) -type HANDLE uintptr -type HWND HANDLE -type HBRUSH HANDLE -type HMENU HANDLE +type _HANDLE uintptr +type _HWND _HANDLE +type _HBRUSH _HANDLE +type _HMENU _HANDLE const ( - NULL = 0 - FALSE = 0 // from windef.h - TRUE = 1 // from windef.h + _NULL = 0 + _FALSE = 0 // from windef.h + _TRUE = 1 // from windef.h ) -type ATOM uint16 - // TODO pull the thanks for these three from the old wingo source // TODO put these in windows.go -type WPARAM uintptr -type LPARAM uintptr -type LRESULT uintptr +type _WPARAM uintptr +type _LPARAM uintptr +type _LRESULT uintptr -func (w WPARAM) LOWORD() uint16 { +func (w _WPARAM) LOWORD() uint16 { // according to windef.h return uint16(w & 0xFFFF) } -func (w WPARAM) HIWORD() uint16 { +func (w _WPARAM) HIWORD() uint16 { // according to windef.h return uint16((w >> 16) & 0xFFFF) } -func LPARAMFromString(str string) LPARAM { - return LPARAM(unsafe.Pointer(syscall.StringToUTF16Ptr(str))) +func _LPARAMFromString(str string) _LPARAM { + return _LPARAM(unsafe.Pointer(syscall.StringToUTF16Ptr(str))) } // microsoft's header files do this -func MAKEINTRESOURCE(what uint16) uintptr { +func _MAKEINTRESOURCE(what uint16) uintptr { return uintptr(what) } +/* +// TODO migrate + // TODO adorn error messages with which step failed? -func getText(hwnd HWND) (text string, err error) { +func getText(hwnd _HWND) (text string, err error) { var tc []uint16 length, err := SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0) @@ -71,3 +72,16 @@ func getText(hwnd HWND) (text string, err error) { } return syscall.UTF16ToString(tc), nil } +*/ + +type _POINT struct { + X int32 + Y int32 +} + +type _RECT struct { + Left int32 + Top int32 + Right int32 + Bottom int32 +} diff --git a/unmigrated/rectangles_windows.go b/unmigrated/rectangles_windows.go deleted file mode 100644 index c0c29d5..0000000 --- a/unmigrated/rectangles_windows.go +++ /dev/null @@ -1,21 +0,0 @@ -// 9 february 2014 -package main - -import ( -// "syscall" -// "unsafe" -) - -// TODO merge with common.go? - -type POINT struct { - X int32 - Y int32 -} - -type RECT struct { - Left int32 - Top int32 - Right int32 - Bottom int32 -}