xwem-patches
[Top] [All Lists]

Summary for xlib--main--2.1--patch-12

From: Zajcev Evgeny <lg@xxxxxxxx>
Subject: Summary for xlib--main--2.1--patch-12
Date: Thu, 31 Mar 2005 02:24:11 +0400 (MSD)
Location: lg@xxxxxxxxxxxxxx http://arch.xwem.org/2005/

Revision: xlib--main--2.1--patch-12
Archive: lg@xxxxxxxxxxxxxx
Creator: Zajcev Evgeny <lg@xxxxxxxx>
Date: Thu Mar 31 02:24:01 MSD 2005
Standard-date: 2005-03-30 22:24:01 GMT
Modified-files: lisp/xlib-xlib.el
New-patches: dev@xxxxxxxxxxxxxxxx/xlib--dev--2.1--patch-7
    lg@xxxxxxxxxxxxxx/xlib--main--2.1--patch-12
Summary: Support for COMPOUNT_TEXT properties.
Keywords: COMPOUND_TEXT

* lisp/xlib-xlib.el (XDecodeCompoundText): [new] Function to extract text
  from COMPOUND_TEXT text.

* lisp/xlib-xlib.el (XGetPropertyString): [fix] Use `XDecodeCompoundText'
  in case of property in COMPOUND_TEXT encoding.

* added files

    {arch}/xlib/xlib--dev/xlib--dev--2.1/dev@xxxxxxxxxxxxxxxx/patch-log/patch-7
    {arch}/xlib/xlib--main/xlib--main--2.1/lg@xxxxxxxxxxxxxx/patch-log/patch-12

* modified files

--- orig/lisp/xlib-xlib.el
+++ mod/lisp/xlib-xlib.el
@@ -758,17 +758,45 @@
                     :base-height (Xtruncate (nth 16 wmnh))
                     :gravity (Xtruncate (nth 17 wmnh))))))
 
+(defun XDecodeCompoundText (text)
+  "Decode compound TEXT, to native string.
+Evil hack, invent something better."
+  (if (string-match "\x1b\x25\x2f\x31\\(.\\)\\(.\\)\\(.*?\\)\x02" text)
+      (let ((len (+ (* (- (char-to-int (string-to-char (match-string 1 text))) 
128) 128)
+                    (- (char-to-int (string-to-char (match-string 2 text))) 
128))))
+        (let ((seq-beg (match-beginning 0))
+              (data-beg (match-end 0))
+              (data-end (+ len (match-beginning 3)))
+              (cs (intern (match-string 3 text))))
+          (concat (substring text 0 seq-beg)
+                  (if (fboundp 'decode-coding-string)
+                      (decode-coding-string (substring text data-beg data-end) 
cs)
+                    (substring text data-beg data-end))
+                  (XDecodeCompoundText (substring text data-end)))))
+    text))
+
 (defun XGetPropertyString (xdpy win atom)
   "On display XDPY, and window XWIN, get string property of type ATOM."
-  (let ((propdata (XGetWindowProperty xdpy win atom 0 1024 nil XA-string))
+  (let ((propdata (XGetWindowProperty xdpy win atom 0 1024))
+        (tdata nil)
        (retstring ""))
-    (when propdata
-      (setq retstring (nth 2 propdata))
+    (when (and propdata (setq tdata (nth 2 propdata)))
+      (setq retstring tdata)
+      (when (= (car propdata)
+               (X-Atom-id (XInternAtom xdpy "COMPOUND_TEXT")))
+        ;; Adjust RETSTRING in case of COMPOUND_TEXT
+        (setq retstring (XDecodeCompoundText retstring)))
+
       (when (> (nth 1 propdata) 0.0)
-        (setq propdata (XGetWindowProperty xdpy win atom
-                                           1024 (nth 0 propdata) nil 
XA-string))
-        (when propdata
-          (setq retstring (concat retstring (nth 2 propdata))))))
+        (setq propdata
+              (XGetWindowProperty xdpy win atom
+                                  1024 (nth 0 propdata)))
+        (when (and propdata (setq tdata (nth 2 propdata)))
+          (if (= (car propdata)
+                 (X-Atom-id (XInternAtom xdpy "COMPOUND_TEXT")))
+              (setq retstring
+                    (concat retstring (XDecodeCompoundText tdata)))
+            (setq retstring (concat retstring tdata))))))
     retstring))
 
 (defun XGetWMName (xdpy win)




<Prev in Thread] Current Thread [Next in Thread>
  • Summary for xlib--main--2.1--patch-12, Zajcev Evgeny <=