X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=st.c;h=5198749af5ecb16ca5a4dbcf9c743f14ac58c827;hb=5f91983541014d34274087dbf723b48551f90fc0;hp=9079834994c5aad8f164430e0d22aeac1377b845;hpb=74962bf56636e608f0ee35f2076bc6b48923119d;p=st.git diff --git a/st.c b/st.c index 9079834..5198749 100644 --- a/st.c +++ b/st.c @@ -674,18 +674,13 @@ selsort(void) { static inline bool selected(int x, int y) { - if(sel.ne.y == y && sel.nb.y == y) - return BETWEEN(x, sel.nb.x, sel.ne.x); + if(sel.type == SEL_RECTANGULAR) + return BETWEEN(y, sel.nb.y, sel.ne.y) + && BETWEEN(x, sel.nb.x, sel.ne.x); - if(sel.type == SEL_RECTANGULAR) { - return ((sel.nb.y <= y && y <= sel.ne.y) - && (sel.nb.x <= x && x <= sel.ne.x)); - } - - return ((sel.nb.y < y && y < sel.ne.y) - || (y == sel.ne.y && x <= sel.ne.x)) - || (y == sel.nb.y && x >= sel.nb.x - && (x <= sel.ne.x || sel.nb.y != sel.ne.y)); + return BETWEEN(y, sel.nb.y, sel.ne.y) + && (y != sel.nb.y || x >= sel.nb.x) + && (y != sel.ne.y || x <= sel.ne.x); } void @@ -2993,13 +2988,9 @@ xunloadfont(Font *f) { void xunloadfonts(void) { - int i; - /* Free the loaded fonts in the font cache. */ - for(i = 0; i < frclen; i++) { - XftFontClose(xw.dpy, frc[i].font); - } - frclen = 0; + while(frclen > 0) + XftFontClose(xw.dpy, frc[--frclen].font); xunloadfont(&dc.font); xunloadfont(&dc.bfont);