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) {
|
||||
opts := applyOptions(options)
|
||||
|
||||
var flags, caption uintptr
|
||||
var flags uintptr
|
||||
|
||||
switch {
|
||||
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 != "" {
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
@ -58,7 +54,7 @@ func message(kind messageKind, text string, options []Option) (bool, error) {
|
|||
|
||||
n, _, err := messageBox.Call(0,
|
||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(text))),
|
||||
caption, flags)
|
||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(opts.title))), flags)
|
||||
|
||||
if n == 0 {
|
||||
return false, err
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package zenity
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
@ -33,8 +34,14 @@ func notify(text string, options []Option) error {
|
|||
args.InfoFlags |= 0x3 // NIIF_ERROR
|
||||
}
|
||||
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
n, _, err := shellNotifyIcon.Call(0 /* NIM_ADD */, uintptr(unsafe.Pointer(&args)))
|
||||
if n == 0 {
|
||||
if errno, ok := err.(syscall.Errno); ok && errno == 0 {
|
||||
_, err = Info(text, Title(opts.title), Icon(opts.icon))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue