/*
* ion/ioncore/property.c
*
- * Copyright (c) Tuomo Valkonen 1999-2007.
+ * Copyright (c) Tuomo Valkonen 1999-2009.
*
* See the included file LICENSE for details.
*/
XTextProperty prop;
char **list=NULL;
int n=0;
- Status st=0;
+ Status st;
+ bool ok;
st=XGetTextProperty(ioncore_g.dpy, win, &prop, a);
#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)
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);