+ /* get the text height */
+ texth = RrMinHeight(p->a_hilite_text);
+ if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
+ texth = MAX(MAX(texth, RrMinHeight(p->a_text)), ICON_SIZE);
+ else
+ texth += TEXT_BORDER * 2;
+
+ if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS) {
+ /* how many icons will fit in that row? make the width fit that */
+ w -= l + r;
+ icons_per_row = (w + HILITE_SIZE - 1) / HILITE_SIZE;
+ w = icons_per_row * HILITE_SIZE + l + r;
+
+ /* how many rows do we need? */
+ icon_rows = (p->n_targets-1) / icons_per_row + 1;
+
+ }
+ else {
+ /* in list mode, there is one column of icons.. */
+ icons_per_row = 1;
+ /* maximum is 80% of the screen height */
+ icon_rows = MIN(p->n_targets,
+ (4*screen_area->height/5) /* 80% of the screen */
+ /
+ MAX(HILITE_SIZE, texth)); /* height of each row */
+ /* but make sure there is always one */
+ icon_rows = MAX(icon_rows, 1);
+ }
+
+ /* get the text width */
+ textw = w - l - r;
+ if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
+ /* leave space on the side for the icons */
+ textw -= list_mode_icon_column_w;
+