Fixes (windows).
This commit is contained in:
parent
3d8fdb534e
commit
e211121451
2 changed files with 9 additions and 6 deletions
|
@ -13,7 +13,7 @@ var (
|
||||||
func message(kind messageKind, text string, options []Option) (bool, error) {
|
func message(kind messageKind, text string, options []Option) (bool, error) {
|
||||||
opts := applyOptions(options)
|
opts := applyOptions(options)
|
||||||
|
|
||||||
var flags, caption uintptr
|
var flags uintptr
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case kind == questionKind && opts.extraButton != "":
|
case kind == questionKind && opts.extraButton != "":
|
||||||
|
@ -41,10 +41,6 @@ func message(kind messageKind, text string, options []Option) (bool, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.title != "" {
|
|
||||||
caption = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(opts.title)))
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts.okLabel != "" || opts.cancelLabel != "" || opts.extraButton != "" {
|
if opts.okLabel != "" || opts.cancelLabel != "" || opts.extraButton != "" {
|
||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
defer runtime.UnlockOSThread()
|
defer runtime.UnlockOSThread()
|
||||||
|
@ -58,7 +54,7 @@ func message(kind messageKind, text string, options []Option) (bool, error) {
|
||||||
|
|
||||||
n, _, err := messageBox.Call(0,
|
n, _, err := messageBox.Call(0,
|
||||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(text))),
|
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(text))),
|
||||||
caption, flags)
|
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(opts.title))), flags)
|
||||||
|
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return false, err
|
return false, err
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package zenity
|
package zenity
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
@ -33,8 +34,14 @@ func notify(text string, options []Option) error {
|
||||||
args.InfoFlags |= 0x3 // NIIF_ERROR
|
args.InfoFlags |= 0x3 // NIIF_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
n, _, err := shellNotifyIcon.Call(0 /* NIM_ADD */, uintptr(unsafe.Pointer(&args)))
|
n, _, err := shellNotifyIcon.Call(0 /* NIM_ADD */, uintptr(unsafe.Pointer(&args)))
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
|
if errno, ok := err.(syscall.Errno); ok && errno == 0 {
|
||||||
|
_, err = Info(text, Title(opts.title), Icon(opts.icon))
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue