From f3193cb362285c40ce448a123f0c40023ae1bbf3 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 8 Jun 2016 15:27:59 -0700 Subject: [PATCH] x11/x11base.scm (x-get-window-property): Read entire string value. The new char-ptr-to-prop-data-8 procedure reads the specified number of bytes. (c-peek-cstringp stops at #\NULs.) --- src/x11/x11base.scm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/x11/x11base.scm b/src/x11/x11base.scm index bcdc05cf1..42a236738 100644 --- a/src/x11/x11base.scm +++ b/src/x11/x11base.scm @@ -782,7 +782,9 @@ USA. (c-> data-return "* char") (c-> nitems-return "ulong"))) ((= 8 actual-format) - (c-peek-cstringp data-return)) + (char-ptr-to-prop-data-8 + (c-> data-return "* char") + (c-> nitems-return "ulong"))) (else (error "Unexpected format:" actual-format)))))) (cleanup-alien! data-return) @@ -814,6 +816,17 @@ USA. (loop (1+ index))))) result)) +(define (char-ptr-to-prop-data-8 data length) + (let ((scan (copy-alien data)) + (result (make-string length))) + (let loop ((index 0)) + (if (< index length) + (begin + (string-set! result index (ascii->char (c-> scan "uchar"))) + (alien-byte-increment! scan (c-sizeof "uchar")) + (loop (1+ index))))) + result)) + (define (x-change-property display window property type format mode data) (guarantee-xdisplay display 'x-change-property) (guarantee-Window window 'x-change-property) -- 2.25.1