x11/x11base.scm (x-get-window-property): Read entire string value.
authorMatt Birkholz <puck@birchwood-abbey.net>
Wed, 8 Jun 2016 22:27:59 +0000 (15:27 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Wed, 8 Jun 2016 22:27:59 +0000 (15:27 -0700)
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

index bcdc05cf137e87060488525d02c27eb18feb0404..42a236738e7e28d55adacdc279867e0149aee6b9 100644 (file)
@@ -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)