[comp.windows.x] Mouse sensitivity

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (07/22/90)

    The xset command doesn't accept the numerator *and* denominator value for the
    XChangePointerControl() command.

Now it does. :-)

*** /tmp/,RCSt1a00988	Sat Jul 21 14:16:59 1990
--- mit/clients/xset/xset.c	Sat Jul 21 14:08:24 1990
***************
*** 1,5 ****
  /* 
!  * $XConsortium: xset.c,v 1.54 89/12/10 17:40:29 rws Exp $ 
   */
  #include <X11/copyright.h>
  
--- 1,5 ----
  /* 
!  * $XConsortium: xset.c,v 1.55 90/07/21 14:07:37 rws Exp $ 
   */
  #include <X11/copyright.h>
  
***************
*** 6,12 ****
  /* Copyright    Massachusetts Institute of Technology    1985	*/
  
  #ifndef lint
! static char *rcsid_xset_c = "$XConsortium: xset.c,v 1.54 89/12/10 17:40:29 rws Exp $";
  #endif
  
  #include <stdio.h>
--- 6,12 ----
  /* Copyright    Massachusetts Institute of Technology    1985	*/
  
  #ifndef lint
! static char *rcsid_xset_c = "$XConsortium: xset.c,v 1.55 90/07/21 14:07:37 rws Exp $";
  #endif
  
  #include <stdio.h>
***************
*** 54,61 ****
  int acc_num, acc_denom, threshold;
  int key, auto_repeat_mode;
  XKeyboardControl values;
! unsigned long pixels[512];
! caddr_t colors[512];
  int numpixels = 0;
  char *disp = NULL;
  Display *dpy;
--- 54,62 ----
  int acc_num, acc_denom, threshold;
  int key, auto_repeat_mode;
  XKeyboardControl values;
! #define MAX_PIXEL_COUNT 512
! unsigned long pixels[MAX_PIXEL_COUNT];
! caddr_t colors[MAX_PIXEL_COUNT];
  int numpixels = 0;
  char *disp = NULL;
  Display *dpy;
***************
*** 252,258 ****
        i++;
      } 
      else if (*arg >= '0' && *arg <= '9') {
!       acc_num = atoi(arg);  /* Set acceleration to user's tastes.  */
        i++;
        if (i >= argc) {
  	set_mouse(dpy, acc_num, acc_denom, threshold);
--- 253,260 ----
        i++;
      } 
      else if (*arg >= '0' && *arg <= '9') {
!       acc_denom = 1;
!       sscanf(arg, "%d/%d", &acc_num, &acc_denom);
        i++;
        if (i >= argc) {
  	set_mouse(dpy, acc_num, acc_denom, threshold);
***************
*** 264,270 ****
  	i++;
        }
      }
!       set_mouse(dpy, acc_num, acc_denom, threshold);
    } 
    else if (strcmp(arg, "s") == 0) {
      if (i >= argc) {
--- 266,272 ----
  	i++;
        }
      }
