626
626
XRectangle inc_rect;
627
627
XRectangle logical_rect;
628
628
MyFont font = occwin->font;
629
int min_bwidth, min_width;
630
int bb_width, ws_width;;
631
632
/* Buttons gotta be as wide as the biggest of the three strings */
632
633
XmbTextExtents(font.font_set, ok_string, strlen(ok_string),
633
634
&inc_rect, &logical_rect);
634
min_bwidth = logical_rect.width;
635
bbwidth = logical_rect.width;
636
637
XmbTextExtents(font.font_set, cancel_string, strlen(cancel_string),
637
638
&inc_rect, &logical_rect);
638
min_bwidth = MAX(min_bwidth, logical_rect.width);
639
bbwidth = MAX(bbwidth, logical_rect.width);
640
641
XmbTextExtents(font.font_set, everywhere_string,
641
642
strlen(everywhere_string),
642
643
&inc_rect, &logical_rect);
643
min_bwidth = MAX(min_bwidth, logical_rect.width);
644
bbwidth = MAX(bbwidth, logical_rect.width);
645
646
/* Plus the padding width */
646
min_bwidth += hspace;
649
650
* So, the final width of those bottom buttons is that, plus the
653
654
* for it on the workspace manager (which is the config used for
654
655
* the occupy window), so leave it as a magic constant for now.
656
occwin->owidth = min_bwidth + 2 * Scr->WMgrButtonShadowDepth + 2;
657
occwin->owidth = bbwidth + 2 * Scr->WMgrButtonShadowDepth + 2;
659
660
* The whole thing has to be at least triple the min width of
661
662
* layout is "hspace button hspace button [...] hspace", to pad
662
663
* between and on both sides.
664
min_width = 3 * (min_bwidth + hspace) + hspace;
665
bb_width = 3 * (bbwidth + hspace) + hspace;
667
* Per-ws buttons are sized the same as in the button-state WSM,
668
* and then we add the padding to them as above.
668
* It also has to be the width of our per-WS buttons. Per-ws
669
* buttons are sized the same as in the button-state WSM, and
670
* then we add the padding to them as above.
670
width = columns * (bwidth + hspace) + hspace;
672
ws_width = columns * (bwidth + hspace) + hspace;
672
/* But shift up as necessary */
673
width = MAX(width, min_width);
674
/* So the window has to be as wide as the wider of those */
675
width = MAX(bb_width, ws_width);