Wmfs: Fix warnings

This commit is contained in:
Martin Duquesnoy 2011-08-03 06:17:07 +02:00
parent 570a3f0e64
commit b42c42245a
11 changed files with 45 additions and 54 deletions

View File

@ -98,7 +98,7 @@ barwin_create(Window parent,
bw->bg = bg; bw->bg = bg;
bw->fg = fg; bw->fg = fg;
FLAGAPPLY(bw->flags, stipple, StippleFlag); FLAGAPPLY(bw->flags, stipple, StippleFlag);
bw->stipple_color = -1; bw->stipple_color = 0xffffffff;
/* Attach */ /* Attach */
SLIST_INSERT_HEAD(&bwhead, bw, next); SLIST_INSERT_HEAD(&bwhead, bw, next);
@ -135,7 +135,7 @@ barwin_color_set(BarWindow *bw, uint bg, char *fg)
bw->border.dark = color_shade(bg, conf.colors.bar_dark_shade); bw->border.dark = color_shade(bg, conf.colors.bar_dark_shade);
} }
if(bw->flags & StippleFlag && bw->stipple_color == -1) if(bw->flags & StippleFlag && bw->stipple_color == 0xffffffff)
bw->stipple_color = getcolor(fg); bw->stipple_color = getcolor(fg);
return; return;

View File

