[PATCH] Permit WM_NAME and WM_ICON_NAME to be COMPOUND_TEXT

James Cloos cloos at jhcloos.com
Sun Jul 18 08:05:20 CEST 2010


My window manager lacks support for _NET_WM_NAME and _NET_WM_ICON_NAME,
as do several others.  As such, rxvt-unicode titles which include non-
atin-1 characters are incorrectly rendered.

This patch allows rxvt-unicode to set the WM_NAME and WM_ICON_NAME
properties as COMPOUND_TEXT whenever the strings cannot be encoded
in ISO-8859-1 (the encoding which Xlib presumes all STRINGs are).

It uses XwcTextListToTextProperty(3) with XStdICCTextStyle, which
tells Xlib to use COMPOUND_TEXT unless STRING would work.  This is
the same logic used by most apps, some via Xlib and some self coded.

I gave rxvt_term::set_compound_text_property() the same prototype
as rxvt_term::set_string_property() and rxvt_term::set_utf8_property();
doing so requires casting the address of the (const char *)str to
a (char **), which changing the prototype to make str non-const
would obviously avoid.  I can change that if that is preferred.

I've tested with a number of LANG settings, both for urxvt and for
the interior shell.  Only one combination causes problems, but it
is no worse than the status quo.  If the shell is set to have urxvt
use the $CWD in WM_NAME, and you visit a directory which was created
using a different encoding than the shell's the shell can send bogus
data to urxvt.  As long as urxvt gets valid data, though, it it is
properly passed on to the window manager, even if the wm's LANG differs
from urxvt's.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: urxvt-ctext-title.patch
Type: text/x-patch
Size: 2365 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/rxvt-unicode/attachments/20100718/3031c043/attachment.bin>
-------------- next part --------------

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


More information about the rxvt-unicode mailing list