X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fproperty.c;h=a8029d2e256f2cab4a0d02ea059d806c7c0755f9;hb=20080103;hp=57214d2a53b83d1af4c155c443f100e71bf9d60e;hpb=ae4260bb64817c11f9a7140324cd3e3ba113e297;p=ion3.git diff --git a/ioncore/property.c b/ioncore/property.c index 57214d2..a8029d2 100644 --- a/ioncore/property.c +++ b/ioncore/property.c @@ -1,7 +1,7 @@ /* * ion/ioncore/property.c * - * Copyright (c) Tuomo Valkonen 1999-2007. + * Copyright (c) Tuomo Valkonen 1999-2008. * * See the included file LICENSE for details. */ @@ -169,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); @@ -189,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) @@ -210,17 +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{ - st=XmbTextListToTextProperty(ioncore_g.dpy, (char **)ptr, n, - XTextStyle, &prop); - 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);