@ -653,7 +653,7 @@ client_set_rules(Client *c)
client_maximize(c); client_maximize(c);
} }
if(c->tag != (uint)seltag[selscreen]) if(c->tag != seltag[selscreen])
{ {
tags[c->screen][c->tag].flags |= RequestUpdateFlag; tags[c->screen][c->tag].flags |= RequestUpdateFlag;
client_focus(NULL); client_focus(NULL);
@ -787,7 +787,7 @@ client_manage(Window w, XWindowAttributes *wa, bool ar)
client_set_rules(c); client_set_rules(c);
client_get_name(c); client_get_name(c);
if(c->tag == (uint)seltag[selscreen]) if(c->tag == seltag[selscreen])
{ {
client_raise(c); client_raise(c);
client_map(c); client_map(c);
@ -808,7 +808,7 @@ client_manage(Window w, XWindowAttributes *wa, bool ar)
if(!conf.client.set_new_win_master) if(!conf.client.set_new_win_master)
layout_set_client_master(c); layout_set_client_master(c);
if(c->tag == (uint)seltag[selscreen]) if(c->tag == seltag[selscreen])
client_focus(c); client_focus(c);
if(conf.client.new_client_get_mouse) if(conf.client.new_client_get_mouse)
@ -1155,7 +1155,7 @@ client_focus_next(Client *c)
for(; c_next && c_next->tag != c->tag && c_next->screen != c->screen; for(; c_next && c_next->tag != c->tag && c_next->screen != c->screen;
c_next = SLIST_NEXT(c_next, next)); c_next = SLIST_NEXT(c_next, next));
if(c_next && c_next->tag == (uint)seltag[selscreen] if(c_next && c_next->tag == seltag[selscreen]
&& c_next->screen == selscreen) && c_next->screen == selscreen)
client_focus(c_next); client_focus(c_next);
@ -1205,7 +1205,7 @@ client_unmanage(Client *c)
{ {
/* Arrange */ /* Arrange */
for(i = 0; i < screen_count() && !b; ++i) for(i = 0; i < screen_count() && !b; ++i)
if(c->tag == (uint)seltag[i]) if(c->tag == seltag[i])
{ {
b = True; b = True;
break; break;
@ -1422,7 +1422,7 @@ uicb_client_select(uicb_t cmd)
if(clist_index[i].client->screen != selscreen) if(clist_index[i].client->screen != selscreen)
screen_set_sel(clist_index[i].client->screen); screen_set_sel(clist_index[i].client->screen);
if(clist_index[i].client->tag != (uint)seltag[clist_index[i].client->screen]) if(clist_index[i].client->tag != seltag[clist_index[i].client->screen])
tag_set(clist_index[i].client->tag); tag_set(clist_index[i].client->tag);
client_focus(clist_index[i].client); client_focus(clist_index[i].client);

View File

@ -84,16 +84,15 @@ static void
parse_image_block(Drawable dr, char *str, bool m) parse_image_block(Drawable dr, char *str, bool m)
{ {
ImageAttr im; ImageAttr im;
BarWindow *bw;
Geo area; Geo area;
char as, mouse[512] = { 0 }; char as, mouse[512] = { 0 };
int i = 0, j = 0, k = 0, n; int i = 0, j = 0, k = 0, n;
for(; i < (int)strlen(str); ++i, ++j) for(; i < (int)strlen(str); ++i, ++j)
if((n = sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^];]]%c", if(((n = sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^];]]%c",
&im.x, &im.y, &im.w, &im.h, im.name, &as)) == 6 &im.x, &im.y, &im.w, &im.h, im.name, &as)) == 6
|| (n = sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^;];%512[^]]]%c", || (n = sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^;];%512[^]]]%c",
&im.x, &im.y, &im.w, &im.h, im.name, mouse, &as)) == 7 &im.x, &im.y, &im.w, &im.h, im.name, mouse, &as)) == 7)
&& as == '\\') && as == '\\')
{ {
draw_image(dr, im.x - sw, im.y, im.w, im.h, im.name); draw_image(dr, im.x - sw, im.y, im.w, im.h, im.name);

View File

@ -149,9 +149,9 @@ infobar_draw_layout(InfoBar *i)
if(!conf.layout_placement) if(!conf.layout_placement)
barwin_move(i->layout_button, i->tags_board->geo.width + (PAD >> 1), 0); barwin_move(i->layout_button, i->tags_board->geo.width + (PAD >> 1), 0);
w = (conf.layout_button_width > 0) w = (conf.layout_button_width >= 1)
? conf.layout_button_width ? conf.layout_button_width
: textw(tags[sc][seltag[sc]].layout.symbol) + PAD; : (int)(textw(tags[sc][seltag[sc]].layout.symbol) + PAD);
barwin_resize(i->layout_button, w, i->geo.height); barwin_resize(i->layout_button, w, i->geo.height);
barwin_refresh_color(i->layout_button); barwin_refresh_color(i->layout_button);

View File

@ -113,7 +113,7 @@ layoutswitch(bool b)
screen_get_sel(); screen_get_sel();
if(tags[selscreen][seltag[selscreen]].layout.func == freelayout) if(tags[selscreen][seltag[selscreen]].layout.func == freelayout)
for(; c && (c->tag != (uint)seltag[selscreen] && c->screen != selscreen); c = SLIST_NEXT(c, next)) for(; c && (c->tag != seltag[selscreen] && c->screen != selscreen); c = SLIST_NEXT(c, next))
{ {
c->ogeo = c->geo; c->ogeo = c->geo;
c->free_geo = c->geo; c->free_geo = c->geo;
@ -348,16 +348,16 @@ multi_tile(int screen, Position type)
if(LDIR(type)) if(LDIR(type))
{ {
if(type == Left) if(type == Left)
mastergeo.x = (n <= nmaster) ? (uint)sg.x : (sg.x + sg.width) - mwfact - (BORDH << 1); mastergeo.x = (n <= nmaster) ? sg.x : (sg.x + sg.width) - mwfact - (BORDH << 1);
mastergeo.width = (n <= nmaster) ? (uint)(sg.width - (BORDH << 1)) : mwfact; mastergeo.width = (n <= nmaster) ? (sg.width - (BORDH << 1)) : mwfact;
mastergeo.height = (sg.height / nmaster) - BORDH; mastergeo.height = (sg.height / nmaster) - BORDH;
} }
else else
{ {
if(type == Top) if(type == Top)
mastergeo.y = (n <= nmaster) ? (uint)sg.y : sg.y + (sg.height - mwfact) - BORDH; mastergeo.y = (n <= nmaster) ? sg.y : sg.y + (sg.height - mwfact) - BORDH;
mastergeo.width = (sg.width / nmaster) - (BORDH << 2); mastergeo.width = (sg.width / nmaster) - (BORDH << 2);
mastergeo.height = (n <= nmaster) ? (uint)(sg.height - BORDH) : mwfact; mastergeo.height = (n <= nmaster) ? (sg.height - BORDH) : mwfact;
} }
/* TILED SIZE */ /* TILED SIZE */
if(n > nmaster) if(n > nmaster)
@ -825,7 +825,7 @@ uicb_toggle_abovefc(uicb_t cmd)
SLIST_FOREACH(c, &clients, next) SLIST_FOREACH(c, &clients, next)
if(c->flags & AboveFlag if(c->flags & AboveFlag
&& c->screen == selscreen && c->screen == selscreen
&& c->tag == (uint)seltag[selscreen]) && c->tag == seltag[selscreen])
{ {
c->flags &= ~AboveFlag; c->flags &= ~AboveFlag;
break; break;

View File

@ -41,6 +41,7 @@
void \ void \
uicb_split_move_##d(uicb_t cmd) \ uicb_split_move_##d(uicb_t cmd) \
{ \ { \
(void)cmd; \
CHECK(sel); \ CHECK(sel); \
split_move_dir(sel, d); \ split_move_dir(sel, d); \
} }

View File

@ -49,7 +49,7 @@ statustext_mouse(char *str, Geo area, InfoBar *infobar)
char cmd[256] = { 0 }; char cmd[256] = { 0 };
char func[64] = { 0 }; char func[64] = { 0 };
for(; i < strlen(str); ++i, sm = NULL) for(; i < (int)strlen(str); ++i, sm = NULL)
if((n = sscanf(&str[i], "(%d;%64[^;];%256[^)])", &button, func, cmd) >= 2) && n < 4) if((n = sscanf(&str[i], "(%d;%64[^;];%256[^)])", &button, func, cmd) >= 2) && n < 4)
{ {
sm = zcalloc(sizeof(StatusMouse)); sm = zcalloc(sizeof(StatusMouse));
@ -65,7 +65,6 @@ statustext_mouse(char *str, Geo area, InfoBar *infobar)
while(str[++i + 1] != ')'); while(str[++i + 1] != ')');
} }
return; return;
} }
@ -82,10 +81,10 @@ statustext_rectangle(InfoBar *ib, char *str)
int i = 0, j = 0, k, n; int i = 0, j = 0, k, n;
for(; i < (int)strlen(str); ++i, ++j) for(; i < (int)strlen(str); ++i, ++j)
if((n = sscanf(&str[i], "\\b[%d;%d;%d;%d;#%x]%c", if(((n = sscanf(&str[i], "\\b[%d;%d;%d;%d;#%x]%c",
&r.g.x, &r.g.y, &r.g.width, &r.g.height, &r.color, &as)) == 6 &r.g.x, &r.g.y, &r.g.width, &r.g.height, &r.color, &as)) == 6
|| (n = sscanf(&str[i], "\\b[%d;%d;%d;%d;#%x;%512[^]]]%c", || (n = sscanf(&str[i], "\\b[%d;%d;%d;%d;#%x;%512[^]]]%c",
&r.g.x, &r.g.y, &r.g.width, &r.g.height, &r.color, mouse, &as)) == 7 &r.g.x, &r.g.y, &r.g.width, &r.g.height, &r.color, mouse, &as)) == 7)
&& as == '\\') && as == '\\')
{ {
draw_rectangle(ib->bar->dr, r.g.x - sw, r.g.y, r.g.width, r.g.height, r.color); draw_rectangle(ib->bar->dr, r.g.x - sw, r.g.y, r.g.width, r.g.height, r.color);
@ -166,10 +165,10 @@ statustext_text(InfoBar *ib, char *str)
int i = 0, j = 0, k, n; int i = 0, j = 0, k, n;
for(; i < (int)strlen(str); ++i, ++j) for(; i < (int)strlen(str); ++i, ++j)
if((n = sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^];]]%c", if(((n = sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^];]]%c",
&s.x, &s.y, s.color, s.text, &as)) == 5 &s.x, &s.y, s.color, s.text, &as)) == 5
|| (n = sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^;];%512[^]]]%c", || (n = sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^;];%512[^]]]%c",
&s.x, &s.y, s.color, s.text, mouse, &as)) == 6 &s.x, &s.y, s.color, s.text, mouse, &as)) == 6)
&& as == '\\') && as == '\\')
{ {
draw_text(ib->bar->dr, s.x - sw, s.y, s.color, s.text); draw_text(ib->bar->dr, s.x - sw, s.y, s.color, s.text);
@ -260,7 +259,6 @@ statustext_handle(int sc, char *str)
InfoBar *ib = &infobar[sc]; InfoBar *ib = &infobar[sc];
StatusMouse *sm; StatusMouse *sm;
char *lastst; char *lastst;
int i;
/* If the str == the current statustext, return (not needed) */ /* If the str == the current statustext, return (not needed) */
if(!str) if(!str)

View File

@ -210,7 +210,7 @@ typedef struct Client
/* Client title */ /* Client title */
char *title; char *title;
/* Tag num */ /* Tag num */
uint tag; int tag;
int focusontag; int focusontag;
/* Screen */ /* Screen */
int screen; int screen;
@ -564,7 +564,7 @@ typedef struct StatusMouse
{ {
Geo area; Geo area;
InfoBar *infobar; InfoBar *infobar;
int button; uint button;
void (*func)(uicb_t); void (*func)(uicb_t);
uicb_t cmd; uicb_t cmd;
SLIST_ENTRY(StatusMouse) next; SLIST_ENTRY(StatusMouse) next;

View File

@ -106,8 +106,6 @@ systray_add(Window win)
void void
systray_del(Systray *s) systray_del(Systray *s)
{ {
Systray **ss;
if(!conf.systray.active) if(!conf.systray.active)
return; return;

View File

@ -102,6 +102,11 @@ tag_set(int tag)
break; break;
} }
/* To focus selected client of the via focusontag option */
SLIST_FOREACH(c, &clients, next)
if(c->focusontag == tag && c->screen == selscreen)
break;
arrange(selscreen, al); arrange(selscreen, al);
if(tags[selscreen][tag].flags & RequestUpdateFlag) if(tags[selscreen][tag].flags & RequestUpdateFlag)
@ -110,15 +115,10 @@ tag_set(int tag)
tags[selscreen][tag].flags &= ~RequestUpdateFlag; tags[selscreen][tag].flags &= ~RequestUpdateFlag;
} }
/* To focus selected client of the via focusontag option */
SLIST_FOREACH(c, &clients, next)
if(c->focusontag == tag && c->screen == selscreen)
break;
/* No focusontag option found on any client, try to find the first of the tag */ /* No focusontag option found on any client, try to find the first of the tag */
if(!c) if(!c)
SLIST_FOREACH(c, &clients, next) SLIST_FOREACH(c, &clients, next)
if(c->tag == (uint)seltag[selscreen] && c->screen == selscreen) if(c->tag == seltag[selscreen] && c->screen == selscreen)
break; break;
client_focus((c) ? c : NULL); client_focus((c) ? c : NULL);
@ -353,9 +353,9 @@ tag_swap(int s, int t1, int t2)
SLIST_FOREACH(c, &clients, next) SLIST_FOREACH(c, &clients, next)
{ {
if(c->screen == s && c->tag == (uint)t1) if(c->screen == s && c->tag == t1)
c->tag = t2; c->tag = t2;
else if(c->screen == s && c->tag == (uint)t2) else if(c->screen == s && c->tag == t2)
c->tag = t1; c->tag = t1;
} }
@ -651,7 +651,7 @@ tag_delete(int s, int tag)
{ {
Tag t; Tag t;
Client *c; Client *c;
size_t i; int i;
memset(&t, 0, sizeof(t)); memset(&t, 0, sizeof(t));
@ -659,7 +659,7 @@ tag_delete(int s, int tag)
return; return;
SLIST_FOREACH(c, &clients, next) SLIST_FOREACH(c, &clients, next)
if(c->screen == s && c->tag == (uint)tag) if(c->screen == s && c->tag ==tag)
{ {
warnx("Client(s) present in this tag, can't delete it"); warnx("Client(s) present in this tag, can't delete it");
@ -671,7 +671,7 @@ tag_delete(int s, int tag)
tags[s][tag] = t; tags[s][tag] = t;
infobar[s].tags[tag] = NULL; infobar[s].tags[tag] = NULL;
for(i = tag; i < (size_t)conf.ntag[s] + 1; ++i) for(i = tag; i < conf.ntag[s] + 1; ++i)
{ {
/* Set clients tag because of shift */ /* Set clients tag because of shift */
SLIST_FOREACH(c, &clients, next) SLIST_FOREACH(c, &clients, next)

View File

@ -79,8 +79,6 @@ errorhandlerdummy(Display *d, XErrorEvent *event)
void void
quit(void) quit(void)
{ {
Client *c;
BarWindow *bw;
size_t i, len; size_t i, len;
/* Set the silent error handler */ /* Set the silent error handler */
@ -89,7 +87,7 @@ quit(void)
/* Unmanage all clients */ /* Unmanage all clients */
while(!SLIST_EMPTY(&clients)) while(!SLIST_EMPTY(&clients))
{ {
c = SLIST_FIRST(&clients); Client *c = SLIST_FIRST(&clients);
client_unhide(c); client_unhide(c);
XReparentWindow(dpy, c->win, ROOT, c->geo.x, c->geo.y); XReparentWindow(dpy, c->win, ROOT, c->geo.x, c->geo.y);
free(c); free(c);
@ -115,10 +113,7 @@ quit(void)
/* BarWindows */ /* BarWindows */
while(!SLIST_EMPTY(&bwhead)) while(!SLIST_EMPTY(&bwhead))
{
bw = SLIST_FIRST(&bwhead);
SLIST_REMOVE_HEAD(&bwhead, next); SLIST_REMOVE_HEAD(&bwhead, next);
}
free(sgeo); free(sgeo);
free(spgeo); free(spgeo);
@ -243,7 +238,7 @@ scan(void)
/* Set update layout request */ /* Set update layout request */
SLIST_FOREACH(c, &clients, next) SLIST_FOREACH(c, &clients, next)
{ {
if(c->tag > (uint)conf.ntag[c->screen]) if(c->tag > conf.ntag[c->screen])
c->tag = conf.ntag[c->screen]; c->tag = conf.ntag[c->screen];
tags[c->screen][c->tag].flags |= RequestUpdateFlag; tags[c->screen][c->tag].flags |= RequestUpdateFlag;
} }