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