app/internal: [X11] implement Window.Close

Signed-off-by: Sebastien Binet <s@sbinet.org>
This commit is contained in:
Sebastien Binet
2020-06-22 17:20:34 +02:00
committed by Elias Naur
parent 9cfbdafe14
commit 59f07023d4
2 changed files with 18 additions and 3 deletions
+17 -2
View File
@@ -110,8 +110,23 @@ func (w *x11Window) WriteClipboard(s string) {
func (w *x11Window) ShowTextInput(show bool) {}
// Close the window. Not implemented for X11.
func (w *x11Window) Close() {}
// Close the window.
func (w *x11Window) Close() {
w.mu.Lock()
defer w.mu.Unlock()
ev := C.XClientMessageEvent{
_type: C.ClientMessage,
display: w.x,
window: w.xw,
message_type: w.atom("WM_PROTOCOLS", true),
format: 32,
}
arr := (*[5]C.long)(unsafe.Pointer(&ev.data))
arr[0] = C.long(w.atoms.evDelWindow)
arr[1] = C.CurrentTime
C.XSendEvent(w.x, w.xw, C.False, C.NoEventMask, (*C.XEvent)(unsafe.Pointer(&ev)))
}
var x11OneByte = make([]byte, 1)
+1 -1
View File
@@ -211,7 +211,7 @@ func (w *Window) WriteClipboard(s string) {
// Close the window. The window's event loop should exit when it receives
// system.DestroyEvent.
//
// Currently, only macOS and Windows driver implements this functionality,
// Currently, only macOS, Windows and X11 drivers implement this functionality,
// all others are stubbed.
func (w *Window) Close() {
w.driverDo(func() {