mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
xevent file-chooser-dialog-opened onConfigure.
This commit is contained in:
parent
1559c6c3bd
commit
dbbbc85c18
@ -54,21 +54,6 @@ void XEventLoop(char *name) {
|
||||
}
|
||||
}
|
||||
|
||||
// CreateNotify
|
||||
if (event.type == CreateNotify) {
|
||||
Window window = event.xcreatewindow.window;
|
||||
|
||||
char *name;
|
||||
XFetchName(display, window, &name);
|
||||
|
||||
XTextProperty role;
|
||||
XGetTextProperty(display, window, &role, WM_WINDOW_ROLE);
|
||||
|
||||
goXEventCreateNotify(window, name, role.value);
|
||||
XFree(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
// ConfigureNotify
|
||||
if (event.type == ConfigureNotify) {
|
||||
Window window = event.xconfigure.window;
|
||||
|
@ -68,17 +68,6 @@ func goXEventClipboardUpdated() {
|
||||
emmiter.Emit("clipboard-updated")
|
||||
}
|
||||
|
||||
//export goXEventCreateNotify
|
||||
func goXEventCreateNotify(window C.Window, nameUnsafe *C.char, roleUnsafe *C.char) {
|
||||
role := C.GoString(roleUnsafe)
|
||||
if role != "GtkFileChooserDialog" {
|
||||
return
|
||||
}
|
||||
|
||||
file_chooser_dialog_window = uint32(window)
|
||||
emmiter.Emit("file-chooser-dialog-opened")
|
||||
}
|
||||
|
||||
//export goXEventConfigureNotify
|
||||
func goXEventConfigureNotify(display *C.Display, window C.Window, nameUnsafe *C.char, roleUnsafe *C.char) {
|
||||
role := C.GoString(roleUnsafe)
|
||||
@ -91,6 +80,11 @@ func goXEventConfigureNotify(display *C.Display, window C.Window, nameUnsafe *C.
|
||||
// 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
|
||||
@ -99,6 +93,7 @@ func goXEventUnmapNotify(window C.Window) {
|
||||
return
|
||||
}
|
||||
|
||||
file_chooser_dialog_window = 0
|
||||
emmiter.Emit("file-chooser-dialog-closed")
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
extern void goXEventCursorChanged(XFixesCursorNotifyEvent event);
|
||||
extern void goXEventClipboardUpdated();
|
||||
extern void goXEventCreateNotify(Window window, char *name, char *role);
|
||||
extern void goXEventConfigureNotify(Display *display, Window window, char *name, char *role);
|
||||
extern void goXEventUnmapNotify(Window window);
|
||||
extern void goXEventError(XErrorEvent *event, char *message);
|
||||
|
Loading…
Reference in New Issue
Block a user