From owner-freebsd-bugs@FreeBSD.ORG Wed Jun 29 03:30:31 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8924D16A41C for ; Wed, 29 Jun 2005 03:30:31 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 54A2F43D55 for ; Wed, 29 Jun 2005 03:30:31 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j5T3UVST019270 for ; Wed, 29 Jun 2005 03:30:31 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j5T3UVxo019269; Wed, 29 Jun 2005 03:30:31 GMT (envelope-from gnats) Resent-Date: Wed, 29 Jun 2005 03:30:31 GMT Resent-Message-Id: <200506290330.j5T3UVxo019269@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Eric Kjeldergaard Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D81DB16A41C for ; Wed, 29 Jun 2005 03:26:56 +0000 (GMT) (envelope-from kjelderg@cerberus.cs.und.nodak.edu) Received: from cerberus.cs.und.nodak.edu (cerberus.cs.und.nodak.edu [134.129.223.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9070243D55 for ; Wed, 29 Jun 2005 03:26:56 +0000 (GMT) (envelope-from kjelderg@cerberus.cs.und.nodak.edu) Received: from cerberus.cs.und.nodak.edu (localhost [127.0.0.1]) by cerberus.cs.und.nodak.edu (8.13.1/8.13.1) with ESMTP id j5T3TYHs016593 for ; Tue, 28 Jun 2005 22:29:34 -0500 (CDT) (envelope-from kjelderg@cerberus.cs.und.nodak.edu) Received: (from kjelderg@localhost) by cerberus.cs.und.nodak.edu (8.13.1/8.13.1/Submit) id j5T3TYrN016592; Tue, 28 Jun 2005 22:29:34 -0500 (CDT) (envelope-from kjelderg) Message-Id: <200506290329.j5T3TYrN016592@cerberus.cs.und.nodak.edu> Date: Tue, 28 Jun 2005 22:29:34 -0500 (CDT) From: Eric Kjeldergaard To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/82762: [patch] adding a virtual horizontal scroll feature to moused X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Eric Kjeldergaard List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 03:30:31 -0000 >Number: 82762 >Category: bin >Synopsis: [patch] adding a virtual horizontal scroll feature to moused >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Jun 29 03:30:28 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Eric Kjeldergaard >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #3: Sat Jun 25 15:01:29 UTC 2005 t oor@:/usr/obj/usr/src/sys/UNINFECTABLE i386 >Description: The attached patch adds a -H option to moused. moused has a -V option. The -V option allows a user to generate "vertical scroll events" by holding the middle button of the mouse and generating Y-Axis movement. Similarly, the -H option allows users to generate "horizontal scroll events" by holding the middle button and generating X-Axis movement. The -V and -H options may be used together or separately. Both options respect the threshold which can be set with the -U option. >How-To-Repeat: >Fix: --- moused.diff begins here --- *** moused.c Wed Apr 13 16:25:45 2005 --- moused.c.horizontal Wed Jun 29 00:26:07 2005 *************** *** 97,106 **** --- 97,107 ---- #define Emulate3Button 0x0002 #define ClearDTR 0x0004 #define ClearRTS 0x0008 #define NoPnP 0x0010 #define VirtualScroll 0x0020 + #define HVirtualScroll 0x0040 #define ID_NONE 0 #define ID_PORT 1 #define ID_IF 2 #define ID_TYPE 4 *************** *** 165,174 **** --- 166,176 ---- #define SCROLL_PREPARE 1 #define SCROLL_SCROLLING 2 static int scroll_state; static int scroll_movement; + static int hscroll_movement; /* local variables */ /* interface (the table must be ordered by MOUSE_IF_XXX in mouse.h) */ static symtab_t rifs[] = { *************** *** 521,531 **** int retry; for (i = 0; i < MOUSE_MAXBUTTON; ++i) mstate[i] = &bstate[i]; ! while ((c = getopt(argc, argv, "3C:DE:F:I:PRS:VU:a:cdfhi:l:m:p:r:st:w:z:")) != -1) switch(c) { case '3': rodent.flags |= Emulate3Button; break; --- 523,533 ---- int retry; for (i = 0; i < MOUSE_MAXBUTTON; ++i) mstate[i] = &bstate[i]; ! while ((c = getopt(argc, argv, "3C:DE:F:HI:PRS:VU:a:cdfhi:l:m:p:r:st:w:z:")) != -1) switch(c) { case '3': rodent.flags |= Emulate3Button; break; *************** *** 686,695 **** --- 688,701 ---- warnx("invalid argument `%s'", optarg); usage(); } break; + case 'H': + rodent.flags |= HVirtualScroll; + break; + case 'I': pidfile = optarg; break; case 'P': *************** *** 991,1001 **** return; } if ((flags = r_protocol(b, &action0)) == 0) continue; ! if (rodent.flags & VirtualScroll) { /* Allow middle button drags to scroll up and down */ if (action0.button == MOUSE_BUTTON2DOWN) { if (scroll_state == SCROLL_NOTSCROLLING) { scroll_state = SCROLL_PREPARE; debug("PREPARING TO SCROLL"); --- 997,1007 ---- return; } if ((flags = r_protocol(b, &action0)) == 0) continue; ! if ((rodent.flags & VirtualScroll) || (rodent.flags & HVirtualScroll)) { /* Allow middle button drags to scroll up and down */ if (action0.button == MOUSE_BUTTON2DOWN) { if (scroll_state == SCROLL_NOTSCROLLING) { scroll_state = SCROLL_PREPARE; debug("PREPARING TO SCROLL"); *************** *** 1051,1061 **** if (flags) { /* handler detected action */ r_map(&action, &action2); debug("activity : buttons 0x%08x dx %d dy %d dz %d", action2.button, action2.dx, action2.dy, action2.dz); ! if (rodent.flags & VirtualScroll) { /* * If *only* the middle button is pressed AND we are moving * the stick/trackpoint/nipple, scroll! */ if (scroll_state == SCROLL_PREPARE) { --- 1057,1067 ---- if (flags) { /* handler detected action */ r_map(&action, &action2); debug("activity : buttons 0x%08x dx %d dy %d dz %d", action2.button, action2.dx, action2.dy, action2.dz); ! if ((rodent.flags & VirtualScroll) || (rodent.flags & HVirtualScroll)) { /* * If *only* the middle button is pressed AND we are moving * the stick/trackpoint/nipple, scroll! */ if (scroll_state == SCROLL_PREPARE) { *************** *** 1063,1084 **** if (action2.dy || action2.dx) scroll_state = SCROLL_SCROLLING; } if (scroll_state == SCROLL_SCROLLING) { scroll_movement += action2.dy; ! debug("SCROLL: %d", scroll_movement); ! if (scroll_movement < -rodent.scrollthreshold) { ! /* Scroll down */ ! action2.dz = -1; ! scroll_movement = 0; ! } ! else if (scroll_movement > rodent.scrollthreshold) { ! /* Scroll up */ ! action2.dz = 1; ! scroll_movement = 0; ! } /* Don't move while scrolling */ action2.dx = action2.dy = 0; } } --- 1069,1106 ---- if (action2.dy || action2.dx) scroll_state = SCROLL_SCROLLING; } if (scroll_state == SCROLL_SCROLLING) { scroll_movement += action2.dy; ! hscroll_movement += action2.dx; ! if (rodent.flags & VirtualScroll) { ! debug("Rodent Flags: %d", rodent.flags); ! debug("SCROLL: %d", scroll_movement); ! if (scroll_movement < -rodent.scrollthreshold) { ! /* Scroll down */ ! action2.dz = -1; ! scroll_movement = 0; ! } ! else if (scroll_movement > rodent.scrollthreshold) { ! /* Scroll up */ ! action2.dz = 1; ! scroll_movement = 0; ! } ! } ! if (rodent.flags & HVirtualScroll) { ! debug("Rodent Flags: %d", rodent.flags); ! debug("HORIZONTAL SCROLL: %d", hscroll_movement); ! if (hscroll_movement < -rodent.scrollthreshold) { ! action2.dz = -2; ! hscroll_movement = 0; ! } ! else if (hscroll_movement > rodent.scrollthreshold) { ! action2.dz = 2; ! hscroll_movement = 0; ! } ! } /* Don't move while scrolling */ action2.dx = action2.dy = 0; } } *************** *** 1156,1166 **** static void usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: moused [-DRcdfs] [-I file] [-F rate] [-r resolution] [-S baudrate]", ! " [-V [-U threshold]] [-a X [,Y]] [-C threshold] [-m N=M] [-w N]", " [-z N] [-t ] [-l level] [-3 [-E timeout]] -p ", " moused [-d] -i -p "); exit(1); } --- 1178,1188 ---- static void usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: moused [-DRcdfs] [-I file] [-F rate] [-r resolution] [-S baudrate]", ! " [-VH [-U threshold]] [-a X [,Y]] [-C threshold] [-m N=M] [-w N]", " [-z N] [-t ] [-l level] [-3 [-E timeout]] -p ", " moused [-d] -i -p "); exit(1); } --- moused.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: