[PATCH] wsconsctl mouse.scaling

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[PATCH] wsconsctl mouse.scaling

Ulf pointed out that you could scale the mouse speed with the cryptic:

wsconsctl mouse.param=0:401,1:401

Looking into it more, wsconsctl already has a floating point version
of this that sets both X and Y values, but it only shows up and
functions if you have a touchpad, not a mouse:

wsconsctl mouse.tp.scaling=0.1

Adding another exception to the FLG_DEAD check allow this to work on
the mouse, just the way I wanted.

I added an aliased parameter name so you could just use
"mouse.scaling" instead of specifying something named as a touchpad
variable, which also makes it self documenting when the parms are

It would make sense to remove the tp.scaling name, since this is
generic like the reverse_scrolling line, but there are probably some
people with the tp.scaling line in their current configuration files
that would need to make a change.

I would also suggest that the rawmode and scale parameters be
removed, since we don't want the USB level drivers doing (improper)
scaling before wscons does the proper scaling on it, and seeing the
old scale list in the parameter dump is confusing:


Adding a line about mouse.scaling in the man page would be nice,
but having it show up in the parameter dump now may be sufficient.

Index: mouse.c
RCS file: /cvs/src/sbin/wsconsctl/mouse.c,v
retrieving revision 1.20
diff -u -p -r1.20 mouse.c
--- mouse.c 19 Aug 2019 21:42:33 -0000 1.20
+++ mouse.c 20 May 2020 20:16:51 -0000
@@ -54,6 +54,7 @@ struct field mouse_field_tab[] = {
     { "rawmode", &rawmode, FMT_UINT, FLG_MODIFY|FLG_INIT},
     { "scale", &wmcoords, FMT_SCALE, FLG_MODIFY|FLG_INIT},
     /* mouse and touchpad configuration (mousecfg): */
+    { "scaling", &cfg_scaling, FMT_CFG, FLG_NORDBACK },
     { "reverse_scrolling", &cfg_revscroll, FMT_CFG, FLG_NORDBACK },
     /* touchpad-specific options: */
     { "tp.tapping", &cfg_tapping, FMT_CFG, FLG_NORDBACK },
@@ -95,6 +96,7 @@ mouse_init(int devfd, int devidx) {
  for (f = mouse_field_tab; f->name != NULL; f++)
  if (f->format == FMT_CFG) {
  if (f->valp != &cfg_param
+    && f->valp != &cfg_scaling
     && f->valp != &cfg_revscroll)
  f->flags |= FLG_DEAD;