rem: for (i = 0; NULL != cursor_table[i].name; i++) { if (0 == strcasecmp(val, cursor_table[i].name)) { cursor_id = cursor_table[i].id; break; } } if (CURSOR_ID_NONE == cursor_id) { wwarning(_("unknown builtin cursor name \"%s\""), val); } else { *cursor = XCreateFontCursor(dpy, cursor_id); status = 1; }
add: if (2 != nelem) { wwarning(_("bad number of arguments in cursor specification")); return(status); } elem = WMGetFromPLArray(pl, 1); if (!elem || !WMIsPLString(elem)) { return(status); } val = WMGetFromPLString(elem);  for (i = 0; NULL != cursor_table[i].name; i++) { if (0 == strcasecmp(val, cursor_table[i].name)) { cursor_id = cursor_table[i].id; break; } } if (CURSOR_ID_NONE == cursor_id) { wwarning(_("unknown builtin cursor name \"%s\""), val); } else { *cursor = XCreateFontCursor(dpy, cursor_id); status = 1; }
context: parse_cursor(WScreen *scr, WMPropList *pl, Cursor *cursor){    WMPropList *elem;    char *val;    int nelem;    int status = 0;        nelem = WMGetPropListItemCount(pl);    if (nelem < 1) {	return(status);    }    elem = WMGetFromPLArray(pl, 0);    if (!elem || !WMIsPLString(elem)) {	return(status);    }    val = WMGetFromPLString(elem);        if (0 == strcasecmp(val, "none")) {	status = 1;	*cursor = None;    } else if (0 == strcasecmp(val, "builtin")) {	int i;	int cursor_id = CURSOR_ID_NONE;		if (2 != nelem) {	    wwarning(_("bad number of arguments in cursor specification"));	    return(status);	}	elem = WMGetFromPLArray(pl, 1);	if (!elem || !WMIsPLString(elem)) {	    return(status);	}	val = WMGetFromPLString(elem);	for (i = 0; NULL != cursor_table[i].name; i++) {	    if (0 == strcasecmp(val, cursor_table[i].name)) {		cursor_id = cursor_table[i].id;		break;	    }	}	if (CURSOR_ID_NONE == cursor_id) {	    wwarning(_("unknown builtin cursor name \"%s\""), val);	} else {	    *cursor = XCreateFontCursor(dpy, cursor_id);	    status = 1;	}    } else if (0 == strcasecmp(val, "bitmap")) {	char *bitmap_name;	char *mask_name;	int bitmap_status;	int mask_status;	Pixmap bitmap;	Pixmap mask;	unsigned int w, h;	int x, y;	XColor fg, bg;		if (3 != nelem) {	    wwarning(_("bad number of arguments in cursor specification"));	    return(status);	}	elem = WMGetFromPLArray(pl, 1);	if (!elem || !WMIsPLString(elem)) {	    return(status);	}	val = WMGetFromPLString(elem);	bitmap_name = FindImage(wPreferences.pixmap_path, val);	if (!bitmap_name) {	    wwarning(_("could not find cursor bitmap file \"%s\""), val);	    return(status);	}	elem = WMGetFromPLArray(pl, 2);	if (!elem || !WMIsPLString(elem)) {	    wfree(bitmap_name);	    return(status);	}	val = WMGetFromPLString(elem);	mask_name = FindImage(wPreferences.pixmap_path, val);	if (!mask_name) {	    wfree(bitmap_name);	    wwarning(_("could not find cursor bitmap file \"%s\""), val);	    return(status);	}	mask_status = XReadBitmapFile(dpy, scr->w_win, mask_name, &w, &h,				      &mask, &x, &y);	bitmap_status = XReadBitmapFile(dpy, scr->w_win, bitmap_name, &w, &h,					&bitmap, &x, &y);	if ((BitmapSuccess == bitmap_status) &&	    (BitmapSuccess == mask_status)) {	    fg.pixel = scr->black_pixel;	    bg.pixel = scr->white_pixel;	    XQueryColor(dpy, scr->w_colormap, &fg);	    XQueryColor(dpy, scr->w_colormap, &bg);	    *cursor = XCreatePixmapCursor(dpy, bitmap, mask, &fg, &bg, x, y);	    status = 1;	}	check_bitmap_status(bitmap_status, bitmap_name, bitmap);	check_bitmap_status(mask_status, mask_name, mask);	wfree(bitmap_name);	wfree(mask_name);    }    return(status);}