Chapter 13. Examples of I18N
103
and
XA_COMPOUND_TEXT
means the data is in compound text. Compound text is a subset of ISO
2022 and can handle international text data.
Now,
XFetchName()
can handle
XA_STRING
type only. Thus we should use
XGetWMName()
.
Since handling of compound text needs several lines of source codes, I wrote a wrapper function.
/*
* The following functions are internationalized substitutions
* for XFetchName and XGetIconName using XGetWMName and
* XGetWMIconName.
*
* Please note that the third arguments have to be freed using free(),
* not XFree().
*/
Status
I18N_FetchName(dpy, w, winname)
Display *dpy;
Window w;
char ** winname;
{
int
status;
XTextProperty text_prop;
char **list;
int
num;
status = XGetWMName(dpy, w, &text_prop);
if (!status || !text_prop.value || !text_prop.nitems) return 0;
status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num);
if (status < Success || !num || !*list) return 0;
XFree(text_prop.value);
*winname = (char *)strdup(*list);
XFreeStringList(list);
return 1;
}
13.1.9 Getting Icon Names
Window managers need to get not only window titles but also icon names.
TWM used
XGetWindowProperty()
with
XA_STRING
to get icon names. However, interna
tionalized function
XGetWMIconName()
is available for this purpose and I rewrote using this
function. Just like
XGetWMName()
, I wrote a wrapper.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved