diff --git a/server/internal/desktop/xevent/xevent.c b/server/internal/desktop/xevent/xevent.c index 3791375c..76942953 100644 --- a/server/internal/desktop/xevent/xevent.c +++ b/server/internal/desktop/xevent/xevent.c @@ -79,45 +79,3 @@ void XEventLoop(char *name) { XCloseDisplay(display); } - -void XFileChooserHide(Display *display, Window window) { - Window root = RootWindow(display, 0); - - // The WM_TRANSIENT_FOR property is defined by the [ICCCM] for managed windows. - // This specification extends the use of the property to override-redirect windows. - // If an override-redirect is a pop-up on behalf of another window, then the Client - // SHOULD set WM_TRANSIENT_FOR on the override-redirect to this other window. - // - // As an example, a Client should set WM_TRANSIENT_FOR on dropdown menus to the - // toplevel application window that contains the menubar. - - // Remove WM_TRANSIENT_FOR - Atom WM_TRANSIENT_FOR = XInternAtom(display, "WM_TRANSIENT_FOR", 0); - XDeleteProperty(display, window, WM_TRANSIENT_FOR); - - // Add _NET_WM_STATE_BELOW - XClientMessageEvent clientMessageEvent; - memset(&clientMessageEvent, 0, sizeof(clientMessageEvent)); - - // window = the respective client window - // message_type = _NET_WM_STATE - // format = 32 - // data.l[0] = the action, as listed below - // _NET_WM_STATE_REMOVE 0 // remove/unset property - // _NET_WM_STATE_ADD 1 // add/set property - // _NET_WM_STATE_TOGGLE 2 // toggle property - // data.l[1] = first property to alter - // data.l[2] = second property to alter - // data.l[3] = source indication - // other data.l[] elements = 0 - - clientMessageEvent.type = ClientMessage; - clientMessageEvent.window = window; - clientMessageEvent.message_type = XInternAtom(display, "_NET_WM_STATE", 0); - clientMessageEvent.format = 32; - clientMessageEvent.data.l[0] = 1; - clientMessageEvent.data.l[1] = XInternAtom(display, "_NET_WM_STATE_BELOW", 0); - clientMessageEvent.data.l[3] = 1; - - XSendEvent(display, root, 0, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&clientMessageEvent); -} diff --git a/server/internal/desktop/xevent/xevent.go b/server/internal/desktop/xevent/xevent.go index fc91e919..9020e727 100644 --- a/server/internal/desktop/xevent/xevent.go +++ b/server/internal/desktop/xevent/xevent.go @@ -8,15 +8,12 @@ package xevent import "C" import ( - "strings" - "time" "unsafe" "github.com/kataras/go-events" ) var Emmiter events.EventEmmiter -var file_chooser_dialog_window uint32 = 0 func init() { Emmiter = events.New() @@ -41,36 +38,12 @@ func goXEventClipboardUpdated() { //export goXEventConfigureNotify 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 - } - - C.XFileChooserHide(display, window) - - // Because first dialog is not put properly to background - time.Sleep(10 * time.Millisecond) - C.XFileChooserHide(display, window) - - if file_chooser_dialog_window == 0 { - file_chooser_dialog_window = uint32(window) - Emmiter.Emit("file-chooser-dialog-opened") - } } //export goXEventUnmapNotify func goXEventUnmapNotify(window C.Window) { - if uint32(window) != file_chooser_dialog_window { - return - } - file_chooser_dialog_window = 0 - Emmiter.Emit("file-chooser-dialog-closed") } //export goXEventError