- if ((_elements & Indicator) && _fixed_diameter) {
- if (_pixbuf) {
- req->width = _pixbuf->get_width() + lrint (_diameter) + xpad;
- req->height = max (_pixbuf->get_height(), (int) lrint (_diameter)) + ypad;
- } else {
- req->width = _text_width + lrint (_diameter) + xpad * 2; // margin left+right * 2
- req->height = max (_text_height, (int) lrint (_diameter)) + ypad;
- }
- } else {
- if (_pixbuf) {
- req->width = _pixbuf->get_width() + xpad;
- req->height = _pixbuf->get_height() + ypad;
- } else {
- req->width = _text_width + xpad;
- req->height = _text_height + ypad;
- }
+ if (_elements & Indicator) {
+ req->width += lrint (_diameter) + char_pixel_width();
+ req->height = std::max (req->height, (int) lrint (_diameter) + 4);
+ }
+
+ if ((_elements & Menu)) {
+ req->width += _diameter + 4;
+ }
+
+ if (_elements & VectorIcon) {
+ assert(!(_elements & Text));
+ const int wh = std::max (6., std::max (rint (TRACKHEADERBTNW * char_avg_pixel_width()), ceil (char_pixel_height() * BASELINESTRETCH + 1.)));
+ req->width += wh;
+ req->height = std::max(req->height, wh);
+ }
+
+ /* Tweaks to mess the nice stuff above up again. */
+ if (_tweaks & TrackHeader) {
+ // forget everything above and just use a fixed square [em] size
+ // "TrackHeader Buttons" are single letter (usually uppercase)
+ // a SizeGroup is much less efficient (lots of gtk work under the hood for each track)
+ const int wh = std::max (rint (TRACKHEADERBTNW * char_avg_pixel_width()), ceil (char_pixel_height() * BASELINESTRETCH + 1.));
+ req->width = wh;
+ req->height = wh;
+ }
+ else if (_tweaks & Square) {
+ // currerntly unused (again)
+ if (req->width < req->height)
+ req->width = req->height;
+ if (req->height < req->width)
+ req->height = req->width;
+ } else if (_text_width > 0 && !(_elements & (Menu | Indicator))) {
+ // properly centered text for those elements that are centered
+ // (no sub-pixel offset)
+ if ((req->width - _text_width) & 1) { ++req->width; }
+ if ((req->height - _text_height) & 1) { ++req->height; }