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; }
void frame_recalc_bar(WFrame *frame, bool complete) { int textw, i; WLListIterTmp tmp; WRegion *sub; char *title; bool set_shape; if(frame->bar_brush==NULL || frame->titles==NULL) return; set_shape=frame->tabs_params.alg(frame,complete); if(set_shape) { if(frame->barmode==FRAME_BAR_SHAPED) frame_set_shape(frame); else frame_clear_shape(frame); } i=0; if(FRAME_MCOUNT(frame)==0){ free_title(frame, i); textw=frame->titles[i].iw; if(textw>0){ title=grbrush_make_label(frame->bar_brush, TR("<empty frame>"), textw); frame->titles[i].text=title; } return; } FRAME_MX_FOR_ALL(sub, frame, tmp){ free_title(frame, i); textw=frame->titles[i].iw; if(textw>0){ title=region_make_label(sub, textw, frame->bar_brush); frame->titles[i].text=title; } 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; }