Re: wscons: precision scrolling

2019-03-17 Thread joshua stein
On Sun, 17 Mar 2019 at 19:35:17 +0100, Ulf Brosziewski wrote:
> Hi Joshua,
> 
> could you make a test with the updated diff below and check whether
> the scroll speed is normal? (There are no changes in ws, it's just
> the kernel part).

Hi, this version scrolls much better.



Re: wscons: precision scrolling

2019-03-17 Thread Ulf Brosziewski
Hi Joshua,

could you make a test with the updated diff below and check whether
the scroll speed is normal? (There are no changes in ws, it's just
the kernel part).

On 3/16/19 4:16 PM, joshua stein wrote:
> On Thu, 14 Mar 2019 at 00:48:33 +0100, Ulf Brosziewski wrote:
>> Much too fast?  I'm a bit surprised.  In my tests, the new method was
>> generally somewhat slower than the old one (and I haven't changed the
>> "scroll units").  How did you test it?  Which hardware and which applications
>> did you use?
> 
> This is with an imt touchpad:
> 
>ihidev0 at iic1 addr 0x15 irq 109 (polling), vendor 0x4f3 product 
> 0x3056, ELAN2201
>ihidev0: 93 report ids
>imt0 at ihidev0: clickpad, 5 contacts
>wsmouse0 at imt0 mux 0
> 
> I tested with two-finger scrolling in Firefox and Chrome with a new 
> user and fresh browser profiles.  I loaded the same webpages with 
> the old wstpad code and the new, and the two-finger scrolling with 
> the new setup scrolls much too fast for even small finger movements 
> (~0.5").
> 
> A movement with the previous code that would trigger the 
> mousewheel-style scrolling of just a handful of lines causes the new 
> code to scroll nearly an entire screen-height of the page.
> 
> 

Index: dev/wscons/wsconsio.h
===
RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.90
diff -u -p -r1.90 wsconsio.h
--- dev/wscons/wsconsio.h   10 Nov 2018 14:27:51 -  1.90
+++ dev/wscons/wsconsio.h   17 Mar 2019 18:23:14 -
@@ -112,6 +112,12 @@ struct wscons_event {
 #defineWSCONS_EVENT_TOUCH_RESET25  /* (no value) */

 /*
+ * Precision Scrolling
+ */
+#define WSCONS_EVENT_HSCROLL   26  /* dx * 4096 / scroll_unit */
+#define WSCONS_EVENT_VSCROLL   27  /* dy * 4096 / scroll_unit */
+
+/*
  * Keyboard ioctls (0 - 31)
  */

Index: dev/wscons/wsmouse.c
===
RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
retrieving revision 1.51
diff -u -p -r1.51 wsmouse.c
--- dev/wscons/wsmouse.c19 Feb 2019 07:01:02 -  1.51
+++ dev/wscons/wsmouse.c17 Mar 2019 18:23:14 -
@@ -1034,10 +1034,18 @@ wsmouse_motion_sync(struct wsmouseinput
wsmouse_evq_put(evq, DELTA_X_EV(input), dx);
if (dy)
wsmouse_evq_put(evq, DELTA_Y_EV(input), dy);
-   if (motion->dz)
-   wsmouse_evq_put(evq, DELTA_Z_EV, motion->dz);
-   if (motion->dw)
-   wsmouse_evq_put(evq, DELTA_W_EV, motion->dw);
+   if (motion->dz) {
+   if (IS_TOUCHPAD(input))
+   wsmouse_evq_put(evq, VSCROLL_EV, motion->dz);
+   else
+   wsmouse_evq_put(evq, DELTA_Z_EV, motion->dz);
+   }
+   if (motion->dw) {
+   if (IS_TOUCHPAD(input))
+   wsmouse_evq_put(evq, HSCROLL_EV, motion->dw);
+   else
+   wsmouse_evq_put(evq, DELTA_W_EV, motion->dw);
+   }
}
if (motion->sync & SYNC_POSITION) {
if (motion->sync & SYNC_X) {
Index: dev/wscons/wsmouseinput.h
===
RCS file: /cvs/src/sys/dev/wscons/wsmouseinput.h,v
retrieving revision 1.12
diff -u -p -r1.12 wsmouseinput.h
--- dev/wscons/wsmouseinput.h   10 Nov 2018 14:27:51 -  1.12
+++ dev/wscons/wsmouseinput.h   17 Mar 2019 18:23:14 -
@@ -210,6 +210,8 @@ int wstpad_set_param(struct wsmouseinput
 WSCONS_EVENT_MOUSE_ABSOLUTE_X : WSCONS_EVENT_MOUSE_ABSOLUTE_Y)
 #define DELTA_Z_EV WSCONS_EVENT_MOUSE_DELTA_Z
 #define DELTA_W_EV WSCONS_EVENT_MOUSE_DELTA_W
+#define VSCROLL_EV WSCONS_EVENT_VSCROLL
+#define HSCROLL_EV WSCONS_EVENT_HSCROLL
 #define ABS_Z_EV   WSCONS_EVENT_TOUCH_PRESSURE
 #define ABS_W_EV   WSCONS_EVENT_TOUCH_CONTACTS
 #define BTN_DOWN_EVWSCONS_EVENT_MOUSE_DOWN
Index: dev/wscons/wstpad.c
===
RCS file: /cvs/src/sys/dev/wscons/wstpad.c,v
retrieving revision 1.22
diff -u -p -r1.22 wstpad.c
--- dev/wscons/wstpad.c 29 Dec 2018 21:03:58 -  1.22
+++ dev/wscons/wstpad.c 17 Mar 2019 18:23:14 -
@@ -167,8 +167,6 @@ struct wstpad {
u_int mtcycle;
u_int ignore;

-   int dx;
-   int dy;
int contacts;
int prev_contacts;
u_int btns;
@@ -223,12 +221,11 @@ struct wstpad {
} tap;

struct {
-   int acc_dx;
-   int acc_dy;
int dz;
int dw;
int hdist;
int vdist;
+   int mag;
} scroll;
 };

@@ -435,8 +432,8 @@ set_freeze_ts(struct wstpad *tp, int sec


 /* Return 

Re: wscons: precision scrolling

2019-03-16 Thread joshua stein
On Thu, 14 Mar 2019 at 00:48:33 +0100, Ulf Brosziewski wrote:
> Much too fast?  I'm a bit surprised.  In my tests, the new method was
> generally somewhat slower than the old one (and I haven't changed the
> "scroll units").  How did you test it?  Which hardware and which applications
> did you use?

This is with an imt touchpad:

   ihidev0 at iic1 addr 0x15 irq 109 (polling), vendor 0x4f3 product 
0x3056, ELAN2201
   ihidev0: 93 report ids
   imt0 at ihidev0: clickpad, 5 contacts
   wsmouse0 at imt0 mux 0

I tested with two-finger scrolling in Firefox and Chrome with a new 
user and fresh browser profiles.  I loaded the same webpages with 
the old wstpad code and the new, and the two-finger scrolling with 
the new setup scrolls much too fast for even small finger movements 
(~0.5").

A movement with the previous code that would trigger the 
mousewheel-style scrolling of just a handful of lines causes the new 
code to scroll nearly an entire screen-height of the page.



Re: wscons: precision scrolling

2019-03-14 Thread Stefan Sperling
On Thu, Mar 14, 2019 at 01:40:55AM +0100, Ulf Brosziewski wrote:
> Anyway, first we should make sure that the mechanism
> is sound; I'm a bit puzzled by Joshua's report and hope there will be
> more tests.

Your change works well on my x250 and x201.

Compared to my x220, which currently runs the Gnome desktop on 6.4-stable,
I don't notice any difference when scrolling in firefox or in gnome-terminal.

However, on the x250, which also runs Gnome, the difference in scrolling is
rather obvious in Nautilus (Gnome's file manager). The new behaviour feels
a lot nicer. Scrolling of icons in Nautilus is now smooth, and feels rather
choppy in 6.4 by comparison.

On my x201, which runs XFCE, scrolling in XFCE's file manager is still
choppy even with your change. I suppose this means XFCE is not yet using
the new X protocol scrollng methods.

I don't notice any obvious differences in scrolling speed.



Re: wscons: precision scrolling

2019-03-13 Thread Ulf Brosziewski
On 3/13/19 4:49 PM, Martin Pieuchot wrote:
> On 13/03/19(Wed) 00:41, Ulf Brosziewski wrote:
>> The standard method of scrolling in X is tailored to mouse wheels and
>> proceeds in coarse steps.  Wheel events are mapped to button events, and on
>> receiving such an event, an application moves the view of its data by some
>> fixed distance - usually the height of a line of text, or of a couple of
>> lines.
>>
>> Version 2.1 of the X Input Protocol has introduced a more precise
>> alternative.  It defines additional types of motion events.  In essence,
>> their values represent fractions of a complete scroll unit, and newer
>> applications may move their views by distances that are proportional to the
>> event values.  For applications that don't support this, X generates the
>> standard button events whenever the values add up to the complete unit.
>>
>> synaptics(4) supports the newer method since long.
>>
>> The diffs below add the feature to ws and wstpad.  The kernel part defines
>> two new event types in wsconsio.h, and it adapts the scrolling functions of
>> the touchpad input driver.  The xenocara part adds the new "axes" and event
>> handlers to ws.
>>
>> There is a little twist to the implementation.  While synaptics(4)
>> initializes the scroll axes with the scroll distance in device units, the
>> constant 4096 is used in the new ws code, and event values represent the
>> fraction (motion_delta / scroll_unit) in [*.12] fixed-point format.  That
>> way, no queries for the device- and configuration-dependent scroll unit
>> are necessary.
>>
>> The X Input Protocol calls the method "smooth scrolling", but it seems
>> that nowadays, this term is used exclusively for the rendering technique
>> that displays a little animation when the document position changes, so
>> "precision scrolling" might be a better choice.
>>
>> Tests, comments, and OKs would be welcome.
> 
> I like it.  Implementation is nice.  I find the *_EV defines confusing.
> Why not use the WSCONS_* defines directly, it would make easier for the
> reader to find which code generates which event in a single grep.  But
> that's not new ;)

Some of the WSCONS_EVENT_* names are very long, and too many capital
letters in a C function can make me nervous ;-)  Initially, I thought
that more *_EV definitions would become macros.

> 
> Do you know if it would make sense to get rid of the standard scrolling
> method?  Could we generate such events for all input devices?  Does
> other X drivers do that already or plan to do it?
>

I wouldn't know of any obstacle, at least, but I haven't checked that.
Whether the kernel sends a DELTA_Z event or a VSCROLL event with a
multiple of the base unit shouldn't make a difference in the outcome.
It might even be possible to apply an acceleration scheme to wheel
input (I believe Mac OS does that), but I have no idea whether that
would be useful.  Anyway, first we should make sure that the mechanism
is sound; I'm a bit puzzled by Joshua's report and hope there will be
more tests.

>> Index: dev/wscons/wsconsio.h
>> ===
>> RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
>> retrieving revision 1.90
>> diff -u -p -r1.90 wsconsio.h
>> --- dev/wscons/wsconsio.h10 Nov 2018 14:27:51 -  1.90
>> +++ dev/wscons/wsconsio.h12 Mar 2019 21:55:11 -
>> @@ -112,6 +112,12 @@ struct wscons_event {
>>  #define WSCONS_EVENT_TOUCH_RESET25  /* (no value) */
>>
>>  /*
>> + * Precision Scrolling
>> + */
>> +#define WSCONS_EVENT_HSCROLL26  /* dx * 4096 / 
>> scroll_unit */
>> +#define WSCONS_EVENT_VSCROLL27  /* dy * 4096 / 
>> scroll_unit */
>> +
>> +/*
>>   * Keyboard ioctls (0 - 31)
>>   */
>>
>> Index: dev/wscons/wsmouse.c
>> ===
>> RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
>> retrieving revision 1.51
>> diff -u -p -r1.51 wsmouse.c
>> --- dev/wscons/wsmouse.c 19 Feb 2019 07:01:02 -  1.51
>> +++ dev/wscons/wsmouse.c 12 Mar 2019 21:55:11 -
>> @@ -1034,10 +1034,18 @@ wsmouse_motion_sync(struct wsmouseinput
>>  wsmouse_evq_put(evq, DELTA_X_EV(input), dx);
>>  if (dy)
>>  wsmouse_evq_put(evq, DELTA_Y_EV(input), dy);
>> -if (motion->dz)
>> -wsmouse_evq_put(evq, DELTA_Z_EV, motion->dz);
>> -if (motion->dw)
>> -wsmouse_evq_put(evq, DELTA_W_EV, motion->dw);
>> +if (motion->dz) {
>> +if (IS_TOUCHPAD(input))
>> +wsmouse_evq_put(evq, VSCROLL_EV, motion->dz);
>> +else
>> +wsmouse_evq_put(evq, DELTA_Z_EV, motion->dz);
>> +}
>> +if (motion->dw) {
>> +if (IS_TOUCHPAD(input))
>> +wsmouse_evq_put(evq, HSCROLL_EV, motion->dw);
>> + 

Re: wscons: precision scrolling

2019-03-13 Thread Ulf Brosziewski
On 3/13/19 5:27 PM, joshua stein wrote:
> On Wed, 13 Mar 2019 at 00:41:12 +0100, Ulf Brosziewski wrote:
>> The standard method of scrolling in X is tailored to mouse wheels and
>> proceeds in coarse steps.  Wheel events are mapped to button events, and on
>> receiving such an event, an application moves the view of its data by some
>> fixed distance - usually the height of a line of text, or of a couple of
>> lines.
>>
>> Version 2.1 of the X Input Protocol has introduced a more precise
>> alternative.  It defines additional types of motion events.  In essence,
>> their values represent fractions of a complete scroll unit, and newer
>> applications may move their views by distances that are proportional to the
>> event values.  For applications that don't support this, X generates the
>> standard button events whenever the values add up to the complete unit.
>>
>> synaptics(4) supports the newer method since long.
>>
>> The diffs below add the feature to ws and wstpad.  The kernel part defines
>> two new event types in wsconsio.h, and it adapts the scrolling functions of
>> the touchpad input driver.  The xenocara part adds the new "axes" and event
>> handlers to ws.
>>
>> There is a little twist to the implementation.  While synaptics(4)
>> initializes the scroll axes with the scroll distance in device units, the
>> constant 4096 is used in the new ws code, and event values represent the
>> fraction (motion_delta / scroll_unit) in [*.12] fixed-point format.  That
>> way, no queries for the device- and configuration-dependent scroll unit
>> are necessary.
>>
>> The X Input Protocol calls the method "smooth scrolling", but it seems
>> that nowadays, this term is used exclusively for the rendering technique
>> that displays a little animation when the document position changes, so
>> "precision scrolling" might be a better choice.
>>
>> Tests, comments, and OKs would be welcome.
> 
> Well done!  It works on my touchpad and retains the old "chunky" 
> style scrolling from the mouse wheel on my external mouse.
> 
> My only quibble is that this new style scrolling seems much too fast 
> by default with the default X and wscons mouse acceleration 
> settings.
> 
> 
Much too fast?  I'm a bit surprised.  In my tests, the new method was
generally somewhat slower than the old one (and I haven't changed the
"scroll units").  How did you test it?  Which hardware and which applications
did you use?



Re: wscons: precision scrolling

2019-03-13 Thread joshua stein
On Wed, 13 Mar 2019 at 00:41:12 +0100, Ulf Brosziewski wrote:
> The standard method of scrolling in X is tailored to mouse wheels and
> proceeds in coarse steps.  Wheel events are mapped to button events, and on
> receiving such an event, an application moves the view of its data by some
> fixed distance - usually the height of a line of text, or of a couple of
> lines.
> 
> Version 2.1 of the X Input Protocol has introduced a more precise
> alternative.  It defines additional types of motion events.  In essence,
> their values represent fractions of a complete scroll unit, and newer
> applications may move their views by distances that are proportional to the
> event values.  For applications that don't support this, X generates the
> standard button events whenever the values add up to the complete unit.
> 
> synaptics(4) supports the newer method since long.
> 
> The diffs below add the feature to ws and wstpad.  The kernel part defines
> two new event types in wsconsio.h, and it adapts the scrolling functions of
> the touchpad input driver.  The xenocara part adds the new "axes" and event
> handlers to ws.
> 
> There is a little twist to the implementation.  While synaptics(4)
> initializes the scroll axes with the scroll distance in device units, the
> constant 4096 is used in the new ws code, and event values represent the
> fraction (motion_delta / scroll_unit) in [*.12] fixed-point format.  That
> way, no queries for the device- and configuration-dependent scroll unit
> are necessary.
> 
> The X Input Protocol calls the method "smooth scrolling", but it seems
> that nowadays, this term is used exclusively for the rendering technique
> that displays a little animation when the document position changes, so
> "precision scrolling" might be a better choice.
> 
> Tests, comments, and OKs would be welcome.

Well done!  It works on my touchpad and retains the old "chunky" 
style scrolling from the mouse wheel on my external mouse.

My only quibble is that this new style scrolling seems much too fast 
by default with the default X and wscons mouse acceleration 
settings.



Re: wscons: precision scrolling

2019-03-13 Thread Martin Pieuchot
On 13/03/19(Wed) 00:41, Ulf Brosziewski wrote:
> The standard method of scrolling in X is tailored to mouse wheels and
> proceeds in coarse steps.  Wheel events are mapped to button events, and on
> receiving such an event, an application moves the view of its data by some
> fixed distance - usually the height of a line of text, or of a couple of
> lines.
> 
> Version 2.1 of the X Input Protocol has introduced a more precise
> alternative.  It defines additional types of motion events.  In essence,
> their values represent fractions of a complete scroll unit, and newer
> applications may move their views by distances that are proportional to the
> event values.  For applications that don't support this, X generates the
> standard button events whenever the values add up to the complete unit.
> 
> synaptics(4) supports the newer method since long.
> 
> The diffs below add the feature to ws and wstpad.  The kernel part defines
> two new event types in wsconsio.h, and it adapts the scrolling functions of
> the touchpad input driver.  The xenocara part adds the new "axes" and event
> handlers to ws.
> 
> There is a little twist to the implementation.  While synaptics(4)
> initializes the scroll axes with the scroll distance in device units, the
> constant 4096 is used in the new ws code, and event values represent the
> fraction (motion_delta / scroll_unit) in [*.12] fixed-point format.  That
> way, no queries for the device- and configuration-dependent scroll unit
> are necessary.
> 
> The X Input Protocol calls the method "smooth scrolling", but it seems
> that nowadays, this term is used exclusively for the rendering technique
> that displays a little animation when the document position changes, so
> "precision scrolling" might be a better choice.
> 
> Tests, comments, and OKs would be welcome.

I like it.  Implementation is nice.  I find the *_EV defines confusing.
Why not use the WSCONS_* defines directly, it would make easier for the
reader to find which code generates which event in a single grep.  But
that's not new ;)

Do you know if it would make sense to get rid of the standard scrolling
method?  Could we generate such events for all input devices?  Does
other X drivers do that already or plan to do it?

> Index: dev/wscons/wsconsio.h
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
> retrieving revision 1.90
> diff -u -p -r1.90 wsconsio.h
> --- dev/wscons/wsconsio.h 10 Nov 2018 14:27:51 -  1.90
> +++ dev/wscons/wsconsio.h 12 Mar 2019 21:55:11 -
> @@ -112,6 +112,12 @@ struct wscons_event {
>  #define  WSCONS_EVENT_TOUCH_RESET25  /* (no value) */
> 
>  /*
> + * Precision Scrolling
> + */
> +#define WSCONS_EVENT_HSCROLL 26  /* dx * 4096 / scroll_unit */
> +#define WSCONS_EVENT_VSCROLL 27  /* dy * 4096 / scroll_unit */
> +
> +/*
>   * Keyboard ioctls (0 - 31)
>   */
> 
> Index: dev/wscons/wsmouse.c
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
> retrieving revision 1.51
> diff -u -p -r1.51 wsmouse.c
> --- dev/wscons/wsmouse.c  19 Feb 2019 07:01:02 -  1.51
> +++ dev/wscons/wsmouse.c  12 Mar 2019 21:55:11 -
> @@ -1034,10 +1034,18 @@ wsmouse_motion_sync(struct wsmouseinput
>   wsmouse_evq_put(evq, DELTA_X_EV(input), dx);
>   if (dy)
>   wsmouse_evq_put(evq, DELTA_Y_EV(input), dy);
> - if (motion->dz)
> - wsmouse_evq_put(evq, DELTA_Z_EV, motion->dz);
> - if (motion->dw)
> - wsmouse_evq_put(evq, DELTA_W_EV, motion->dw);
> + if (motion->dz) {
> + if (IS_TOUCHPAD(input))
> + wsmouse_evq_put(evq, VSCROLL_EV, motion->dz);
> + else
> + wsmouse_evq_put(evq, DELTA_Z_EV, motion->dz);
> + }
> + if (motion->dw) {
> + if (IS_TOUCHPAD(input))
> + wsmouse_evq_put(evq, HSCROLL_EV, motion->dw);
> + else
> + wsmouse_evq_put(evq, DELTA_W_EV, motion->dw);
> + }
>   }
>   if (motion->sync & SYNC_POSITION) {
>   if (motion->sync & SYNC_X) {
> Index: dev/wscons/wsmouseinput.h
> ===
> RCS file: /cvs/src/sys/dev/wscons/wsmouseinput.h,v
> retrieving revision 1.12
> diff -u -p -r1.12 wsmouseinput.h
> --- dev/wscons/wsmouseinput.h 10 Nov 2018 14:27:51 -  1.12
> +++ dev/wscons/wsmouseinput.h 12 Mar 2019 21:55:12 -
> @@ -210,6 +210,8 @@ int wstpad_set_param(struct wsmouseinput
>  WSCONS_EVENT_MOUSE_ABSOLUTE_X : WSCONS_EVENT_MOUSE_ABSOLUTE_Y)
>  #define DELTA_Z_EV   WSCONS_EVENT_MOUSE_DELTA_Z
>  #define DELTA_W_EV   WSCONS_EVENT_MOUSE_DELTA_W
> +#define VSCROLL_EV   

wscons: precision scrolling

2019-03-12 Thread Ulf Brosziewski
The standard method of scrolling in X is tailored to mouse wheels and
proceeds in coarse steps.  Wheel events are mapped to button events, and on
receiving such an event, an application moves the view of its data by some
fixed distance - usually the height of a line of text, or of a couple of
lines.

Version 2.1 of the X Input Protocol has introduced a more precise
alternative.  It defines additional types of motion events.  In essence,
their values represent fractions of a complete scroll unit, and newer
applications may move their views by distances that are proportional to the
event values.  For applications that don't support this, X generates the
standard button events whenever the values add up to the complete unit.

synaptics(4) supports the newer method since long.

The diffs below add the feature to ws and wstpad.  The kernel part defines
two new event types in wsconsio.h, and it adapts the scrolling functions of
the touchpad input driver.  The xenocara part adds the new "axes" and event
handlers to ws.

There is a little twist to the implementation.  While synaptics(4)
initializes the scroll axes with the scroll distance in device units, the
constant 4096 is used in the new ws code, and event values represent the
fraction (motion_delta / scroll_unit) in [*.12] fixed-point format.  That
way, no queries for the device- and configuration-dependent scroll unit
are necessary.

The X Input Protocol calls the method "smooth scrolling", but it seems
that nowadays, this term is used exclusively for the rendering technique
that displays a little animation when the document position changes, so
"precision scrolling" might be a better choice.

Tests, comments, and OKs would be welcome.


Index: dev/wscons/wsconsio.h
===
RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.90
diff -u -p -r1.90 wsconsio.h
--- dev/wscons/wsconsio.h   10 Nov 2018 14:27:51 -  1.90
+++ dev/wscons/wsconsio.h   12 Mar 2019 21:55:11 -
@@ -112,6 +112,12 @@ struct wscons_event {
 #defineWSCONS_EVENT_TOUCH_RESET25  /* (no value) */

 /*
+ * Precision Scrolling
+ */
+#define WSCONS_EVENT_HSCROLL   26  /* dx * 4096 / scroll_unit */
+#define WSCONS_EVENT_VSCROLL   27  /* dy * 4096 / scroll_unit */
+
+/*
  * Keyboard ioctls (0 - 31)
  */

Index: dev/wscons/wsmouse.c
===
RCS file: /cvs/src/sys/dev/wscons/wsmouse.c,v
retrieving revision 1.51
diff -u -p -r1.51 wsmouse.c
--- dev/wscons/wsmouse.c19 Feb 2019 07:01:02 -  1.51
+++ dev/wscons/wsmouse.c12 Mar 2019 21:55:11 -
@@ -1034,10 +1034,18 @@ wsmouse_motion_sync(struct wsmouseinput
wsmouse_evq_put(evq, DELTA_X_EV(input), dx);
if (dy)
wsmouse_evq_put(evq, DELTA_Y_EV(input), dy);
-   if (motion->dz)
-   wsmouse_evq_put(evq, DELTA_Z_EV, motion->dz);
-   if (motion->dw)
-   wsmouse_evq_put(evq, DELTA_W_EV, motion->dw);
+   if (motion->dz) {
+   if (IS_TOUCHPAD(input))
+   wsmouse_evq_put(evq, VSCROLL_EV, motion->dz);
+   else
+   wsmouse_evq_put(evq, DELTA_Z_EV, motion->dz);
+   }
+   if (motion->dw) {
+   if (IS_TOUCHPAD(input))
+   wsmouse_evq_put(evq, HSCROLL_EV, motion->dw);
+   else
+   wsmouse_evq_put(evq, DELTA_W_EV, motion->dw);
+   }
}
if (motion->sync & SYNC_POSITION) {
if (motion->sync & SYNC_X) {
Index: dev/wscons/wsmouseinput.h
===
RCS file: /cvs/src/sys/dev/wscons/wsmouseinput.h,v
retrieving revision 1.12
diff -u -p -r1.12 wsmouseinput.h
--- dev/wscons/wsmouseinput.h   10 Nov 2018 14:27:51 -  1.12
+++ dev/wscons/wsmouseinput.h   12 Mar 2019 21:55:12 -
@@ -210,6 +210,8 @@ int wstpad_set_param(struct wsmouseinput
 WSCONS_EVENT_MOUSE_ABSOLUTE_X : WSCONS_EVENT_MOUSE_ABSOLUTE_Y)
 #define DELTA_Z_EV WSCONS_EVENT_MOUSE_DELTA_Z
 #define DELTA_W_EV WSCONS_EVENT_MOUSE_DELTA_W
+#define VSCROLL_EV WSCONS_EVENT_VSCROLL
+#define HSCROLL_EV WSCONS_EVENT_HSCROLL
 #define ABS_Z_EV   WSCONS_EVENT_TOUCH_PRESSURE
 #define ABS_W_EV   WSCONS_EVENT_TOUCH_CONTACTS
 #define BTN_DOWN_EVWSCONS_EVENT_MOUSE_DOWN
Index: dev/wscons/wstpad.c
===
RCS file: /cvs/src/sys/dev/wscons/wstpad.c,v
retrieving revision 1.22
diff -u -p -r1.22 wstpad.c
--- dev/wscons/wstpad.c 29 Dec 2018 21:03:58 -  1.22
+++ dev/wscons/wstpad.c 12 Mar 2019 21:55:12 -
@@ -167,8 +167,6 @@ struct wstpad {
u_int mtcycle;
u_int