PATCH: WM_NAME and WM_ICON_NAME with COMPOUND_TEXT values

Tamito KAJIYAMA kajiyama at grad.sccs.chukyo-u.ac.jp
Fri Jun 6 18:00:16 CDT 2003


Hi,

Attached is a patch to fix a problem that two text properties
WM_NAME and WM_ICON_NAME are specified with STRING instead of
COMPOUND_TEXT, even though their values include multi-byte
characters.  It's a very annoying problem, because when I use
Windows applications whose WM_NAME and WM_ICON_NAME contain
Japanese characters, Japanese-aware window managers will show
broken names on title bars and icons.  I'm quite new to X
programming and the Wine source tree, so I'm not sure that this
is a right approach to fix the problem (the approach does not
seem specific to Japanese, though).

Thanks,

-- 
KAJIYAMA, Tamito <kajiyama at grad.sccs.chukyo-u.ac.jp>


diff -ru wine-20030508.orig/dlls/x11drv/window.c wine-20030508/dlls/x11drv/window.c
--- wine-20030508.orig/dlls/x11drv/window.c	Sun May  4 11:27:20 2003
+++ wine-20030508/dlls/x11drv/window.c	Fri Jun  6 21:52:55 2003
@@ -770,6 +770,7 @@
     char *utf8_buffer;
     static UINT text_cp = (UINT)-1;
     Window win;
+    XTextProperty prop;
 
     if ((win = X11DRV_get_whole_window( hwnd )))
     {
@@ -806,9 +807,15 @@
         }
         WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), utf8_buffer, count, NULL, NULL);
 
+        if (XmbTextListToTextProperty(display, &buffer, 1, XCompoundTextStyle, &prop) != Success)
+        {
+            ERR("XmbTextListToTextProperty() failed\n");
+            return FALSE;
+        }
+
         wine_tsx11_lock();
-        XStoreName( display, win, buffer );
-        XSetIconName( display, win, buffer );
+        XSetWMName(display, win, &prop);
+        XSetWMIconName(display, win, &prop);
         /*
         Implements a NET_WM UTF-8 title. It should be without a trailing \0,
         according to the standard
@@ -821,6 +828,7 @@
             count);
         wine_tsx11_unlock();
 
+        XFree(prop.value);
         HeapFree( GetProcessHeap(), 0, utf8_buffer );
         HeapFree( GetProcessHeap(), 0, buffer );
     }



More information about the wine-patches mailing list