diff --git a/src/barwin.c b/src/barwin.c index f692030..55b8de7 100644 --- a/src/barwin.c +++ b/src/barwin.c @@ -98,7 +98,7 @@ barwin_create(Window parent, bw->bg = bg; bw->fg = fg; FLAGAPPLY(bw->flags, stipple, StippleFlag); - bw->stipple_color = -1; + bw->stipple_color = 0xffffffff; /* Attach */ 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); } - if(bw->flags & StippleFlag && bw->stipple_color == -1) + if(bw->flags & StippleFlag && bw->stipple_color == 0xffffffff) bw->stipple_color = getcolor(fg); return; diff --git a/src/client.c b/src/client.c index 2bde1d5..e76b4da 100644 --- a/src/client.c +++ b/src/client.c @@ -653,7 +653,7 @@ client_set_rules(Client *c) client_maximize(c); } - if(c->tag != (uint)seltag[selscreen]) + if(c->tag != seltag[selscreen]) { tags[c->screen][c->tag].flags |= RequestUpdateFlag; client_focus(NULL); @@ -787,7 +787,7 @@ client_manage(Window w, XWindowAttributes *wa, bool ar) client_set_rules(c); client_get_name(c); - if(c->tag == (uint)seltag[selscreen]) + if(c->tag == seltag[selscreen]) { client_raise(c); client_map(c); @@ -808,7 +808,7 @@ client_manage(Window w, XWindowAttributes *wa, bool ar) if(!conf.client.set_new_win_master) layout_set_client_master(c); - if(c->tag == (uint)seltag[selscreen]) + if(c->tag == seltag[selscreen]) client_focus(c); 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; 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) client_focus(c_next); @@ -1205,7 +1205,7 @@ client_unmanage(Client *c) { /* Arrange */ for(i = 0; i < screen_count() && !b; ++i) - if(c->tag == (uint)seltag[i]) + if(c->tag == seltag[i]) { b = True; break; @@ -1422,7 +1422,7 @@ uicb_client_select(uicb_t cmd) if(clist_index[i].client->screen != selscreen) 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); client_focus(clist_index[i].client); diff --git a/src/draw.c b/src/draw.c index a98a8e6..3d50242 100644 --- a/src/draw.c +++ b/src/draw.c @@ -84,16 +84,15 @@ static void parse_image_block(Drawable dr, char *str, bool m) { ImageAttr im; - BarWindow *bw; Geo area; char as, mouse[512] = { 0 }; int i = 0, j = 0, k = 0, n; for(; i < (int)strlen(str); ++i, ++j) - if((n = sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^];]]%c", - &im.x, &im.y, &im.w, &im.h, im.name, &as)) == 6 - || (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 + if(((n = sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^];]]%c", + &im.x, &im.y, &im.w, &im.h, im.name, &as)) == 6 + || (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) && as == '\\') { draw_image(dr, im.x - sw, im.y, im.w, im.h, im.name); diff --git a/src/infobar.c b/src/infobar.c index c89c9a9..2958d9c 100644 --- a/src/infobar.c +++ b/src/infobar.c @@ -149,9 +149,9 @@ infobar_draw_layout(InfoBar *i) if(!conf.layout_placement) 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 - : 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_refresh_color(i->layout_button); diff --git a/src/layout.c b/src/layout.c index 7855d63..d7c6287 100644 --- a/src/layout.c +++ b/src/layout.c @@ -113,7 +113,7 @@ layoutswitch(bool b) screen_get_sel(); 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->free_geo = c->geo; @@ -348,16 +348,16 @@ multi_tile(int screen, Position type) if(LDIR(type)) { if(type == Left) - mastergeo.x = (n <= nmaster) ? (uint)sg.x : (sg.x + sg.width) - mwfact - (BORDH << 1); - mastergeo.width = (n <= nmaster) ? (uint)(sg.width - (BORDH << 1)) : mwfact; + mastergeo.x = (n <= nmaster) ? sg.x : (sg.x + sg.width) - mwfact - (BORDH << 1); + mastergeo.width = (n <= nmaster) ? (sg.width - (BORDH << 1)) : mwfact; mastergeo.height = (sg.height / nmaster) - BORDH; } else { 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.height = (n <= nmaster) ? (uint)(sg.height - BORDH) : mwfact; + mastergeo.height = (n <= nmaster) ? (sg.height - BORDH) : mwfact; } /* TILED SIZE */ if(n > nmaster) @@ -825,7 +825,7 @@ uicb_toggle_abovefc(uicb_t cmd) SLIST_FOREACH(c, &clients, next) if(c->flags & AboveFlag && c->screen == selscreen - && c->tag == (uint)seltag[selscreen]) + && c->tag == seltag[selscreen]) { c->flags &= ~AboveFlag; break; diff --git a/src/split.c b/src/split.c index 24fc9e7..cdb9615 100644 --- a/src/split.c +++ b/src/split.c @@ -41,6 +41,7 @@ void \ uicb_split_move_##d(uicb_t cmd) \ { \ + (void)cmd; \ CHECK(sel); \ split_move_dir(sel, d); \ } diff --git a/src/status.c b/src/status.c index 04de0d6..19918f8 100644 --- a/src/status.c +++ b/src/status.c @@ -49,7 +49,7 @@ statustext_mouse(char *str, Geo area, InfoBar *infobar) char cmd[256] = { 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) { sm = zcalloc(sizeof(StatusMouse)); @@ -65,7 +65,6 @@ statustext_mouse(char *str, Geo area, InfoBar *infobar) while(str[++i + 1] != ')'); } - return; } @@ -82,10 +81,10 @@ statustext_rectangle(InfoBar *ib, char *str) int i = 0, j = 0, k, n; for(; i < (int)strlen(str); ++i, ++j) - 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 - || (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 + 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 + || (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) && as == '\\') { 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; for(; i < (int)strlen(str); ++i, ++j) - if((n = sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^];]]%c", - &s.x, &s.y, s.color, s.text, &as)) == 5 - || (n = sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^;];%512[^]]]%c", - &s.x, &s.y, s.color, s.text, mouse, &as)) == 6 + if(((n = sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^];]]%c", + &s.x, &s.y, s.color, s.text, &as)) == 5 + || (n = sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^;];%512[^]]]%c", + &s.x, &s.y, s.color, s.text, mouse, &as)) == 6) && as == '\\') { 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]; StatusMouse *sm; char *lastst; - int i; /* If the str == the current statustext, return (not needed) */ if(!str) diff --git a/src/structs.h b/src/structs.h index eaa5314..9eab70f 100644 --- a/src/structs.h +++ b/src/structs.h @@ -210,7 +210,7 @@ typedef struct Client /* Client title */ char *title; /* Tag num */ - uint tag; + int tag; int focusontag; /* Screen */ int screen; @@ -564,7 +564,7 @@ typedef struct StatusMouse { Geo area; InfoBar *infobar; - int button; + uint button; void (*func)(uicb_t); uicb_t cmd; SLIST_ENTRY(StatusMouse) next; diff --git a/src/systray.c b/src/systray.c index 0970d1a..1a9e9ed 100644 --- a/src/systray.c +++ b/src/systray.c @@ -106,8 +106,6 @@ systray_add(Window win) void systray_del(Systray *s) { - Systray **ss; - if(!conf.systray.active) return; diff --git a/src/tag.c b/src/tag.c index 3aee149..02102fc 100644 --- a/src/tag.c +++ b/src/tag.c @@ -102,6 +102,11 @@ tag_set(int tag) 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); if(tags[selscreen][tag].flags & RequestUpdateFlag) @@ -110,15 +115,10 @@ tag_set(int tag) 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 */ if(!c) SLIST_FOREACH(c, &clients, next) - if(c->tag == (uint)seltag[selscreen] && c->screen == selscreen) + if(c->tag == seltag[selscreen] && c->screen == selscreen) break; client_focus((c) ? c : NULL); @@ -353,9 +353,9 @@ tag_swap(int s, int t1, int t2) SLIST_FOREACH(c, &clients, next) { - if(c->screen == s && c->tag == (uint)t1) + if(c->screen == s && c->tag == t1) c->tag = t2; - else if(c->screen == s && c->tag == (uint)t2) + else if(c->screen == s && c->tag == t2) c->tag = t1; } @@ -651,7 +651,7 @@ tag_delete(int s, int tag) { Tag t; Client *c; - size_t i; + int i; memset(&t, 0, sizeof(t)); @@ -659,7 +659,7 @@ tag_delete(int s, int tag) return; 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"); @@ -671,7 +671,7 @@ tag_delete(int s, int tag) tags[s][tag] = t; 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 */ SLIST_FOREACH(c, &clients, next) diff --git a/src/wmfs.c b/src/wmfs.c index ee08e9a..6dabad5 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -79,8 +79,6 @@ errorhandlerdummy(Display *d, XErrorEvent *event) void quit(void) { - Client *c; - BarWindow *bw; size_t i, len; /* Set the silent error handler */ @@ -89,7 +87,7 @@ quit(void) /* Unmanage all clients */ while(!SLIST_EMPTY(&clients)) { - c = SLIST_FIRST(&clients); + Client *c = SLIST_FIRST(&clients); client_unhide(c); XReparentWindow(dpy, c->win, ROOT, c->geo.x, c->geo.y); free(c); @@ -115,10 +113,7 @@ quit(void) /* BarWindows */ while(!SLIST_EMPTY(&bwhead)) - { - bw = SLIST_FIRST(&bwhead); SLIST_REMOVE_HEAD(&bwhead, next); - } free(sgeo); free(spgeo); @@ -243,7 +238,7 @@ scan(void) /* Set update layout request */ 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]; tags[c->screen][c->tag].flags |= RequestUpdateFlag; }