예제 #1
0
파일: menu.c 프로젝트: wavebeem/wmfs
static void
menu_draw_item_name(Menu *menu, int item, BarWindow *winitem[], int chcklen)
{
    int x;
    int width = menu_get_longer_string(menu->item, menu->nitem) + chcklen + PAD / 3;

    switch(menu->align)
    {
    case MA_Left:
        x = chcklen + PAD / 2;
        break;
    case MA_Right:
        x = width - textw(menu->item[item].name) + PAD * 3 / 2;
        break;
    default:
    case MA_Center:
        x = (width - (chcklen + PAD / 3)) / 2 - textw(menu->item[item].name) / 2 + chcklen + PAD / 3;
        break;
    }
    barwin_draw_image_ofset_text(winitem[item], x, FHINFOBAR, menu->item[item].name, chcklen + PAD / 2, 0);

    if(menu->item[item].check)
        if(menu->item[item].check(menu->item[item].cmd))
            barwin_draw_image_ofset_text(winitem[item], PAD / 3, FHINFOBAR, conf.selected_layout_symbol, PAD / 3, 0);

    if(menu->item[item].submenu)
        barwin_draw_text(winitem[item], width + PAD * 2, FHINFOBAR, ">");

    return;
}
예제 #2
0
파일: infobar.c 프로젝트: n4cht/nnwm
/** Draw the layout button in the InfoBar
 *\param sc Screen number
 */
static void
infobar_draw_layout(int sc)
{
     if(!conf.layout_placement)
          barwin_move(infobar[sc].layout_button, infobar[sc].tags_board->geo.width + PAD / 2, 0);

     barwin_resize(infobar[sc].layout_button, ((conf.layout_button_width > 0) ? (uint)conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)), infobar[sc].geo.height);
     barwin_refresh_color(infobar[sc].layout_button);

     if(tags[sc][seltag[sc]].layout.symbol)
          barwin_draw_text(infobar[sc].layout_button, PAD / 2, FHINFOBAR, tags[sc][seltag[sc]].layout.symbol);

     return;
}
예제 #3
0
파일: infobar.c 프로젝트: n4cht/nnwm
/** Draw Selbar (selected client title bar in infobar
 *\param sc Screen Number
 */
void
infobar_draw_selbar(int sc)
{
     char *str = NULL;

     if(!conf.bars.selbar)
          return;

     if(!sel || (sel && sel->screen != sc))
     {
          barwin_unmap(infobar[sc].selbar);

          return;
     }
     else if(sel && !infobar[sc].selbar->mapped)
          barwin_map(infobar[sc].selbar);

     if(conf.selbar.maxlength >= 0 && sel)
     {
          str = xcalloc(conf.selbar.maxlength + 4, sizeof(char));
          strncpy(str, sel->title, conf.selbar.maxlength);

          if(strlen(sel->title) > (size_t)conf.selbar.maxlength)
               strcat(str, "...");
     }

     barwin_resize(infobar[sc].selbar, textw(str ? str : sel->title) + PAD, infobar[sc].geo.height - 2);

     barwin_move(infobar[sc].selbar,
               ((conf.layout_placement)
                ? (infobar[sc].tags_board->geo.x + infobar[sc].tags_board->geo.width + PAD / 2)
                : (infobar[sc].layout_button->geo.x + infobar[sc].layout_button->geo.width + PAD / 2)), 1);

     barwin_refresh_color(infobar[sc].selbar);
     barwin_draw_text(infobar[sc].selbar, PAD / 2, FHINFOBAR - 1, ((str) ? str : sel->title));

     barwin_refresh(infobar[sc].selbar);

     free(str);

     return;
}
예제 #4
0
파일: infobar.c 프로젝트: n4cht/nnwm
/** Draw the taglist in the InfoBar
 *\param sc Screen number
*/
void
infobar_draw_taglist(int sc)
{
     int i, x;
     Client *c = NULL;
     Bool is_occupied[MAXTAG + 1];

     if(conf.layout_placement)
          barwin_move(infobar[sc].tags_board, ((conf.layout_button_width > 0) ? (uint)conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)) + PAD / 2, 0);

     for(i = 0; i < MAXTAG; i++)
          is_occupied[i] = False;

     for(c = clients; c; c = c->next)
          if(c->screen == sc && c->tag != MAXTAG + 1)
               is_occupied[c->tag] = True;

     for(i = 1, x = 0; i < conf.ntag[sc] + 1; ++i)
     {
          /* Autohide tag feature */
          if(conf.tagautohide)
          {
               if(!is_occupied[i] && i != seltag[sc])
               {
                    barwin_unmap(infobar[sc].tags[i]);

                    continue;
               }

               if(!infobar[sc].tags[i]->mapped)
                    barwin_map(infobar[sc].tags[i]);

               barwin_move(infobar[sc].tags[i], x, 0);

               x += infobar[sc].tags[i]->geo.width;

               barwin_resize(infobar[sc].tags_board, x, infobar[sc].geo.height);
          }

          infobar[sc].tags[i]->bg = tags[sc][i].urgent
               ? conf.colors.tagurbg
               : ((i == seltag[sc] || tags[sc][seltag[sc]].tagad & TagFlag(i))
                    ? conf.colors.tagselbg
                    : (is_occupied[i]
                         ? conf.colors.tag_occupied_bg
                         : conf.colors.bar));

          infobar[sc].tags[i]->fg = tags[sc][i].urgent
               ? conf.colors.tagurfg
               : ((i == seltag[sc] || tags[sc][seltag[sc]].tagad & TagFlag(i))
                    ? conf.colors.tagselfg
                    : (is_occupied[i]
                         ? conf.colors.tag_occupied_fg
                         : conf.colors.text));

          barwin_color_set(infobar[sc].tags[i], infobar[sc].tags[i]->bg, infobar[sc].tags[i]->fg);
          barwin_refresh_color(infobar[sc].tags[i]);

          if(tags[sc][i].name)
               barwin_draw_text(infobar[sc].tags[i], PAD / 2, FHINFOBAR, tags[sc][i].name);
     }

     return;
}