~ctwm/ctwm/trunk

« back to all changes in this revision

Viewing changes to occupation.c

  • Committer: Matthew Fuller
  • Date: 2016-08-13 10:34:21 UTC
  • mto: This revision was merged to the branch mainline in revision 513.
  • Revision ID: fullermd@over-yonder.net-20160813103421-2c6jhc7dcr1jp8y2
Use separate local vars for the min size based on the bottom buttons
vs. the ws buttons to make the calcs and MAX() clearer.  Tweak
comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
626
626
                XRectangle inc_rect;
627
627
                XRectangle logical_rect;
628
628
                MyFont font = occwin->font;
629
 
                int min_bwidth, min_width;
 
629
                int bbwidth;
 
630
                int bb_width, ws_width;;
630
631
 
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;
635
636
 
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);
639
640
 
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);
644
645
 
645
646
                /* Plus the padding width */
646
 
                min_bwidth += hspace;
 
647
                bbwidth += hspace;
647
648
 
648
649
                /*
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.
655
656
                 */
656
 
                occwin->owidth = min_bwidth + 2 * Scr->WMgrButtonShadowDepth + 2;
 
657
                occwin->owidth = bbwidth + 2 * Scr->WMgrButtonShadowDepth + 2;
657
658
 
658
659
                /*
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.
663
664
                 */
664
 
                min_width = 3 * (min_bwidth + hspace) + hspace;
 
665
                bb_width = 3 * (bbwidth + hspace) + hspace;
665
666
 
666
667
                /*
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.
669
671
                 */
670
 
                width = columns * (bwidth + hspace) + hspace;
 
672
                ws_width = columns * (bwidth + hspace) + hspace;
671
673
 
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);
674
676
        }
675
677
 
676
678