int height = s->sidebar.elmHeight;
+ Dimension new_width = parent->core.width;
int list_height = numTracks * height;
if((list_height > s->core.height) || (w < parent->core.width)) {
XtMakeResizeRequest(widget, parent->core.width, list_height + 5, &w, &h);
+ new_width = w;
}
XftDrawRect(s->sidebar.d, &s->sidebar.select2_bg, 0, i.index*height, s->core.width, height);
}
- FontDrawString8(s->sidebar.d, cg, s->sidebar.font, 10, i.index*height + xftFont->ascent, (const FcChar8*)name, strlen(name));
+ size_t namelen = strlen(name);
+ XGlyphInfo ext;
+ FontTextExtents8(XtDisplay(widget), s->sidebar.font, (const FcChar8*)name, namelen, &ext);
+
+ FontDrawString8(s->sidebar.d, cg, s->sidebar.font, 10, i.index*height + xftFont->ascent, (const FcChar8*)name, namelen);
+
+ if(ext.xOff + 20 > new_width) {
+ new_width = ext.xOff + 20;
+ }
+ }
+
+ if(new_width != w) {
+ printf("adjust sidebar size: %d\n", (int)new_width);
+ XtMakeResizeRequest(widget, new_width, list_height + 5, &w, &h);
}
}