From b9df65c216c412a2a81a0eb39c2069abbbe90234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 31 Jan 2021 15:01:46 +0100 Subject: [PATCH] xevent dialog window based on name. --- internal/desktop/xevent/xevent.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/desktop/xevent/xevent.go b/internal/desktop/xevent/xevent.go index 6f1d53f5..a5b34404 100644 --- a/internal/desktop/xevent/xevent.go +++ b/internal/desktop/xevent/xevent.go @@ -10,6 +10,7 @@ import "C" import ( "time" "unsafe" + "strings" "github.com/kataras/go-events" ) @@ -69,9 +70,14 @@ func goXEventClipboardUpdated() { } //export goXEventConfigureNotify -func goXEventConfigureNotify(display *C.Display, window C.Window, nameUnsafe *C.char, roleUnsafe *C.char) { - role := C.GoString(roleUnsafe) - if role != "GtkFileChooserDialog" { +func goXEventConfigureNotify(display *C.Display, window C.Window, name *C.char, role *C.char) { + if C.GoString(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 }