[hackers] [st] Getbuttoninfo is always used the same and just a helper function. Shrinking it || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Thu, 15 Nov 2012 21:45:04 +0100 (CET)

changeset: 422:136bca1e7b5c
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Thu Nov 15 21:42:58 2012 +0100
files: st.c
description:
Getbuttoninfo is always used the same and just a helper function. Shrinking it
a bit. Thanks nsz!


diff -r ff332a879aa2 -r 136bca1e7b5c st.c
--- a/st.c Thu Nov 15 20:57:37 2012 +0100
+++ b/st.c Thu Nov 15 21:42:58 2012 +0100
_AT_@ -621,12 +621,9 @@
 }
 
 void
-getbuttoninfo(XEvent *e, int *b, int *x, int *y) {
- if(b)
- *b = e->xbutton.button;
-
- *x = x2col(e->xbutton.x);
- *y = y2row(e->xbutton.y);
+getbuttoninfo(XEvent *e) {
+ sel.ex = x2col(e->xbutton.x);
+ sel.ey = y2row(e->xbutton.y);
 
         sel.b.x = sel.by < sel.ey ? sel.bx : sel.ex;
         sel.b.y = MIN(sel.by, sel.ey);
_AT_@ -824,7 +821,7 @@
                 selpaste(NULL);
         } else if(e->xbutton.button == Button1) {
                 sel.mode = 0;
- getbuttoninfo(e, NULL, &sel.ex, &sel.ey);
+ getbuttoninfo(e);
                 term.dirty[sel.ey] = 1;
                 if(sel.bx == sel.ex && sel.by == sel.ey) {
                         sel.bx = -1;
_AT_@ -873,7 +870,7 @@
         if(sel.mode) {
                 oldey = sel.ey;
                 oldex = sel.ex;
- getbuttoninfo(e, NULL, &sel.ex, &sel.ey);
+ getbuttoninfo(e);
 
                 if(oldey != sel.ey || oldex != sel.ex) {
                         starty = MIN(oldey, sel.ey);
Received on Thu Nov 15 2012 - 21:45:04 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 15 2012 - 21:48:05 CET