mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 10:25:37 +00:00
app/internal: [X11] implement Window.Close
Signed-off-by: Sebastien Binet <s@sbinet.org>
This commit is contained in:
committed by
Elias Naur
parent
9cfbdafe14
commit
59f07023d4
@@ -110,8 +110,23 @@ func (w *x11Window) WriteClipboard(s string) {
|
|||||||
|
|
||||||
func (w *x11Window) ShowTextInput(show bool) {}
|
func (w *x11Window) ShowTextInput(show bool) {}
|
||||||
|
|
||||||
// Close the window. Not implemented for X11.
|
// Close the window.
|
||||||
func (w *x11Window) Close() {}
|
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)
|
var x11OneByte = make([]byte, 1)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -211,7 +211,7 @@ func (w *Window) WriteClipboard(s string) {
|
|||||||
// Close the window. The window's event loop should exit when it receives
|
// Close the window. The window's event loop should exit when it receives
|
||||||
// system.DestroyEvent.
|
// 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.
|
// all others are stubbed.
|
||||||
func (w *Window) Close() {
|
func (w *Window) Close() {
|
||||||
w.driverDo(func() {
|
w.driverDo(func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user