Index | Thread | Search

From:
Christopher Zimmermann <chrisz@openbsd.org>
Subject:
Re: wsconsctl mouse.tp.scaling is useful for normal mice as well
To:
Ulf Brosziewski <ulf.brosziewski@t-online.de>
Cc:
tech@openbsd.org
Date:
Sat, 21 Sep 2024 19:03:29 +0200

Download raw body.

Thread
Hi Ulf,

thanks for your review.

On Mon, Sep 16, 2024 at 09:45:14PM +0200, Ulf Brosziewski wrote:
>is the additional field really that useful?
>[...]
>Users who want to tweak the pointer speed can also do that by 
>manipulating some X settings.

In case you use the mouse only for X (which I do), you are right. And 
that's what I did until now:
xinput --set-prop "/dev/wsmouse" "Device Accel Constant Deceleration" 2

But since Xorg by default uses merged input from wscons it cannot 
differentiate between different pointing devices and this setting will 
slow the touchpad, too.

>When I wrote that wsconsctl code, I wasn't sure whether the initialization
>magic would work for most or all touchpads, and that's the reason why the
>'scaling' field is in the "mouse.tp.*" group.
>
>Will it be immediately clear to users that a zero value in the new field
>means "uninitialized and ignored" rather than "scaled by 0.0"?  If not, the
>printing routine should replace zero values by 1.0.

Yes.

         value = get_value(field, WSMOUSECFG_DX_SCALE);
+		value = value != 0 ? value : 4096;
		f = (float) value / 4096;
		printf("%.3f", f);
		return;

>The new field and the change of the 'tp.scaling' flags might require an 
>update of the wsmouse man page.

Yes, indeed. I forgot to attach that diff. I simply dropped mention of 
tp.scaling in favour of scaling. And added documentation for 
mouse.reverse_scrolling. Is that fine?

>BTW, it seems that your patch replaces tabs with spaces, and I'd prefer
>to have the mouse.* fields grouped together, rather than mixed with the
>mouse.tp.* fields.

I suspect my mail client mangled the patch. I'll attach it this time.


Christopher
Index: share/man/man4/wsmouse.4
===================================================================
RCS file: /cvs/src/share/man/man4/wsmouse.4,v
retrieving revision 1.23
diff -u -p -r1.23 wsmouse.4
--- share/man/man4/wsmouse.4	2 Jul 2023 21:44:04 -0000	1.23
+++ share/man/man4/wsmouse.4	21 Sep 2024 17:01:33 -0000
@@ -86,6 +86,12 @@ If
 is omitted, commands apply to
 .Pa /dev/wsmouse0 .
 .Bl -tag -width Ds
+.It Cm mouse.reverse_scrolling
+Reverse direction of scrolling.
+.It Cm mouse.scaling
+The value is a scale coefficient that is applied to the relative
+coordinates.
+It determines the base speed of the pointer.
 .It Cm mouse.tp.tapping
 Contacts on the touchpad that are immediately released again can
 be mapped to mouse button clicks.
@@ -110,10 +116,6 @@ until that touch ends
 This feature is supported for some clickpads.
 If enabled, two-finger clicks - with the fingers side by side - generate
 left-button events, and three-finger clicks generate middle-button events.
-.It Cm mouse.tp.scaling
-The value is a scale coefficient that is applied to the relative
-coordinates.
-It determines the base speed of the pointer.
 .It Cm mouse.tp.swapsides
 If this parameter has a non-zero value, the order of software
 button areas is inverted.
Index: sbin/wsconsctl/mouse.c
===================================================================
RCS file: /cvs/src/sbin/wsconsctl/mouse.c,v
retrieving revision 1.21
diff -u -p -r1.21 mouse.c
--- sbin/wsconsctl/mouse.c	2 Jul 2023 21:44:04 -0000	1.21
+++ sbin/wsconsctl/mouse.c	21 Sep 2024 17:01:33 -0000
@@ -58,13 +58,14 @@ struct field mouse_field_tab[] = {
     /* touchpad-specific options: */
     { "tp.tapping",		&cfg_tapping,	FMT_CFG,	FLG_NORDBACK },
     { "tp.mtbuttons",		&cfg_mtbuttons,	FMT_CFG,	FLG_NORDBACK },
-    { "tp.scaling",		&cfg_scaling,	FMT_CFG,	FLG_NORDBACK },
+    { "tp.scaling",		&cfg_scaling,	FMT_CFG,	FLG_NORDBACK | FLG_WRONLY },
     { "tp.swapsides",		&cfg_swapsides,	FMT_CFG,	FLG_NORDBACK },
     { "tp.disable",		&cfg_disable,	FMT_CFG,	FLG_NORDBACK },
     { "tp.edges",		&cfg_edges,	FMT_CFG,	FLG_NORDBACK },
     { "tp.param",		&cfg_param,	FMT_CFG,	FLG_WRONLY },
-    /* Add an alias.  This field is valid for all wsmouse devices. */
+    /* Add aliases.  These fields are valid for all wsmouse devices. */
     { "param",			&cfg_param,	FMT_CFG,	FLG_WRONLY },
+    { "scaling",		&cfg_scaling,	FMT_CFG,	FLG_NORDBACK },
     { NULL }
 };
 
@@ -106,6 +107,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;
 				else