More go fmt.
This commit is contained in:
parent
a3222f248d
commit
5b19e6e9a1
2
init.go
2
init.go
|
@ -10,7 +10,7 @@ package ui
|
||||||
// It is not safe to call ui.Go() in a goroutine. It must be called directly from main().
|
// It is not safe to call ui.Go() in a goroutine. It must be called directly from main().
|
||||||
//
|
//
|
||||||
// This model is undesirable, but Cocoa limitations require it.
|
// This model is undesirable, but Cocoa limitations require it.
|
||||||
//
|
//
|
||||||
// Go does not process the command line for flags (that is, it does not call flag.Parse()), nor does package ui add any of the underlying toolkit's supported command-line flags.
|
// Go does not process the command line for flags (that is, it does not call flag.Parse()), nor does package ui add any of the underlying toolkit's supported command-line flags.
|
||||||
// If you must, and if the toolkit also has environment variable equivalents to these flags (for instance, GTK+), use those instead.
|
// If you must, and if the toolkit also has environment variable equivalents to these flags (for instance, GTK+), use those instead.
|
||||||
func Go(main func()) error {
|
func Go(main func()) error {
|
||||||
|
|
|
@ -4,19 +4,18 @@ package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
// "syscall"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
hInstance _HANDLE
|
hInstance _HANDLE
|
||||||
nCmdShow int
|
nCmdShow int
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO is this documented?
|
// TODO is this documented?
|
||||||
func getWinMainhInstance() (err error) {
|
func getWinMainhInstance() (err error) {
|
||||||
r1, _, err := kernel32.NewProc("GetModuleHandleW").Call(uintptr(_NULL))
|
r1, _, err := kernel32.NewProc("GetModuleHandleW").Call(uintptr(_NULL))
|
||||||
if r1 == 0 { // failure
|
if r1 == 0 { // failure
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
hInstance = _HANDLE(r1)
|
hInstance = _HANDLE(r1)
|
||||||
|
@ -26,29 +25,29 @@ func getWinMainhInstance() (err error) {
|
||||||
// this is what MinGW-w64 does (for instance, http://sourceforge.net/p/mingw-w64/code/6604/tree/trunk/mingw-w64-crt/crt/crtexe.c#l320); Burgundy in irc.freenode.net/#winapi said that the Visual C++ runtime does this too
|
// this is what MinGW-w64 does (for instance, http://sourceforge.net/p/mingw-w64/code/6604/tree/trunk/mingw-w64-crt/crt/crtexe.c#l320); Burgundy in irc.freenode.net/#winapi said that the Visual C++ runtime does this too
|
||||||
func getWinMainnCmdShow() {
|
func getWinMainnCmdShow() {
|
||||||
var info struct {
|
var info struct {
|
||||||
cb uint32
|
cb uint32
|
||||||
lpReserved *uint16
|
lpReserved *uint16
|
||||||
lpDesktop *uint16
|
lpDesktop *uint16
|
||||||
lpTitle *uint16
|
lpTitle *uint16
|
||||||
dwX uint32
|
dwX uint32
|
||||||
dwY uint32
|
dwY uint32
|
||||||
dwXSize uint32
|
dwXSize uint32
|
||||||
dwYSzie uint32
|
dwYSzie uint32
|
||||||
dwXCountChars uint32
|
dwXCountChars uint32
|
||||||
dwYCountChars uint32
|
dwYCountChars uint32
|
||||||
dwFillAttribute uint32
|
dwFillAttribute uint32
|
||||||
dwFlags uint32
|
dwFlags uint32
|
||||||
wShowWindow uint16
|
wShowWindow uint16
|
||||||
cbReserved2 uint16
|
cbReserved2 uint16
|
||||||
lpReserved2 *byte
|
lpReserved2 *byte
|
||||||
hStdInput _HANDLE
|
hStdInput _HANDLE
|
||||||
hStdOutput _HANDLE
|
hStdOutput _HANDLE
|
||||||
hStdError _HANDLE
|
hStdError _HANDLE
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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)))
|
||||||
if info.dwFlags & _STARTF_USESHOWWINDOW != 0 {
|
if info.dwFlags&_STARTF_USESHOWWINDOW != 0 {
|
||||||
nCmdShow = int(info.wShowWindow)
|
nCmdShow = int(info.wShowWindow)
|
||||||
} else {
|
} else {
|
||||||
nCmdShow = _SW_SHOWDEFAULT
|
nCmdShow = _SW_SHOWDEFAULT
|
||||||
|
@ -82,5 +81,5 @@ func doWindowsInit() (err error) {
|
||||||
return fmt.Errorf("error initializing Common Controls (comctl32.dll): %v", err)
|
return fmt.Errorf("error initializing Common Controls (comctl32.dll): %v", err)
|
||||||
}
|
}
|
||||||
// others go here
|
// others go here
|
||||||
return nil // all ready to go
|
return nil // all ready to go
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue