Luis Rodrigo Gallardo Cruz <[EMAIL PROTECTED]> writes: > On Wed, Oct 31, 2007 at 08:01:26PM +0200, Timo Korvola wrote: >> Are there characters in UTF-8 that cannot be represented as >> COMPOUND_TEXT? > > There most likely are.
It is just that xterm -T 'foo' seems to work for any weird value of foo I can throw at it. I am unable to find any UTF-8 characters that would trip it. Now xterm is old and does not know anything about the _NET_WM properties, so it just sets WM_NAME as COMPOUND_TEXT. But perhaps the character sets supported by COMPOUND_TEXT vary among X implementations. > Which is another part of what I wanted to bring up. How many people > are still using systems without Xutf8Text*? Is it supported anywhere except XFree86 and X.org? >> http://www.iki.fi/tkorvola/sawfish.git. > > Are you mirroring svn there? I'll probably clone that for my own use if so. My private repository has a full git-svn clone. Whatever of it is referenced by stuff that I push to the public repository ends up there. In practice that is the trunk. It is not automatically mirrored though. The patch I posted was rather botched in the non-X_HAVE_UTF8_STRING case. Hopefully this fixes it. These changes are also available in my Git repository. -- Timo Korvola <URL:http://www.iki.fi/tkorvola> diff --git a/src/events.c b/src/events.c index 14bb15e..f76f2c0 100644 --- a/src/events.c +++ b/src/events.c @@ -507,22 +507,9 @@ update_window_name(Lisp_Window * w, XPropertyEvent xproperty) { tprop.format = format; tprop.nitems = strlen (prop); - if (actual == xa_compound_text || actual == XA_STRING) - { - convert_status = XmbTextPropertyToTextList (dpy, &tprop, &text_list, - &count); - if (convert_status >= Success && count > 0) - { - char * utf8str = g_locale_to_utf8(text_list[0], -1, - NULL, NULL, NULL); - if (utf8str) - str = rep_string_dup (utf8str); - } - XFreeStringList(text_list); - } - #ifdef X_HAVE_UTF8_STRING - if (actual == xa_utf8_string) + if (actual == xa_compound_text || actual == XA_STRING + || actual == xa_utf8_string) { convert_status = Xutf8TextPropertyToTextList (dpy, &tprop, &text_list, &count); @@ -530,6 +517,26 @@ update_window_name(Lisp_Window * w, XPropertyEvent xproperty) { str = rep_string_dup (text_list[0]); XFreeStringList(text_list); } +#else + if (actual == xa_compound_text || actual == XA_STRING) + { + convert_status = XmbTextPropertyToTextList (dpy, &tprop, &text_list, + &count); + if (convert_status >= Success) + { + if (count > 0) + { + char * utf8str = g_locale_to_utf8(text_list[0], -1, + NULL, NULL, NULL); + if (utf8str) + { + str = rep_string_dup (utf8str); + g_free (utf8str); + } + } + XFreeStringList(text_list); + } + } #endif XFree (prop); diff --git a/src/windows.c b/src/windows.c index d35ab6f..820b59c 100644 --- a/src/windows.c +++ b/src/windows.c @@ -357,7 +357,6 @@ remove_window_frame (Lisp_Window *w) } -#ifdef X_HAVE_UTF8_STRING static repv text_prop_to_utf8 (XTextProperty *prop) { @@ -367,42 +366,30 @@ text_prop_to_utf8 (XTextProperty *prop) char **list; int count; prop->nitems = strlen(prop->value); +#ifdef X_HAVE_UTF8_STRING if (Xutf8TextPropertyToTextList (dpy, prop, &list, &count) >= Success) { if (count > 0) rval = rep_string_dup (list[0]); XFreeStringList (list); } - } - return rval; -} #else -static repv -text_prop_to_utf8 (XTextProperty *prop) -{ - if (prop->value && prop->nitems > 0) - { - repv rval = Qnil; - char **list; - int count; - prop.nitems = strlen(prop.value); - if (XmbTextPropertyToTextList (dpy, &prop, &list, &count) - >= Success) + if (XmbTextPropertyToTextList (dpy, prop, &list, &count) >= Success) { if (count > 0) { gchar *ustr = g_locale_to_utf8(list[0], -1, NULL, NULL, NULL); if (ustr) { - rval = rep_string_dup(ustr); + rval = rep_string_dup (ustr); g_free (ustr); } } XFreeStringList (list); } +#endif } return rval; } -#endif /* Queries X properties to get the window {icon,}name */ @@ -422,11 +409,17 @@ get_window_name(Lisp_Window *w) #endif if (w->net_name == Qnil && XGetWMName (dpy, w->id, &prop)) - w->net_name = text_prop_to_utf8 (&prop); + { + repv name = text_prop_to_utf8 (&prop); + if (name != Qnil) + w->name = name; + } w->full_name = w->name; if (w->net_icon_name == Qnil && XGetWMIconName (dpy, w->id, &prop)) w->icon_name = text_prop_to_utf8 (&prop); + if (w->icon_name == Qnil) + w->icon_name = w->name; }
