Avoid cc->title = NULL case using draw_text in frame_update

This commit is contained in:
Martin Duquesnoy 2012-01-31 14:27:24 +01:00
parent 235935f36f
commit a9b5542513
4 changed files with 7 additions and 4 deletions

View File

@ -425,10 +425,12 @@ client_frame_update(struct client *c, struct colpair *cp)
{ {
struct geo g = { f - 1, 0, 1, c->titlebar->geo.h }; struct geo g = { f - 1, 0, 1, c->titlebar->geo.h };
int x = c->border; int x = c->border;
char *title;
SLIST_FOREACH(cc, &c->tag->clients, tnext) SLIST_FOREACH(cc, &c->tag->clients, tnext)
{ {
w = (cc->title ? draw_textw(c->theme, cc->title) : 0); title = (cc->title ? cc->title : "WMFS");
w = draw_textw(c->theme, title);
_XTEXT(); _XTEXT();
if(cc == c) if(cc == c)
@ -443,7 +445,7 @@ client_frame_update(struct client *c, struct colpair *cp)
_STATUSLINE(c, true); _STATUSLINE(c, true);
draw_rect(c->titlebar->dr, &g, c->scol.bg); draw_rect(c->titlebar->dr, &g, c->scol.bg);
draw_text(c->titlebar->dr, c->theme, xt, y, cp->fg, c->title); draw_text(c->titlebar->dr, c->theme, xt, y, cp->fg, title);
barwin_refresh(c->titlebar); barwin_refresh(c->titlebar);
x += f; x += f;
@ -461,7 +463,7 @@ client_frame_update(struct client *c, struct colpair *cp)
_STATUSLINE(cc, false); _STATUSLINE(cc, false);
draw_rect(cc->titlebar->dr, &g, c->scol.bg); draw_rect(cc->titlebar->dr, &g, c->scol.bg);
draw_text(cc->titlebar->dr, c->theme, xt, y - 1, c->ncol.fg, cc->title); draw_text(cc->titlebar->dr, c->theme, xt, y - 1, c->ncol.fg, title);
barwin_refresh(cc->titlebar); barwin_refresh(cc->titlebar);
x += f; x += f;

View File

@ -49,6 +49,7 @@ ewmh_init(void)
W->net_atom[net_wm_state_fullscreen] = ATOM("_NET_WM_STATE_FULLSCREEN"); W->net_atom[net_wm_state_fullscreen] = ATOM("_NET_WM_STATE_FULLSCREEN");
W->net_atom[net_wm_state_sticky] = ATOM("_NET_WM_STATE_STICKY"); W->net_atom[net_wm_state_sticky] = ATOM("_NET_WM_STATE_STICKY");
W->net_atom[net_wm_state_demands_attention] = ATOM("_NET_WM_STATE_DEMANDS_ATTENTION"); W->net_atom[net_wm_state_demands_attention] = ATOM("_NET_WM_STATE_DEMANDS_ATTENTION");
W->net_atom[net_wm_state_hidden] = ATOM("_NET_WM_STATE_HIDDEN");
W->net_atom[net_system_tray_s] = ATOM("_NET_SYSTEM_TRAY_S0"); W->net_atom[net_system_tray_s] = ATOM("_NET_SYSTEM_TRAY_S0");
W->net_atom[net_system_tray_opcode] = ATOM("_NET_SYSTEM_TRAY_OPCODE"); W->net_atom[net_system_tray_opcode] = ATOM("_NET_SYSTEM_TRAY_OPCODE");
W->net_atom[net_system_tray_message_data] = ATOM("_NET_SYSTEM_TRAY_MESSAGE_DATA"); W->net_atom[net_system_tray_message_data] = ATOM("_NET_SYSTEM_TRAY_MESSAGE_DATA");

View File

@ -68,6 +68,7 @@ enum
net_wm_state_fullscreen, net_wm_state_fullscreen,
net_wm_state_sticky, net_wm_state_sticky,
net_wm_state_demands_attention, net_wm_state_demands_attention,
net_wm_state_hidden,
net_system_tray_opcode, net_system_tray_opcode,
net_system_tray_message_data, net_system_tray_message_data,
net_system_tray_s, net_system_tray_s,

View File

@ -215,7 +215,6 @@ complete(struct launcher_ccache *cache, char *start)
cache->namelist = complete_on_command(p); cache->namelist = complete_on_command(p);
else else
cache->namelist = complete_on_files(p); cache->namelist = complete_on_files(p);
} }
if(cache->namelist && cache->namelist[cache->hits]) if(cache->namelist && cache->namelist[cache->hits])