[hackers] [st] Adding scrollwheel support. Thanks Brandon Invergo! || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Tue, 6 Nov 2012 23:52:03 +0100 (CET)

changeset: 387:30aa8728f01e
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Tue Nov 06 23:44:37 2012 +0100
files: st.c
description:
Adding scrollwheel support. Thanks Brandon Invergo!


diff -r 19d11014bc63 -r 30aa8728f01e st.c
--- a/st.c Mon Nov 05 04:02:20 2012 +0100
+++ b/st.c Tue Nov 06 23:44:37 2012 +0100
_AT_@ -673,6 +673,10 @@
                 sel.mode = 1;
                 sel.ex = sel.bx = x2col(e->xbutton.x);
                 sel.ey = sel.by = y2row(e->xbutton.y);
+ } else if(e->xbutton.button == Button4) {
+ ttywrite("\031", 1);
+ } else if(e->xbutton.button == Button5) {
+ ttywrite("\005", 1);
         }
 }
 
_AT_@ -1834,8 +1838,8 @@
                 }
         }
         /*
- * STR sequences must be checked before of anything
- * because it can use some control codes as part of the sequence
+ * STR sequences must be checked before anything else
+ * because it can use some control codes as part of the sequence.
          */
         if(term.esc & ESC_STR) {
                 switch(ascii) {
_AT_@ -1855,6 +1859,7 @@
                 }
                 return;
         }
+
         /*
          * Actions of control codes must be performed as soon they arrive
          * because they can be embedded inside a control sequence, and
_AT_@ -1895,11 +1900,11 @@
                 case '\030': /* CAN */
                         csireset();
                         return;
- case '\005': /* ENQ (IGNORED) */
- case '\000': /* NUL (IGNORED) */
- case '\021': /* XON (IGNORED) */
- case '\023': /* XOFF (IGNORED) */
- case 0177: /* DEL (IGNORED) */
+ case '\005': /* ENQ (IGNORED) */
+ case '\000': /* NUL (IGNORED) */
+ case '\021': /* XON (IGNORED) */
+ case '\023': /* XOFF (IGNORED) */
+ case 0177: /* DEL (IGNORED) */
                         return;
                 }
         } else if(term.esc & ESC_START) {
Received on Tue Nov 06 2012 - 23:52:03 CET

This archive was generated by hypermail 2.3.0 : Wed Nov 07 2012 - 00:00:20 CET