rem: WMSelectListItem(panel->sizeL, index); WMSetListPosition(panel->sizeL, index);
context: selectedOption(WMWidget *w, void *data){    _Panel *panel= (_Panel*)data;    int index = WMGetPopUpButtonSelectedItem(panel->optionP);    WMMenuItem *item= WMGetPopUpButtonMenuItem(panel->optionP, index);    char *font;    font= (char*)WMGetMenuItemRepresentedObject(item);    if (font)    {        FcPattern *pat;        pat= FcNameParse(font);        if (pat)        {            FcChar8 *name;            int weight, slant, width;            double size;            int i;            int found;            FcDefaultSubstitute(pat);            if (FcPatternGetString(pat, FC_FAMILY, 0, &name) != FcResultMatch)                name= "sans serif";            found= 0;            // select family            for (i= 0; i < WMGetListNumberOfRows(panel->familyL); i++)            {                WMListItem *item= WMGetListItem(panel->familyL, i);                FontFamily *family= (FontFamily*)item->clientData;                                if (strcasecmp(family->name, name)==0)                {                    found= 1;                    WMSelectListItem(panel->familyL, i);                    WMSetListPosition(panel->familyL, i);                    break;                }            }            if (!found)                WMSelectListItem(panel->familyL, -1);            selectedFamily(panel->familyL, panel);                        // select style            if (FcPatternGetInteger(pat, FC_WEIGHT, 0, &weight) != FcResultMatch)                weight= FC_WEIGHT_NORMAL;            if (FcPatternGetInteger(pat, FC_WIDTH, 0, &width) != FcResultMatch)                width= FC_WIDTH_NORMAL;            if (FcPatternGetInteger(pat, FC_SLANT, 0, &slant) != FcResultMatch)                slant= FC_SLANT_ROMAN;            if (FcPatternGetDouble(pat, FC_PIXEL_SIZE, 0, &size) != FcResultMatch)                size= 10.0;            found= 0;            for (i= 0; i < WMGetListNumberOfRows(panel->styleL); i++)            {                WMListItem *item= WMGetListItem(panel->styleL, i);                FontStyle *style= (FontStyle*)item->clientData;                if (style->weight == weight                    && style->width == width                    && style->slant == slant)                {                    found= 1;                    WMSelectListItem(panel->styleL, i);                    WMSetListPosition(panel->styleL, i);                    break;                }            }            if (!found)                WMSelectListItem(panel->styleL, -1);            found= 0;            {                int closest= 100000, index= -1;                                for (i= 0; i < WMGetListNumberOfRows(panel->sizeL); i++)                {                    WMListItem *item= WMGetListItem(panel->sizeL, i);                    int tmp;                    tmp= atoi(item->text);                    if (abs(tmp-size) < abs(tmp-closest))                    {                        closest= tmp;                        index= i;                    }                }                WMSelectListItem(panel->sizeL, index);                WMSetListPosition(panel->sizeL, index);            }                        selected(NULL, panel);        }        else            wwarning("Can't parse font '%s'", font);    }    updateSampleFont(panel);}