X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fproperty.c;h=a8029d2e256f2cab4a0d02ea059d806c7c0755f9;hb=562cb4d37ba7667ac846fc3d426b152d21ef2c22;hp=798dbf5e32cc0ef2746eaa72083dd9ea531636df;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d;p=ion3.git diff --git a/ioncore/property.c b/ioncore/property.c index 798dbf5..a8029d2 100644 --- a/ioncore/property.c +++ b/ioncore/property.c @@ -1,12 +1,9 @@ /* * ion/ioncore/property.c * - * Copyright (c) Tuomo Valkonen 1999-2007. + * Copyright (c) Tuomo Valkonen 1999-2008. * - * Ion is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -172,7 +169,8 @@ char **xwindow_get_text_property(Window win, Atom a, int *nret) XTextProperty prop; char **list=NULL; int n=0; - Status st=0; + Status st; + bool ok; st=XGetTextProperty(ioncore_g.dpy, win, &prop, a); @@ -192,15 +190,16 @@ char **xwindow_get_text_property(Window win, Atom a, int *nret) #endif if(!ioncore_g.use_mb){ - st=XTextPropertyToStringList(&prop, &list, &n); + Status st=XTextPropertyToStringList(&prop, &list, &n); + ok=(st!=0); }else{ - st=XmbTextPropertyToTextList(ioncore_g.dpy, &prop, &list, &n); - st=!st; + int st=XmbTextPropertyToTextList(ioncore_g.dpy, &prop, &list, &n); + ok=(st>=0); } XFree(prop.value); - if(!st || n==0 || list==NULL) + if(!ok || n==0 || list==NULL) return NULL; if(nret) @@ -213,22 +212,18 @@ char **xwindow_get_text_property(Window win, Atom a, int *nret) void xwindow_set_text_property(Window win, Atom a, const char **ptr, int n) { XTextProperty prop; - Status st; - + bool ok; + if(!ioncore_g.use_mb){ - st=XStringListToTextProperty((char **)&ptr, n, &prop); + Status st=XStringListToTextProperty((char **)ptr, n, &prop); + ok=(st!=0); }else{ -#ifdef X_HAVE_UTF8_STRING - st=XmbTextListToTextProperty(ioncore_g.dpy, (char **)ptr, n, - XUTF8StringStyle, &prop); -#else - st=XmbTextListToTextProperty(ioncore_g.dpy, (char **)ptr, n, - XTextStyle, &prop); -#endif - st=!st; + int st=XmbTextListToTextProperty(ioncore_g.dpy, (char **)ptr, n, + XTextStyle, &prop); + ok=(st>=0); } - if(!st) + if(!ok) return; XSetTextProperty(ioncore_g.dpy, win, &prop, a); @@ -340,7 +335,7 @@ static bool get_mode(const char *mode, int *m) /*EXTL_DOC * Modify a window property. The \var{mode} is one of - * \code{"replace"}, \code{"prepend"} or \code{"append"}, and format + * \codestr{replace}, \codestr{prepend} or \codestr{append}, and format * is either 8, 16 or 32. Also see \fnref{ioncore.x_get_window_property} * and the \code{XChangeProperty}(3) manual page. */ @@ -382,8 +377,7 @@ void ioncore_x_delete_property(int win, int atom) /*EXTL_DOC - * Get a text property for a window (\code{STRING}, \code{COMPOUND_TEXT}, - * or \code{UTF8_STRING} property converted). The fields in the returned + * Get a text property for a window. The fields in the returned * table (starting from 1) are the null-separated parts of the property. * See the \code{XGetTextProperty}(3) manual page for more information. */