!     set_mouse(dpy, acc_num, acc_denom, threshold);
    } 
    else if (strcmp(arg, "s") == 0) {
      if (i >= argc) {
***************
*** 349,354 ****
--- 351,358 ----
      if (i + 1 >= argc)
        usage ("missing argument to p", NULL);
      arg = argv[i];
+     if (numpixels >= MAX_PIXEL_COUNT)
+ 	usage ("more than %d pixels specified", MAX_PIXEL_COUNT);
      if (*arg >= '0' && *arg <= '9')
        pixels[numpixels] = atoi(arg);
      else
***************
*** 661,668 ****
  
  set_pixels(dpy, pixels, colors, numpixels)
  Display *dpy;
! unsigned long pixels[512];
! caddr_t colors[512];
  int numpixels;
  {
    XColor def;
--- 665,672 ----
  
  set_pixels(dpy, pixels, colors, numpixels)
  Display *dpy;
! unsigned long *pixels;
! caddr_t *colors;
  int numpixels;
  {
    XColor def;
***************
*** 796,803 ****
  	values.bell_percent, values.bell_pitch, values.bell_duration);
  
  printf ("Pointer Control:\n");
! printf ("  acceleration:  %d = %d / %d    threshold:  %d\n",
! 	acc_denom != 0 ? (acc_num / acc_denom) : 0,
  	acc_num, acc_denom, threshold);
  
  printf ("Screen Saver:\n");
--- 800,806 ----
  	values.bell_percent, values.bell_pitch, values.bell_duration);
  
  printf ("Pointer Control:\n");
! printf ("  acceleration:  %d/%d    threshold:  %d\n",
  	acc_num, acc_denom, threshold);
  
  printf ("Screen Saver:\n");
***************
*** 881,887 ****
      fprintf (stderr, "\t-led [1-32]         led off\n");
      fprintf (stderr, "\t led [1-32]         led on\n");
      fprintf (stderr, "    To set mouse acceleration and threshold:\n");
!     fprintf (stderr, "\t m [acc [thr]]    m default\n");
      fprintf (stderr, "    To set pixel colors:\n");
      fprintf (stderr, "\t p pixel_value color_name\n");
      fprintf (stderr, "    To turn auto-repeat off or on:\n");
--- 884,890 ----
      fprintf (stderr, "\t-led [1-32]         led off\n");
      fprintf (stderr, "\t led [1-32]         led on\n");
      fprintf (stderr, "    To set mouse acceleration and threshold:\n");
!     fprintf (stderr, "\t m [acc_mult[/acc_div] [thr]]    m default\n");
      fprintf (stderr, "    To set pixel colors:\n");
      fprintf (stderr, "\t p pixel_value color_name\n");
      fprintf (stderr, "    To turn auto-repeat off or on:\n");
***************
*** 891,897 ****
      fprintf (stderr, "\t s [timeout [cycle]]  s default    s on\n");
      fprintf (stderr, "\t s blank              s noblank    s off\n");
      fprintf (stderr, "\t s expose             s noexpose\n");
!     fprintf (stderr, "    For status information:  q   or  query\n");
      exit(0);
  }
  
--- 894,900 ----
      fprintf (stderr, "\t s [timeout [cycle]]  s default    s on\n");
      fprintf (stderr, "\t s blank              s noblank    s off\n");
      fprintf (stderr, "\t s expose             s noexpose\n");
!     fprintf (stderr, "    For status information:  q\n");
      exit(0);
  }
  
*** /tmp/,RCSt1a00993	Sat Jul 21 14:17:23 1990
--- mit/clients/xset/xset.man	Sat Jul 21 14:07:10 1990
***************
*** 9,15 ****
  [-c] [c on/off] [c [\fIvolume\fP]]
  [[-+]fp[-+=] \fIpath\fP[,\fIpath\fP[,...]]] [fp default] [fp rehash]
  [[-]led [\fIinteger\fP]] [led on/off]
! [m[ouse] [\fIacceleration\fP [\fIthreshold\fP]]] [m[ouse] default]
  [p \fIpixel\fP \fIcolor\fP]
  [[-]r] [r on/off]
  [s [\fIlength\fP [\fIperiod\fP]]] [s blank/noblank]
--- 9,15 ----
  [-c] [c on/off] [c [\fIvolume\fP]]
  [[-+]fp[-+=] \fIpath\fP[,\fIpath\fP[,...]]] [fp default] [fp rehash]
  [[-]led [\fIinteger\fP]] [led on/off]
! [m[ouse] [\fIaccel_mult\fP[/\fIaccel_div\fP] [\fIthreshold\fP]]] [m[ouse] default]
  [p \fIpixel\fP \fIcolor\fP]
  [[-]r] [r on/off]
  [s [\fIlength\fP [\fIperiod\fP]]] [s blank/noblank]
***************
*** 112,117 ****
--- 112,119 ----
  .B m
  The \fBm\fP option controls the mouse parameters.
  The parameters for the mouse are `acceleration' and `threshold'.
+ The acceleration can be specified as an integer, or as a simple
+ fraction.
  The mouse, or whatever pointer the machine is connected to,
  will go `acceleration' times as fast when it travels more than `threshold'
  pixels in a short time.  This way, the mouse can be used for precise

rhoward@msd.gatech.edu (Robert L. Howard) (07/24/90)

In article <9007211819.AA01003@expire.lcs.mit.edu> rws@EXPO.LCS.MIT.EDU (Bob Scheifler) writes:
>  The xset command doesn't accept the numerator *and* denominator value for the
>  XChangePointerControl() command.
>
>Now it does. :-)
>
>*** /tmp/,RCSt1a00988	Sat Jul 21 14:16:59 1990
>--- mit/clients/xset/xset.c	Sat Jul 21 14:08:24 1990
>***************
>*** 1,5 ****
[rest of patch deleted]

Is this an 'official patch'?  If I do this do I run the risk of later 
problems?

Thanks
Robert

--
| Robert L. Howard             |    Georgia Tech Research Institute     |
| rhoward@msd.gatech.edu       |    MATD Laboratory                     |
| (404) 528-7165               |    Atlanta, Georgia  30332             |
|     UUCP:   ...!{allegra,amd,hplabs,ut-ngp}!gatech!msd!rhoward        |