utf8WMProps.c revision 1ab64890
1/* $TOG: mbWMProps.c /main/6 1998/02/06 17:44:24 kaleb $ */
2/*
3
4Copyright 1991, 1998  The Open Group
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included
13in all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
19OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall
24not be used in advertising or otherwise to promote the sale, use or
25other dealings in this Software without prior written authorization
26from The Open Group.
27
28*/
29/*
30 * Copyright 2000 by Bruno Haible
31 *
32 * Permission to use, copy, modify, distribute, and sell this software
33 * and its documentation for any purpose is hereby granted without fee,
34 * provided that the above copyright notice appear in all copies and
35 * that both that copyright notice and this permission notice appear
36 * in supporting documentation, and that the name of Bruno Haible not
37 * be used in advertising or publicity pertaining to distribution of the
38 * software without specific, written prior permission.  Bruno Haible
39 * makes no representations about the suitability of this software for
40 * any purpose.  It is provided "as is" without express or implied
41 * warranty.
42 *
43 * Bruno Haible DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
44 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
45 * NO EVENT SHALL Bruno Haible BE LIABLE FOR ANY SPECIAL, INDIRECT OR
46 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
47 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
48 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
49 * OR PERFORMANCE OF THIS SOFTWARE.
50 */
51/* $XFree86: xc/lib/X11/utf8WMProps.c,v 1.2 2001/12/14 19:54:11 dawes Exp $ */
52
53#ifdef HAVE_CONFIG_H
54#include <config.h>
55#endif
56#include <X11/Xlibint.h>
57#include <X11/Xutil.h>
58#include <X11/Xatom.h>
59#include <X11/Xlocale.h>
60
61void
62Xutf8SetWMProperties (
63    Display *dpy,
64    Window w,
65    _Xconst char *windowName,
66    _Xconst char *iconName,
67    char **argv,
68    int argc,
69    XSizeHints *sizeHints,
70    XWMHints *wmHints,
71    XClassHint *classHints)
72{
73    XTextProperty wname, iname;
74    XTextProperty *wprop = NULL;
75    XTextProperty *iprop = NULL;
76
77    if (windowName &&
78	Xutf8TextListToTextProperty(dpy, (char**)&windowName, 1,
79				    XStdICCTextStyle, &wname) >= Success)
80	wprop = &wname;
81    if (iconName &&
82	Xutf8TextListToTextProperty(dpy, (char**)&iconName, 1,
83				    XStdICCTextStyle, &iname) >= Success)
84	iprop = &iname;
85    XSetWMProperties(dpy, w, wprop, iprop, argv, argc,
86		     sizeHints, wmHints, classHints);
87    if (wprop)
88	Xfree((char *)wname.value);
89    if (iprop)
90	Xfree((char *)iname.value);
91
92    /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */
93}
94