Hi. The following is a patch for slipwheelin', the ability
to scroll without rolling the mouse wheel. To try
it, push Ctrl then move your wheel up or down by a notch. The
scrollbar will start to move. If you move the wheel more,
the scroll bar will accelerate faster. Releasing the ctrl
key will stop scrolling and set the velocity of the thumb
back to zero.
Patch includes patches for configure.in
Ali.
diff -c -B -b -N -r rxvt-old/Makefile.in rxvt-slip2/Makefile.in
*** rxvt-old/autoconf/config.h.in Tue Sep 19 01:57:07 2000
--- rxvt-slip2/autoconf/config.h.in Fri Feb 9 00:16:36 2001
***************
*** 98,103 ****
--- 98,111 ----
*/
#undef NO_MOUSE_WHEEL
+
+ /*
+ * When CTRL is pressed, wheel events accelerate scrolling. Unpress CTRL
+ * to reset the velocity of scrolling to zero.
+ */
+ #define SLIP_WHEELING
+
+
/* Define if you don't want handling for rarely used features */
#undef NO_FRILLS
diff -c -B -b -N -r rxvt-old/src/Makefile.in rxvt-slip2/src/Makefile.in
*** rxvt-old/src/Makefile.in Tue Sep 19 00:40:46 2000
--- rxvt-slip2/src/Makefile.in Fri Feb 9 00:40:06 2001
***************
*** 1,4 ****
! # $Id: Makefile.in,v 1.43 2000/09/19 05:40:46 gcw Exp $
@MCOMMON@
srcdir = @srcdir@
--- 1,4 ----
! # $Id: Makefile.in 1.2 Fri, 09 Feb 2001 00:40:06 -0500 rahimi $
@MCOMMON@
srcdir = @srcdir@
***************
*** 21,27 ****
LIBSRCS = command.c graphics.c grkelot.c init.c logging.c main.c menubar.c
\
misc.c netdisp.c screen.c scrollbar.c scrollbar-rxvt.c \
! scrollbar-next.c scrollbar-xterm.c strings.c xdefaults.c xpm.c
SRCS = rxvt.c $(LIBSRCS)
--- 21,28 ----
LIBSRCS = command.c graphics.c grkelot.c init.c logging.c main.c menubar.c
\
misc.c netdisp.c screen.c scrollbar.c scrollbar-rxvt.c \
! scrollbar-next.c scrollbar-xterm.c strings.c xdefaults.c xpm.c \
! slipwheel.c
SRCS = rxvt.c $(LIBSRCS)
***************
*** 36,48 ****
logging.extpro main.extpro menubar.extpro misc.extpro netdisp.extpro \
screen.extpro scrollbar.extpro scrollbar-rxvt.extpro \
scrollbar-next.extpro scrollbar-xterm.extpro strings.extpro \
! xdefaults.extpro xpm.extpro
INTPROS = command.intpro graphics.intpro grkelot.intpro init.intpro \
logging.intpro main.intpro menubar.intpro misc.intpro netdisp.intpro \
screen.intpro scrollbar.intpro scrollbar-rxvt.intpro \
scrollbar-next.intpro scrollbar-xterm.intpro strings.intpro \
! xdefaults.intpro xpm.intpro
DEPS = rxvt.h ${basedir}/config.h feature.h rsizes.h $(EXTPROS)
--- 37,49 ----
logging.extpro main.extpro menubar.extpro misc.extpro netdisp.extpro \
screen.extpro scrollbar.extpro scrollbar-rxvt.extpro \
scrollbar-next.extpro scrollbar-xterm.extpro strings.extpro \
! xdefaults.extpro xpm.extpro slipwheel.extpro
INTPROS = command.intpro graphics.intpro grkelot.intpro init.intpro \
logging.intpro main.intpro menubar.intpro misc.intpro netdisp.intpro \
screen.intpro scrollbar.intpro scrollbar-rxvt.intpro \
scrollbar-next.intpro scrollbar-xterm.intpro strings.intpro \
! xdefaults.intpro xpm.intpro slipwheel.intpro
DEPS = rxvt.h ${basedir}/config.h feature.h rsizes.h $(EXTPROS)
***************
*** 166,168 ****
--- 167,170 ----
strings.lo: strings.c $(DEPS) strings.intpro
xdefaults.lo: xdefaults.c $(DEPS) xdefaults.intpro version.h
xpm.lo: xpm.c $(DEPS) xpm.intpro
+ slipwheel.lo: slipwheel.c $(DEPS) slipwheel.intpro
\ No newline at end of file
diff -c -B -b -N -r rxvt-old/src/command.c rxvt-slip2/src/command.c
*** rxvt-old/src/command.c Tue Sep 19 00:38:45 2000
--- rxvt-slip2/src/command.c Fri Feb 9 00:40:06 2001
***************
*** 1,7 ****
/*--------------------------------*-C-*---------------------------------*
* File: command.c
*----------------------------------------------------------------------*
! * $Id: command.c,v 1.181 2000/09/19 05:38:21 gcw Exp $
*
* All portions of code are copyright by their respective author/s.
* Copyright (C) 1992 John Bovey, University of Kent at Canterbury
<[EMAIL PROTECTED]>
--- 1,7 ----
/*--------------------------------*-C-*---------------------------------*
* File: command.c
*----------------------------------------------------------------------*
! * $Id: command.c 1.2 Fri, 09 Feb 2001 00:40:06 -0500 rahimi $
*
* All portions of code are copyright by their respective author/s.
* Copyright (C) 1992 John Bovey, University of Kent at Canterbury
<[EMAIL PROTECTED]>
***************
*** 46,51 ****
--- 46,52 ----
#include "rxvt.h" /* NECESSARY */
#include "version.h"
#include "command.h"
+ #include "slipwheel.h"
/*----------------------------------------------------------------------*/
***************
*** 642,647 ****
--- 644,654 ----
return (*r->h->cmdbuf_ptr++);
}
+
+ #ifdef SLIP_WHEELING
+ slip_wheeling_idle(r);
+ #endif /* SLIP_WHEELING */
+
#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
if (scrollbar_isUp()) {
if (!r->h->scroll_arrow_delay-- && rxvt_scr_page(r, UP, 1)) {
***************
*** 674,679 ****
--- 681,688 ----
quick_timeout |= r->h->want_full_refresh;
#endif
}
+ /* fprintf(stderr, "using quckto %d, want ref %d\n",
+ quick_timeout, r->h->want_full_refresh);*/
retval = select(r->num_fds, &readfds, NULL, NULL,
(quick_timeout ? &value : NULL));
***************
*** 829,834 ****
--- 838,846 ----
case KeyPress:
rxvt_lookup_key(r, ev);
break;
+ case KeyRelease:
+ slip_wheeling_accel(r,0);
+ break;
case ClientMessage:
if (ev->xclient.format == 32 && ev->xclient.data.l[0] ==
r->h->wmDeleteWindow)
***************
*** 1256,1261 ****
--- 1268,1274 ----
case Button5:
{
int i, v;
+ int slip_wheel;
i = (ev->xbutton.state & ShiftMask) ? 1 : 5;
v = (ev->xbutton.button == Button4) ? UP : DN;
***************
*** 1270,1275 ****
--- 1284,1295 ----
rxvt_scrollbar_show(r, 1);
}
# endif
+ # ifdef SLIP_WHEELING
+ if(ev->xbutton.state&ControlMask) {
+ int slip_accel = v==UP?1:-1;
+ slip_wheeling_accel(r,slip_accel);
+ }
+ # endif /* SLIP_WHEELING */
}
break;
#endif
diff -c -B -b -N -r rxvt-old/src/init.c rxvt-slip2/src/init.c
*** rxvt-old/src/init.c Tue Sep 19 01:31:43 2000
--- rxvt-slip2/src/init.c Fri Feb 9 00:40:06 2001
***************
*** 1,7 ****
/*--------------------------------*-C-*---------------------------------*
* File: init.c
*----------------------------------------------------------------------*
! * $Id: init.c,v 1.44 2000/09/19 06:31:17 gcw Exp $
*
* All portions of code are copyright by their respective author/s.
* Copyright (C) 1992 John Bovey, University of Kent at Canterbury
<[EMAIL PROTECTED]>
--- 1,7 ----
/*--------------------------------*-C-*---------------------------------*
* File: init.c
*----------------------------------------------------------------------*
! * $Id: init.c 1.2 Fri, 09 Feb 2001 00:40:06 -0500 rahimi $
*
* All portions of code are copyright by their respective author/s.
* Copyright (C) 1992 John Bovey, University of Kent at Canterbury
<[EMAIL PROTECTED]>
***************
*** 163,168 ****
--- 163,169 ----
r->TermWin.ext_bwidth = EXTERNALBORDERWIDTH;
r->TermWin.saveLines = SAVELINES;
r->numPixColors = TOTAL_COLORS;
+ r->TermWin.velocity = 0;
#ifndef NO_NEW_SELECTION
r->selection_style = NEW_SELECT;
#else
***************
*** 906,912 ****
(char **)argv, argc, &r->szHint, &wmHint, &classHint);
XSelectInput(r->Xdisplay, r->TermWin.parent[0],
! (KeyPressMask | FocusChangeMask
| VisibilityChangeMask | StructureNotifyMask));
/* vt cursor: Black-on-White is standard, but this is more popular */
--- 907,913 ----
(char **)argv, argc, &r->szHint, &wmHint, &classHint);
XSelectInput(r->Xdisplay, r->TermWin.parent[0],
! (KeyPressMask | KeyReleaseMask | FocusChangeMask
| VisibilityChangeMask | StructureNotifyMask));
/* vt cursor: Black-on-White is standard, but this is more popular */
diff -c -B -b -N -r rxvt-old/src/init.h rxvt-slip2/src/init.h
*** rxvt-old/src/init.h Sun Apr 16 01:54:35 2000
--- rxvt-slip2/src/init.h Fri Feb 9 00:39:40 2001
***************
*** 1,5 ****
/*
! * $Id: init.h,v 1.4 2000/04/16 06:54:35 gcw Exp $
*/
#ifndef _INIT_H_
--- 1,5 ----
/*
! * $Id: init.h 1.1 Fri, 09 Feb 2001 00:39:40 -0500 rahimi $
*/
#ifndef _INIT_H_
diff -c -B -b -N -r rxvt-old/src/rxvt.h rxvt-slip2/src/rxvt.h
*** rxvt-old/src/rxvt.h Sun Sep 17 00:41:57 2000
--- rxvt-slip2/src/rxvt.h Fri Feb 9 00:40:06 2001
***************
*** 1,5 ****
/*
! * $Id: rxvt.h,v 1.109 2000/09/16 06:25:39 gcw Exp $
*/
#ifndef _RXVT_H_ /* include once only */
--- 1,5 ----
/*
! * $Id: rxvt.h 1.2 Fri, 09 Feb 2001 00:40:06 -0500 rahimi $
*/
#ifndef _RXVT_H_ /* include once only */
***************
*** 187,192 ****
--- 187,195 ----
saveLines; /* number of lines that fit in scrollback */
u_int16_t nscrolled, /* number of line actually scrolled
*/
view_start; /* scrollback view starts here
*/
+ #ifdef SLIP_WHEELING
+ int velocity; /* slip wheel velocity.
*/
+ #endif /* SLIP_WHEEL */
Window parent[KNOW_PARENTS], /* parent[0] is our window */
vt; /* vt100 window */
GC gc; /* GC for drawing text */
***************
*** 947,952 ****
--- 950,958 ----
#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
scroll_arrow_delay,
#endif
+ #ifdef SLIP_WHEELING
+ slip_wheeling_delay,
+ #endif /*SLIP_WHEELING*/
refresh_count,
refresh_limit,
fnum, /* logical font number */
diff -c -B -b -N -r rxvt-old/src/slipwheel.c rxvt-slip2/src/slipwheel.c
*** rxvt-old/src/slipwheel.c Wed Dec 31 19:00:00 1969
--- rxvt-slip2/src/slipwheel.c Thu Feb 8 23:48:23 2001
***************
*** 0 ****
--- 1,39 ----
+ #include "../config.h" /* NECESSARY */
+ #include "rxvt.h"
+ #include "command.h"
+ #include "slipwheel.h"
+
+
+ void
+ slip_wheeling_accel(rxvt_t *r, int accel)
+ {
+ if(accel == 0) {
+ r->TermWin.velocity = 0;
+ } else {
+ r->TermWin.velocity += accel;
+ r->h->want_refresh = 1;
+ }
+
+ r->h->slip_wheeling_delay = SCROLLBAR_CONTINUOUS_DELAY;
+ }
+
+ void
+ slip_wheeling_idle(rxvt_t *r)
+ {
+ int speed = r->TermWin.velocity;
+ int direction = speed>0 ? UP : DN;
+
+ speed = speed<0?-speed:speed;
+
+ if(speed == 0)
+ return;
+
+
+
+ if(!r->h->slip_wheeling_delay-- &&
+ rxvt_scr_page(r, direction, speed)) {
+ r->h->slip_wheeling_delay = SCROLLBAR_CONTINUOUS_DELAY;
+ r->h->refresh_type |= SMOOTH_REFRESH;
+ }
+ r->h->want_refresh = 1;
+ }
diff -c -B -b -N -r rxvt-old/src/slipwheel.h rxvt-slip2/src/slipwheel.h
*** rxvt-old/src/slipwheel.h Wed Dec 31 19:00:00 1969
--- rxvt-slip2/src/slipwheel.h Thu Feb 8 23:07:45 2001
***************
*** 0 ****
--- 1,2 ----
+ void slip_wheeling_idle(rxvt_t *r);
+ void slip_wheeling_set(rxvt_t *r, int state);
diff -c -B -b -N -r rxvt-old/autoconf/configure.in
rxvt-slip2/autoconf/configure.in
*** rxvt-old/autoconf/configure.in Wed Sep 13 02:00:44 2000
--- rxvt-new/autoconf/configure.in Fri Feb 9 02:04:55 2001
***************
*** 1,6 ****
dnl# -*- sh -*-
dnl#
! dnl# $Id: configure.in,v 1.97 2000/09/13 06:57:38 gcw Exp $
dnl#
dnl# Process this file with autoconf to produce a configure script.
dnl#
--- 1,6 ----
dnl# -*- sh -*-
dnl#
! dnl# $Id: configure.in 1.2 Fri, 09 Feb 2001 00:40:06 -0500 rahimi $
dnl#
dnl# Process this file with autoconf to produce a configure script.
dnl#
***************
*** 58,63 ****
--- 58,64 ----
support_lastlog=yes
support_menubar=yes
support_mousewheel=yes
+ support_slipwheeling=yes
support_oldselection=yes
support_utmp=yes
support_wtmp=yes
***************
*** 81,86 ****
--- 82,88 ----
support_lastlog=yes
support_menubar=yes
support_mousewheel=yes
+ support_slipwheeling=yes
support_oldselection=yes
support_utmp=yes
support_wtmp=yes
***************
*** 244,249 ****
--- 246,258 ----
support_mousewheel=$enableval
fi])
+ AC_ARG_ENABLE(slipwheeling,
+ [ --enable-slipwheeling enable accelrating scrolling with ctrl+wheel
*],
+ [if test x$enableval = xyes -o x$enableval = xno; then
+ support_slipwheel=$enableval
+ OBJSLIPWHEELING="slipwheel.o"
+ fi])
+
AC_ARG_ENABLE(old-selection,
[ --enable-old-selection enable v2.20 (& prior) mouse selection style
support*],
[if test x$enableval = xyes -o x$enableval = xno; then
***************
*** 1097,1103 ****
else
AC_DEFINE(NO_STRINGS)
fi
! OBJLIST="command.o init.o $OBJGRAPHICS $OBJGRKELOT $OBJLOGGING main.o
$OBJMENUBAR misc.o netdisp.o screen.o scrollbar.o $OBJSCROLLBAR $OBJSTRINGS
xdefaults.o $OBJXPM"
AC_SUBST(OBJLIST)
LIBOBJLIST=`echo $OBJLIST | sed 's/\.o/.lo/g'`
AC_SUBST(LIBOBJLIST)
--- 1106,1112 ----
else
AC_DEFINE(NO_STRINGS)
fi
! OBJLIST="command.o init.o $OBJGRAPHICS $OBJGRKELOT $OBJLOGGING main.o
$OBJMENUBAR misc.o netdisp.o screen.o scrollbar.o $OBJSCROLLBAR $OBJSTRINGS
$OBJSLIPWHEELING xdefaults.o $OBJXPM"
AC_SUBST(OBJLIST)
LIBOBJLIST=`echo $OBJLIST | sed 's/\.o/.lo/g'`
AC_SUBST(LIBOBJLIST)
***************
*** 1159,1164 ****
--- 1168,1175 ----
echo " scrollbar-next.o: "$HASIT
if test x$support_scroll_xterm = xyes; then HASIT="yes"; else HASIT="no";
fi
echo " scrollbar-xterm.o: "$HASIT
+ if test x$support_slipwheeling = xyes; then HASIT="yes"; else HASIT="no";
fi
+ echo " slipwheel.o: "$HASIT
if test x$OBJSTRINGS != x; then HASIT="yes"; else HASIT="no"; fi
echo " strings.o: "$HASIT
if test x$OBJXPM != x; then HASIT="yes"; else HASIT="no"; fi