Package: jwm
Version: 2.0.1-1
Severity: normal
Tags: patch

Japanese characters cannot be displayed at title with some application,
e.g. openoffice.org.
The problem is that COMPOUND_TEXT handling is not good.

Following patch fixes it.

Thanks,
Hiroyuki YAMAMORI

diff -u jwm-2.0.1/src/hint.c new/src/hint.c
--- jwm-2.0.1/src/hint.c        2007-09-16 19:11:09.000000000 +0900
+++ new/src/hint.c      2008-01-03 02:16:03.000000000 +0900
@@ -7,6 +7,7 @@
  *
  */
 
+#include <X11/Xlibint.h>
 #include "jwm.h"
 #include "hint.h"
 #include "client.h"
@@ -581,6 +582,9 @@
    Atom realType;
    int realFormat;
    unsigned char *name;
+   XTextProperty tprop;
+   char **text_list;
+   int tcount;
 
    Assert(np);
 
@@ -597,20 +601,29 @@
       np->name = (char*)name;
    }
 
-   if(!np->name) {
-      if(JXFetchName(display, np->window, &np->name) == 0) {
-         np->name = NULL;
+   if (!np->name) {
+      status = JXGetWindowProperty(display, np->window,
+            XA_WM_NAME, 0, 1024, False, atoms[ATOM_COMPOUND_TEXT],
+            &realType, &realFormat, &count, &extra, &name);
+      if (status == Success && realFormat == 8) {
+         tprop.value = name;
+         tprop.encoding = atoms[ATOM_COMPOUND_TEXT];
+         tprop.format = realFormat;
+         tprop.nitems = strlen((char *)name);
+         if (Xutf8TextPropertyToTextList(display, &tprop, &text_list, &tcount)
+               == Success && tcount > 0) {
+            np->name = Xmalloc(strlen(text_list[0]) + 1);
+            if (np->name)
+               strcpy(np->name, text_list[0]);
+            XFreeStringList(text_list);
+         }
+         JXFree(name);
       }
    }
 
    if(!np->name) {
-      status = JXGetWindowProperty(display, np->window, XA_WM_NAME,
-         0, 1024, False, atoms[ATOM_COMPOUND_TEXT], &realType,
-         &realFormat, &count, &extra, &name);
-      if(status != Success) {
+      if(JXFetchName(display, np->window, &np->name) == 0) {
          np->name = NULL;
-      } else {
-         np->name = (char*)name;
       }
    }
 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to