app/internal/window: [X11] handle zero-length clipboard writes correctly

Fixes gio#118

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-05-21 10:53:41 +02:00
parent 22b367cb33
commit 0614bd29d7
+5 -1
View File
@@ -401,9 +401,13 @@ func (h *x11EventHandler) handleEvents() bool {
notify()
case w.atoms.utf8string:
content := w.clipboard.content
var ptr *C.uchar
if len(content) > 0 {
ptr = (*C.uchar)(unsafe.Pointer(&content[0]))
}
C.XChangeProperty(w.x, cevt.requestor, cevt.property, w.atoms.utf8string,
8 /* bitwidth */, C.PropModeReplace,
(*C.uchar)(unsafe.Pointer(&content[0])), C.int(len(content)),
ptr, C.int(len(content)),
)
notify()
}