~eliasnaur/gio

0614bd29d751c563ef70a21b5bac6ac9132a80fb — Elias Naur 6 days ago 22b367c
app/internal/window: [X11] handle zero-length clipboard writes correctly

Fixes gio#118

Signed-off-by: Elias Naur <mail@eliasnaur.com>
1 files changed, 5 insertions(+), 1 deletions(-)

M app/internal/window/os_x11.go
M app/internal/window/os_x11.go => app/internal/window/os_x11.go +5 -1
@@ 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()
			}