Removed constants from common_windows.go. Almost done!
This commit is contained in:
parent
e7327f2378
commit
51469fffb5
|
@ -20,12 +20,6 @@ type _HWND _HANDLE
|
|||
type _HBRUSH _HANDLE
|
||||
type _HMENU _HANDLE
|
||||
|
||||
const (
|
||||
_NULL = 0
|
||||
_FALSE = 0 // from windef.h
|
||||
_TRUE = 1 // from windef.h
|
||||
)
|
||||
|
||||
// In MSDN, _LPARAM and _LRESULT are listed as signed pointers, however their interpretation is message-specific. Ergo, just cast them yourself; it'll be the same. (Thanks to Tv` in #go-nuts for helping me realize this.)
|
||||
type _WPARAM uintptr
|
||||
type _LPARAM uintptr
|
||||
|
@ -45,11 +39,6 @@ func _LPARAMFromString(str string) _LPARAM {
|
|||
return _LPARAM(unsafe.Pointer(syscall.StringToUTF16Ptr(str)))
|
||||
}
|
||||
|
||||
// microsoft's header files do this
|
||||
func _MAKEINTRESOURCE(what uint16) uintptr {
|
||||
return uintptr(what)
|
||||
}
|
||||
|
||||
func (l _LPARAM) X() int32 {
|
||||
// according to windowsx.h
|
||||
loword := uint16(l & 0xFFFF)
|
||||
|
@ -81,37 +70,3 @@ type _RECT struct {
|
|||
func negConst(c int) uintptr {
|
||||
return uintptr(c)
|
||||
}
|
||||
|
||||
// Predefined cursor resource IDs.
|
||||
const (
|
||||
_IDC_APPSTARTING = 32650
|
||||
_IDC_ARROW = 32512
|
||||
_IDC_CROSS = 32515
|
||||
_IDC_HAND = 32649
|
||||
_IDC_HELP = 32651
|
||||
_IDC_IBEAM = 32513
|
||||
// _IDC_ICON = 32641 // [Obsolete for applications marked version 4.0 or later.]
|
||||
_IDC_NO = 32648
|
||||
// _IDC_SIZE = 32640 // [Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL.]
|
||||
_IDC_SIZEALL = 32646
|
||||
_IDC_SIZENESW = 32643
|
||||
_IDC_SIZENS = 32645
|
||||
_IDC_SIZENWSE = 32642
|
||||
_IDC_SIZEWE = 32644
|
||||
_IDC_UPARROW = 32516
|
||||
_IDC_WAIT = 32514
|
||||
)
|
||||
|
||||
// Predefined icon resource IDs.
|
||||
const (
|
||||
_IDI_APPLICATION = 32512
|
||||
_IDI_ASTERISK = 32516
|
||||
_IDI_ERROR = 32513
|
||||
_IDI_EXCLAMATION = 32515
|
||||
_IDI_HAND = 32513
|
||||
_IDI_INFORMATION = 32516
|
||||
_IDI_QUESTION = 32514
|
||||
_IDI_SHIELD = 32518
|
||||
_IDI_WARNING = 32515
|
||||
_IDI_WINLOGO = 32517
|
||||
)
|
||||
|
|
|
@ -73,9 +73,13 @@ func gatherNames(pkg *ast.Package) {
|
|||
}
|
||||
|
||||
// some constants confuse cgo into thinking they're external symbols for some reason
|
||||
// fortunately all these constants are pointers
|
||||
// TODO debug cgo
|
||||
var hacknames = map[string]string{
|
||||
"_INVALID_HANDLE_VALUE": "x_INVALID_HANDLE_VALUE",
|
||||
"_NULL": "x_NULL",
|
||||
"_IDI_APPLICATION": "x_IDI_APPLICATION",
|
||||
"_IDC_ARROW": "x_IDC_ARROW",
|
||||
}
|
||||
|
||||
func hacknamesPreamble() string {
|
||||
|
|
|
@ -123,10 +123,11 @@ func registerStdWndClass(s *sysData) (newClassName string, err error) {
|
|||
return newClassName, nil
|
||||
}
|
||||
|
||||
// no need to use/recreate MAKEINTRESOURCE() here as the Windows constant generator already took care of that because Microsoft's headers do already
|
||||
func initWndClassInfo() (err error) {
|
||||
r1, _, err := user32.NewProc("LoadIconW").Call(
|
||||
uintptr(_NULL),
|
||||
_MAKEINTRESOURCE(_IDI_APPLICATION))
|
||||
uintptr(_IDI_APPLICATION))
|
||||
if r1 == 0 { // failure
|
||||
return fmt.Errorf("error getting window icon: %v", err)
|
||||
}
|
||||
|
@ -134,7 +135,7 @@ func initWndClassInfo() (err error) {
|
|||
|
||||
r1, _, err = user32.NewProc("LoadCursorW").Call(
|
||||
uintptr(_NULL),
|
||||
_MAKEINTRESOURCE(_IDC_ARROW))
|
||||
uintptr(_IDC_ARROW))
|
||||
if r1 == 0 { // failure
|
||||
return fmt.Errorf("error getting window cursor: %v", err)
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ const _DIB_RGB_COLORS = 0
|
|||
const _ERROR = 0
|
||||
const _ES_AUTOHSCROLL = 128
|
||||
const _ES_PASSWORD = 32
|
||||
const _FALSE = 0
|
||||
const _GWL_STYLE = -16
|
||||
const _ICC_PROGRESS_CLASS = 32
|
||||
const _LBS_EXTENDEDSEL = 2048
|
||||
|
@ -79,6 +80,7 @@ const _SW_HIDE = 0
|
|||
const _SW_INVALIDATE = 2
|
||||
const _SW_SHOW = 5
|
||||
const _SW_SHOWDEFAULT = 10
|
||||
const _TRUE = 1
|
||||
const _VK_ADD = 107
|
||||
const _VK_CONTROL = 17
|
||||
const _VK_DELETE = 46
|
||||
|
@ -144,4 +146,7 @@ const _WS_OVERLAPPEDWINDOW = 13565952
|
|||
const _WS_TABSTOP = 65536
|
||||
const _WS_VISIBLE = 268435456
|
||||
const _WS_VSCROLL = 2097152
|
||||
const _IDC_ARROW = 32512
|
||||
const _IDI_APPLICATION = 32512
|
||||
const _INVALID_HANDLE_VALUE = 4294967295
|
||||
const _NULL = 0
|
||||
|
|
Loading…
Reference in New Issue