summaryrefslogtreecommitdiff
path: root/uitask_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-05-25 15:23:11 -0400
committerPietro Gagliardi <[email protected]>2014-05-25 15:23:11 -0400
commit2e6254ec61593d3da36bab2c855b2c7fd7f229ac (patch)
tree385f63de5b2ab0a3b1126c923995cdd45f093d01 /uitask_windows.go
parent51469fffb57cef9624f53a744409475fc14c6208 (diff)
Finished migrating the Windows code to using the pregenerated constants.
Diffstat (limited to 'uitask_windows.go')
-rw-r--r--uitask_windows.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/uitask_windows.go b/uitask_windows.go
index fed035b..65c6c4e 100644
--- a/uitask_windows.go
+++ b/uitask_windows.go
@@ -36,8 +36,7 @@ type uiret struct {
}
const (
- _WM_APP = 0x8000 + iota
- msgRequested
+ msgRequested = _WM_APP + iota + 1 // + 1 just to be safe
msgQuit
msgSetAreaSize
)
@@ -98,8 +97,6 @@ var (
_translateMessage = user32.NewProc("TranslateMessage")
)
-var getMessageFail = -1 // because Go doesn't let me
-
func msgloop() {
var msg struct {
hwnd _HWND
@@ -116,7 +113,7 @@ func msgloop() {
uintptr(_NULL),
uintptr(0),
uintptr(0))
- if r1 == uintptr(getMessageFail) { // error
+ if r1 == negConst(-1) { // error
panic("error getting message in message loop: " + err.Error())
}
if r1 == 0 { // WM_QUIT message
@@ -133,11 +130,6 @@ const (
msghandlerclass = "gomsghandler"
)
-const (
- // fron winuser.h
- _HWND_MESSAGE = -3
-)
-
func makeMessageHandler() (hwnd _HWND, err error) {
wc := &_WNDCLASS{
lpszClassName: uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(msghandlerclass))),
@@ -162,7 +154,8 @@ func makeMessageHandler() (hwnd _HWND, err error) {
negConst(_CW_USEDEFAULT),
negConst(_CW_USEDEFAULT),
negConst(_CW_USEDEFAULT),
- negConst(_HWND_MESSAGE),
+ // don't negConst() HWND_MESSAGE; windowsconstgen was given a pointer by windows.h, and pointers are unsigned, so converting it back to signed doesn't work
+ uintptr(_HWND_MESSAGE),
uintptr(_NULL),
uintptr(hInstance),
uintptr(_NULL))