Getbuttoninfo is always used the same and just a helper function. Shrinking it

a bit. Thanks nsz!
dev
Christoph Lohmann 2012-11-15 21:42:58 +01:00
parent 6312f76ca4
commit 440a19a662
1 changed files with 5 additions and 8 deletions

13
st.c
View File

@ -621,12 +621,9 @@ selected(int x, int y) {
} }
void void
getbuttoninfo(XEvent *e, int *b, int *x, int *y) { getbuttoninfo(XEvent *e) {
if(b) sel.ex = x2col(e->xbutton.x);
*b = e->xbutton.button; sel.ey = y2row(e->xbutton.y);
*x = x2col(e->xbutton.x);
*y = y2row(e->xbutton.y);
sel.b.x = sel.by < sel.ey ? sel.bx : sel.ex; sel.b.x = sel.by < sel.ey ? sel.bx : sel.ex;
sel.b.y = MIN(sel.by, sel.ey); sel.b.y = MIN(sel.by, sel.ey);
@ -824,7 +821,7 @@ brelease(XEvent *e) {
selpaste(NULL); selpaste(NULL);
} else if(e->xbutton.button == Button1) { } else if(e->xbutton.button == Button1) {
sel.mode = 0; sel.mode = 0;
getbuttoninfo(e, NULL, &sel.ex, &sel.ey); getbuttoninfo(e);
term.dirty[sel.ey] = 1; term.dirty[sel.ey] = 1;
if(sel.bx == sel.ex && sel.by == sel.ey) { if(sel.bx == sel.ex && sel.by == sel.ey) {
sel.bx = -1; sel.bx = -1;
@ -873,7 +870,7 @@ bmotion(XEvent *e) {
if(sel.mode) { if(sel.mode) {
oldey = sel.ey; oldey = sel.ey;
oldex = sel.ex; oldex = sel.ex;
getbuttoninfo(e, NULL, &sel.ex, &sel.ey); getbuttoninfo(e);
if(oldey != sel.ey || oldex != sel.ex) { if(oldey != sel.ey || oldex != sel.ex) {
starty = MIN(oldey, sel.ey); starty = MIN(oldey, sel.ey);