Finished migrating the Windows code to using the pregenerated constants.
This commit is contained in:
parent
51469fffb5
commit
2e6254ec61
|
@ -80,6 +80,7 @@ var hacknames = map[string]string{
|
||||||
"_NULL": "x_NULL",
|
"_NULL": "x_NULL",
|
||||||
"_IDI_APPLICATION": "x_IDI_APPLICATION",
|
"_IDI_APPLICATION": "x_IDI_APPLICATION",
|
||||||
"_IDC_ARROW": "x_IDC_ARROW",
|
"_IDC_ARROW": "x_IDC_ARROW",
|
||||||
|
"_HWND_MESSAGE": "x_HWND_MESSAGE",
|
||||||
}
|
}
|
||||||
|
|
||||||
func hacknamesPreamble() string {
|
func hacknamesPreamble() string {
|
||||||
|
@ -126,8 +127,7 @@ func main() {
|
||||||
knowns += "\n" + ident + " (" + kind + ")"
|
knowns += "\n" + ident + " (" + kind + ")"
|
||||||
}
|
}
|
||||||
if knowns != "" {
|
if knowns != "" {
|
||||||
//ignore for now while I still migrate everything
|
panic("error: the following are still known!" + knowns) // has a newline already
|
||||||
// panic("error: the following are still known!" + knowns) // has a newline already
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep sorted for git
|
// keep sorted for git
|
||||||
|
|
|
@ -45,7 +45,6 @@ func getWinMainnCmdShow() {
|
||||||
hStdOutput _HANDLE
|
hStdOutput _HANDLE
|
||||||
hStdError _HANDLE
|
hStdError _HANDLE
|
||||||
}
|
}
|
||||||
const _STARTF_USESHOWWINDOW = 0x00000001
|
|
||||||
|
|
||||||
// does not fail according to MSDN
|
// does not fail according to MSDN
|
||||||
kernel32.NewProc("GetStartupInfoW").Call(uintptr(unsafe.Pointer(&info)))
|
kernel32.NewProc("GetStartupInfoW").Call(uintptr(unsafe.Pointer(&info)))
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
// 10 february 2014
|
|
||||||
|
|
||||||
package ui
|
|
||||||
|
|
||||||
import (
|
|
||||||
// "syscall"
|
|
||||||
// "unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Menu notifications.
|
|
||||||
const (
|
|
||||||
_WM_COMMAND = 0x0111
|
|
||||||
)
|
|
|
@ -16,11 +16,6 @@ var (
|
||||||
statusbarFont _HANDLE
|
statusbarFont _HANDLE
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
_SPI_GETNONCLIENTMETRICS = 0x0029
|
|
||||||
_LF_FACESIZE = 32 // from wingdi.h
|
|
||||||
)
|
|
||||||
|
|
||||||
type _LOGFONT struct {
|
type _LOGFONT struct {
|
||||||
lfHeight int32
|
lfHeight int32
|
||||||
lfWidth int32
|
lfWidth int32
|
||||||
|
|
|
@ -36,8 +36,7 @@ type uiret struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_WM_APP = 0x8000 + iota
|
msgRequested = _WM_APP + iota + 1 // + 1 just to be safe
|
||||||
msgRequested
|
|
||||||
msgQuit
|
msgQuit
|
||||||
msgSetAreaSize
|
msgSetAreaSize
|
||||||
)
|
)
|
||||||
|
@ -98,8 +97,6 @@ var (
|
||||||
_translateMessage = user32.NewProc("TranslateMessage")
|
_translateMessage = user32.NewProc("TranslateMessage")
|
||||||
)
|
)
|
||||||
|
|
||||||
var getMessageFail = -1 // because Go doesn't let me
|
|
||||||
|
|
||||||
func msgloop() {
|
func msgloop() {
|
||||||
var msg struct {
|
var msg struct {
|
||||||
hwnd _HWND
|
hwnd _HWND
|
||||||
|
@ -116,7 +113,7 @@ func msgloop() {
|
||||||
uintptr(_NULL),
|
uintptr(_NULL),
|
||||||
uintptr(0),
|
uintptr(0),
|
||||||
uintptr(0))
|
uintptr(0))
|
||||||
if r1 == uintptr(getMessageFail) { // error
|
if r1 == negConst(-1) { // error
|
||||||
panic("error getting message in message loop: " + err.Error())
|
panic("error getting message in message loop: " + err.Error())
|
||||||
}
|
}
|
||||||
if r1 == 0 { // WM_QUIT message
|
if r1 == 0 { // WM_QUIT message
|
||||||
|
@ -133,11 +130,6 @@ const (
|
||||||
msghandlerclass = "gomsghandler"
|
msghandlerclass = "gomsghandler"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
// fron winuser.h
|
|
||||||
_HWND_MESSAGE = -3
|
|
||||||
)
|
|
||||||
|
|
||||||
func makeMessageHandler() (hwnd _HWND, err error) {
|
func makeMessageHandler() (hwnd _HWND, err error) {
|
||||||
wc := &_WNDCLASS{
|
wc := &_WNDCLASS{
|
||||||
lpszClassName: uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(msghandlerclass))),
|
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(_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(_NULL),
|
||||||
uintptr(hInstance),
|
uintptr(hInstance),
|
||||||
uintptr(_NULL))
|
uintptr(_NULL))
|
||||||
|
|
|
@ -44,6 +44,7 @@ const _LB_GETSELITEMS = 401
|
||||||
const _LB_GETTEXT = 393
|
const _LB_GETTEXT = 393
|
||||||
const _LB_GETTEXTLEN = 394
|
const _LB_GETTEXTLEN = 394
|
||||||
const _LB_INSERTSTRING = 385
|
const _LB_INSERTSTRING = 385
|
||||||
|
const _LF_FACESIZE = 32
|
||||||
const _MA_ACTIVATE = 1
|
const _MA_ACTIVATE = 1
|
||||||
const _MB_ICONERROR = 16
|
const _MB_ICONERROR = 16
|
||||||
const _MB_OK = 0
|
const _MB_OK = 0
|
||||||
|
@ -72,9 +73,11 @@ const _SIF_RANGE = 1
|
||||||
const _SIF_TRACKPOS = 16
|
const _SIF_TRACKPOS = 16
|
||||||
const _SM_CXDOUBLECLK = 36
|
const _SM_CXDOUBLECLK = 36
|
||||||
const _SM_CYDOUBLECLK = 37
|
const _SM_CYDOUBLECLK = 37
|
||||||
|
const _SPI_GETNONCLIENTMETRICS = 41
|
||||||
const _SRCCOPY = 13369376
|
const _SRCCOPY = 13369376
|
||||||
const _SS_LEFTNOWORDWRAP = 12
|
const _SS_LEFTNOWORDWRAP = 12
|
||||||
const _SS_NOPREFIX = 128
|
const _SS_NOPREFIX = 128
|
||||||
|
const _STARTF_USESHOWWINDOW = 1
|
||||||
const _SW_ERASE = 4
|
const _SW_ERASE = 4
|
||||||
const _SW_HIDE = 0
|
const _SW_HIDE = 0
|
||||||
const _SW_INVALIDATE = 2
|
const _SW_INVALIDATE = 2
|
||||||
|
@ -115,7 +118,9 @@ const _VK_SHIFT = 16
|
||||||
const _VK_SUBTRACT = 109
|
const _VK_SUBTRACT = 109
|
||||||
const _VK_UP = 38
|
const _VK_UP = 38
|
||||||
const _WM_ACTIVATE = 6
|
const _WM_ACTIVATE = 6
|
||||||
|
const _WM_APP = 32768
|
||||||
const _WM_CLOSE = 16
|
const _WM_CLOSE = 16
|
||||||
|
const _WM_COMMAND = 273
|
||||||
const _WM_ERASEBKGND = 20
|
const _WM_ERASEBKGND = 20
|
||||||
const _WM_GETMINMAXINFO = 36
|
const _WM_GETMINMAXINFO = 36
|
||||||
const _WM_GETTEXT = 13
|
const _WM_GETTEXT = 13
|
||||||
|
@ -146,6 +151,7 @@ const _WS_OVERLAPPEDWINDOW = 13565952
|
||||||
const _WS_TABSTOP = 65536
|
const _WS_TABSTOP = 65536
|
||||||
const _WS_VISIBLE = 268435456
|
const _WS_VISIBLE = 268435456
|
||||||
const _WS_VSCROLL = 2097152
|
const _WS_VSCROLL = 2097152
|
||||||
|
const _HWND_MESSAGE = 4294967293
|
||||||
const _IDC_ARROW = 32512
|
const _IDC_ARROW = 32512
|
||||||
const _IDI_APPLICATION = 32512
|
const _IDI_APPLICATION = 32512
|
||||||
const _INVALID_HANDLE_VALUE = 4294967295
|
const _INVALID_HANDLE_VALUE = 4294967295
|
||||||
|
|
Loading…
Reference in New Issue