xevent dialog window based on name.

This commit is contained in:
Miroslav Šedivý 2021-01-31 15:01:46 +01:00
parent 52670b9415
commit b9df65c216

View File

@ -10,6 +10,7 @@ import "C"
import ( import (
"time" "time"
"unsafe" "unsafe"
"strings"
"github.com/kataras/go-events" "github.com/kataras/go-events"
) )
@ -69,9 +70,14 @@ func goXEventClipboardUpdated() {
} }
//export goXEventConfigureNotify //export goXEventConfigureNotify
func goXEventConfigureNotify(display *C.Display, window C.Window, nameUnsafe *C.char, roleUnsafe *C.char) { func goXEventConfigureNotify(display *C.Display, window C.Window, name *C.char, role *C.char) {
role := C.GoString(roleUnsafe) if C.GoString(role) != "GtkFileChooserDialog" {
if role != "GtkFileChooserDialog" { return
}
// TODO: Refactor. Right now processing of this dialog relies on identifying
// via its name. When that changes to role, this condition should be removed.
if !strings.HasPrefix(C.GoString(name), "Open File") {
return return
} }