From 9703859e6c1e2280036dc7992cb4c54688f719f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Aptel?= Date: Tue, 31 Aug 2010 18:22:59 +0200 Subject: [PATCH] cleanup. --- st.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/st.c b/st.c index c2f294a..bff500b 100644 --- a/st.c +++ b/st.c @@ -218,13 +218,13 @@ selinit(void) { } static inline int selected(int x, int y) { - if ((sel.ey==y && sel.by==y)) { + if(sel.ey == y && sel.by == y) { int bx = MIN(sel.bx, sel.ex); int ex = MAX(sel.bx, sel.ex); - return (x>=bx && x<=ex); + return BETWEEN(x, bx, ex); } - return (((y>sel.b[1] && y=sel.b[0] && (x<=sel.e[0] || sel.b[1]!=sel.e[1]))); + return ((sel.b[1] < y&&y < sel.e[1]) || (y==sel.e[1] && x<=sel.e[0])) + || (y==sel.b[1] && x>=sel.b[0] && (x<=sel.e[0] || sel.b[1]!=sel.e[1])); } static void getbuttoninfo(XEvent *e, int *b, int *x, int *y) { @@ -232,9 +232,9 @@ static void getbuttoninfo(XEvent *e, int *b, int *x, int *y) { *b=*b==4096?5:*b==2048?4:*b==1024?3:*b==512?2:*b==256?1:-1; *x = e->xbutton.x/xw.cw; *y = e->xbutton.y/xw.ch; - sel.b[0] = sel.by