static void frame_shaped_recalc_bar_size(WFrame *frame, bool complete) { int bar_w=0, textw=0, tmaxw=frame->tab_min_w, tmp=0; WLListIterTmp itmp; WRegion *sub; const char *p; GrBorderWidths bdw; char *title; uint bdtotal; int i, m; if(frame->bar_brush==NULL) return; m=FRAME_MCOUNT(frame); if(m>0){ grbrush_get_border_widths(frame->bar_brush, &bdw); bdtotal=((m-1)*(bdw.tb_ileft+bdw.tb_iright+bdw.spacing) +bdw.right+bdw.left); FRAME_MX_FOR_ALL(sub, frame, itmp){ p=region_displayname(sub); if(p==NULL) continue; textw=grbrush_get_text_width(frame->bar_brush, p, strlen(p)); if(textw>tmaxw) tmaxw=textw; }
/* * Temporarily store actual title widths (without truncation) in * frame->titles[*].iw, when calculating tabs widths and bar width. After the * algorithm returns it has to set frame->titles[*].iw to the proper values. * * This function is generic for all algorithms. */ static void get_titles_text_width(WFrame *frame) { int i=0; WLListIterTmp itmp; WRegion *sub; const char *displayname; /* Assume frame->bar_brush != NULL. Assume FRAME_MCOUNT(frame) > 0 */ FRAME_MX_FOR_ALL(sub, frame, itmp){ displayname=region_displayname(sub); if(displayname==NULL) frame->titles[i].iw=0; else frame->titles[i].iw=grbrush_get_text_width(frame->bar_brush, displayname, strlen(displayname)); i++; }
static void frame_shaped_recalc_bar_size(WFrame *frame, bool complete) { int bar_w=0, textw, w, tmaxw, tminw, tmp=0; WLListIterTmp itmp; WRegion *sub; const char *p; GrBorderWidths bdw; char *title; uint bdtotal; int i, m; if(frame->bar_brush==NULL) return; m=FRAME_MCOUNT(frame); bar_w=frame->bar_max_width_q*REGION_GEOM(frame).w; if(m>0){ frame_get_max_width_and_elastic(frame, bar_w, &tmaxw, &tmp, &tminw); //fprintf(stderr," * WID total:%i maxw:%i minw:%i elastic:%i m:%i\n",bar_w,tmaxw,tminw,tmp,m); if ((tmaxw < 0) && (tminw == frame->float_tab_min_w)) { /* No label truncation needed, good. See how much can be padded. */ w=bar_w-tmp; FRAME_MX_FOR_ALL(sub, frame, itmp){ p=region_displayname(sub); if(p==NULL) continue; textw=2*CF_TAB_MAX_TEXT_X_OFF+ grbrush_get_text_width(frame->bar_brush, p, strlen(p))- frame->float_tab_min_w; //fprintf(stderr," * WID addtextw:%i\n",textw); if (textw>=2*CF_TAB_MAX_TEXT_X_OFF) w+=2*CF_TAB_MAX_TEXT_X_OFF; else if (textw >=0) w+=textw; }