Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-16 Thread Dexter Lagan
Yes! Thank you.

Dex


From: Matthew Flatt 
Sent: Friday, April 16, 2021 3:26:19 PM
To: Dexter Lagan 
Cc: Racket Users 
Subject: Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed 
scrolling fix for DrRacket

Oh, I think I finally get it.

The problem is that the leftover amount is returned by `gen-wheels`.
With scaling by `wheel-scale`, the returned leftover has been scaled
--- but when the leftover is passed back to `gen-wheels` later, it gets
scaled again.

Applying the scale to `WHEEL_DELTA` instead of `amt` solves the
problem, because then the returned leftover amount is on the same scale
as the argument amount.

Thanks for working through this, and I'll push this change!

At Fri, 16 Apr 2021 01:23:16 -0700 (PDT), Dexter Lagan wrote:
> Hi Matt,
>
>   This works because when amt is smaller than WHEEL_DELTA, the amt value is
> used directly, see first branch of the cond :
>
> (cond
>  * [((abs amt) . < . WHEEL_DELTA_S)*
>(case wheel-steps-mode
>  [(one integer) amt]
>  [(fraction)
>   (unless (zero? amt)
> (do-key w msg down lParam #f #f void (/ amt
> (exact->inexact WHEEL_DELTA_S
>   0.0])]
>
>   I logged the values with and without the fix. In both cases, I scrolled
> slowly down  :
>
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-8
>
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-40
>
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-168
>
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-48
>
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-200
>
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-80
>
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-332
>
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-92
>
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-376
>
>   Amt is often larger than WHEEL_DELTA. After applying the changes
> (dividing WHEEL-DELTA and removing the wheel-scale mul) :
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-2
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-4
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-6
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-8
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-11
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-13
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-15
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-17
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-19
>
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-22
>
>
> Amt is never above WHEEL_DELTA, which triggers only the first branch of the
> cond. The amt value is used with no adjustment, hense the precise behaviour.
>
> Dex
>
> On Thursday, April 15, 2021 at 1:49:53 PM UTC+2 Matthew Flatt wrote:
>
> > Thanks for this summary! But I remain puzzled...
> >
> > As I understand it, `wheel-scale` ends up being 4 on your machine. So
> > removing the multiplication by `wheel-scale` means that `amt` is 1/4 of
> > what it used to be. But `amt` is effectively always divided by
> > `WHEEL_DELTA`, which you've also divided by 4 in switching to
> > `WHEEL_DELTA_S`.
> >
> > It seems like those factors of 1/4 would cancel out. Do the numbers
> > passed to `do-key` end up being different in some way that I'm missing?
> >
> > Matthew
> >
> > At Mon, 12 Apr 2021 04:13:16 -0700 (PDT), Dexter Lagan wrote:
> > > I started a new thread as the original topic no longer matched.
> > > I installed 8.1.0.2 x64 CS and enabled logging in gen-wheels. Matt was
> > > right: wheel-steps-mode is indeed set to 'integer while gen-wheels runs
> > in
> > > DrRacket's editor. The only two changes required to get smooth/accurate
> > > scrolling on touchpad gestures and trackpoint are therefore:
> > >
> > > In share\pkgs\gui-lib\mred\private\wx\win32\window.rkt's gen-wheels
> > private
> > > method:
> > >
> > > (let loop ([amt (* wheel-scale amt)])
> > > to
> > > (let loop ([amt amt])
> > >
> > > and reduce WHEEL_DELTA by a factor of 4, such as gen-wheels looks like:
> > >
> > > (define/private (gen-wheels w msg lParam amt down up)
> > > (define WHEEL_DELTA_S (/ WHEEL_DELTA 4))
> > > (let loop ([amt amt])
> > > (cond
> > > [((abs amt) . < . WHEEL_DELTA_S)
> > > (case wheel-steps-mode
> > > [(one integer) amt]
> > > [(fraction)
> > > (unless (zero? amt)
> > > (do-key w msg down lParam #f #f void (/ amt (exact->inexact
> > > WHEEL_DELTA_S
> > > 0.0])]
> > > [(negative? a

Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-16 Thread Matthew Flatt
Oh, I think I finally get it.

The problem is that the leftover amount is returned by `gen-wheels`.
With scaling by `wheel-scale`, the returned leftover has been scaled
--- but when the leftover is passed back to `gen-wheels` later, it gets
scaled again.

Applying the scale to `WHEEL_DELTA` instead of `amt` solves the
problem, because then the returned leftover amount is on the same scale
as the argument amount.

Thanks for working through this, and I'll push this change!

At Fri, 16 Apr 2021 01:23:16 -0700 (PDT), Dexter Lagan wrote:
> Hi Matt,
> 
>   This works because when amt is smaller than WHEEL_DELTA, the amt value is 
> used directly, see first branch of the cond :
> 
> (cond
>  * [((abs amt) . < . WHEEL_DELTA_S)*
>(case wheel-steps-mode
>  [(one integer) amt]
>  [(fraction)
>   (unless (zero? amt)
> (do-key w msg down lParam #f #f void (/ amt 
> (exact->inexact WHEEL_DELTA_S
>   0.0])]
> 
>   I logged the values with and without the fix. In both cases, I scrolled 
> slowly down  :
> 
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-8
> 
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-40
> 
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-168
> 
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-48
> 
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-200
> 
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-80
> 
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-332
> 
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-92
> 
> WHEEL_DELTA_S:120
> wheel-scale:4
> amt:-376
> 
>   Amt is often larger than WHEEL_DELTA. After applying the changes 
> (dividing WHEEL-DELTA and removing the wheel-scale mul) :
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-2
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-4
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-6
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-8
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-11
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-13
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-15
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-17
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-19
> 
> WHEEL_DELTA_S:30
> wheel-scale:4
> amt:-22
> 
> 
> Amt is never above WHEEL_DELTA, which triggers only the first branch of the 
> cond. The amt value is used with no adjustment, hense the precise behaviour.
> 
> Dex
> 
> On Thursday, April 15, 2021 at 1:49:53 PM UTC+2 Matthew Flatt wrote:
> 
> > Thanks for this summary! But I remain puzzled...
> >
> > As I understand it, `wheel-scale` ends up being 4 on your machine. So
> > removing the multiplication by `wheel-scale` means that `amt` is 1/4 of
> > what it used to be. But `amt` is effectively always divided by
> > `WHEEL_DELTA`, which you've also divided by 4 in switching to
> > `WHEEL_DELTA_S`.
> >
> > It seems like those factors of 1/4 would cancel out. Do the numbers
> > passed to `do-key` end up being different in some way that I'm missing?
> >
> > Matthew
> >
> > At Mon, 12 Apr 2021 04:13:16 -0700 (PDT), Dexter Lagan wrote:
> > > I started a new thread as the original topic no longer matched.
> > > I installed 8.1.0.2 x64 CS and enabled logging in gen-wheels. Matt was 
> > > right: wheel-steps-mode is indeed set to 'integer while gen-wheels runs 
> > in 
> > > DrRacket's editor. The only two changes required to get smooth/accurate 
> > > scrolling on touchpad gestures and trackpoint are therefore:
> > > 
> > > In share\pkgs\gui-lib\mred\private\wx\win32\window.rkt's gen-wheels 
> > private 
> > > method:
> > > 
> > > (let loop ([amt (* wheel-scale amt)])
> > > to
> > > (let loop ([amt amt])
> > > 
> > > and reduce WHEEL_DELTA by a factor of 4, such as gen-wheels looks like:
> > > 
> > > (define/private (gen-wheels w msg lParam amt down up)
> > > (define WHEEL_DELTA_S (/ WHEEL_DELTA 4))
> > > (let loop ([amt amt])
> > > (cond
> > > [((abs amt) . < . WHEEL_DELTA_S)
> > > (case wheel-steps-mode
> > > [(one integer) amt]
> > > [(fraction)
> > > (unless (zero? amt)
> > > (do-key w msg down lParam #f #f void (/ amt (exact->inexact 
> > > WHEEL_DELTA_S
> > > 0.0])]
> > > [(negative? amt)
> > > (case wheel-steps-mode
> > > [(one)
> > > (do-key w msg down lParam #f #f void 1.0)
> > > (loop (+ amt WHEEL_DELTA_S))]
> > > [(integer)
> > > (define steps (quotient (- amt) WHEEL_DELTA_S))
> > > (do-key w msg down lParam #f #f void (exact->inexact steps))
> > > (loop (+ amt (* steps WHEEL_DELTA_S)))]
> > > [else
> > > (do-key w msg down lParam #f #f void (/ (- amt) (exact->inexact 
> > > WHEEL_DELTA_S)))
> > > 0.0])]
> > > [else
> > > (case wheel-steps-mode
> > > [(one)
> > > (do-key w msg up lParam #f #f void 1.0)
> > > (loop (- amt WHEEL_DELTA_S))]
> > > [(integer)
> > > (define steps (quotient amt WHEEL_DELTA_S))
> > > (do-key w msg up lParam #f #f void (exact->inexact steps))
> > > (loop (- amt (* steps WHEEL_DELTA_S)))]
> > > [else
> > > (do-key w msg up lParam #f #f void (/ amt (exact->inexact 
> > > WHEEL_DELTA_S)))
> > > 0.0])])))
> > > 
> > > Happy Monday,

Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-16 Thread Dexter Lagan
Hi Matt,

  This works because when amt is smaller than WHEEL_DELTA, the amt value is 
used directly, see first branch of the cond :

(cond
 * [((abs amt) . < . WHEEL_DELTA_S)*
   (case wheel-steps-mode
 [(one integer) amt]
 [(fraction)
  (unless (zero? amt)
(do-key w msg down lParam #f #f void (/ amt 
(exact->inexact WHEEL_DELTA_S
  0.0])]

  I logged the values with and without the fix. In both cases, I scrolled 
slowly down  :

WHEEL_DELTA_S:120
wheel-scale:4
amt:-8

WHEEL_DELTA_S:120
wheel-scale:4
amt:-40

WHEEL_DELTA_S:120
wheel-scale:4
amt:-168

WHEEL_DELTA_S:120
wheel-scale:4
amt:-48

WHEEL_DELTA_S:120
wheel-scale:4
amt:-200

WHEEL_DELTA_S:120
wheel-scale:4
amt:-80

WHEEL_DELTA_S:120
wheel-scale:4
amt:-332

WHEEL_DELTA_S:120
wheel-scale:4
amt:-92

WHEEL_DELTA_S:120
wheel-scale:4
amt:-376

  Amt is often larger than WHEEL_DELTA. After applying the changes 
(dividing WHEEL-DELTA and removing the wheel-scale mul) :

WHEEL_DELTA_S:30
wheel-scale:4
amt:-2

WHEEL_DELTA_S:30
wheel-scale:4
amt:-4

WHEEL_DELTA_S:30
wheel-scale:4
amt:-6

WHEEL_DELTA_S:30
wheel-scale:4
amt:-8

WHEEL_DELTA_S:30
wheel-scale:4
amt:-11

WHEEL_DELTA_S:30
wheel-scale:4
amt:-13

WHEEL_DELTA_S:30
wheel-scale:4
amt:-15

WHEEL_DELTA_S:30
wheel-scale:4
amt:-17

WHEEL_DELTA_S:30
wheel-scale:4
amt:-19

WHEEL_DELTA_S:30
wheel-scale:4
amt:-22


Amt is never above WHEEL_DELTA, which triggers only the first branch of the 
cond. The amt value is used with no adjustment, hense the precise behaviour.

Dex

On Thursday, April 15, 2021 at 1:49:53 PM UTC+2 Matthew Flatt wrote:

> Thanks for this summary! But I remain puzzled...
>
> As I understand it, `wheel-scale` ends up being 4 on your machine. So
> removing the multiplication by `wheel-scale` means that `amt` is 1/4 of
> what it used to be. But `amt` is effectively always divided by
> `WHEEL_DELTA`, which you've also divided by 4 in switching to
> `WHEEL_DELTA_S`.
>
> It seems like those factors of 1/4 would cancel out. Do the numbers
> passed to `do-key` end up being different in some way that I'm missing?
>
> Matthew
>
> At Mon, 12 Apr 2021 04:13:16 -0700 (PDT), Dexter Lagan wrote:
> > I started a new thread as the original topic no longer matched.
> > I installed 8.1.0.2 x64 CS and enabled logging in gen-wheels. Matt was 
> > right: wheel-steps-mode is indeed set to 'integer while gen-wheels runs 
> in 
> > DrRacket's editor. The only two changes required to get smooth/accurate 
> > scrolling on touchpad gestures and trackpoint are therefore:
> > 
> > In share\pkgs\gui-lib\mred\private\wx\win32\window.rkt's gen-wheels 
> private 
> > method:
> > 
> > (let loop ([amt (* wheel-scale amt)])
> > to
> > (let loop ([amt amt])
> > 
> > and reduce WHEEL_DELTA by a factor of 4, such as gen-wheels looks like:
> > 
> > (define/private (gen-wheels w msg lParam amt down up)
> > (define WHEEL_DELTA_S (/ WHEEL_DELTA 4))
> > (let loop ([amt amt])
> > (cond
> > [((abs amt) . < . WHEEL_DELTA_S)
> > (case wheel-steps-mode
> > [(one integer) amt]
> > [(fraction)
> > (unless (zero? amt)
> > (do-key w msg down lParam #f #f void (/ amt (exact->inexact 
> > WHEEL_DELTA_S
> > 0.0])]
> > [(negative? amt)
> > (case wheel-steps-mode
> > [(one)
> > (do-key w msg down lParam #f #f void 1.0)
> > (loop (+ amt WHEEL_DELTA_S))]
> > [(integer)
> > (define steps (quotient (- amt) WHEEL_DELTA_S))
> > (do-key w msg down lParam #f #f void (exact->inexact steps))
> > (loop (+ amt (* steps WHEEL_DELTA_S)))]
> > [else
> > (do-key w msg down lParam #f #f void (/ (- amt) (exact->inexact 
> > WHEEL_DELTA_S)))
> > 0.0])]
> > [else
> > (case wheel-steps-mode
> > [(one)
> > (do-key w msg up lParam #f #f void 1.0)
> > (loop (- amt WHEEL_DELTA_S))]
> > [(integer)
> > (define steps (quotient amt WHEEL_DELTA_S))
> > (do-key w msg up lParam #f #f void (exact->inexact steps))
> > (loop (- amt (* steps WHEEL_DELTA_S)))]
> > [else
> > (do-key w msg up lParam #f #f void (/ amt (exact->inexact 
> > WHEEL_DELTA_S)))
> > 0.0])])))
> > 
> > Happy Monday,
> > 
> > Dex
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email 
> > to racket-users...@googlegroups.com.
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/racket-users/28e13460-c86d-4967-aa25-5527d672e
> > 711n%40googlegroups.com.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/c604a711-b12d-4b82-bb17-819f2ab142d0n%40googlegroups.com.


Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-15 Thread Dexter Lagan
I’ll log the values at different spots and let you know what I find. Clearly, 
multiplying amt by wheel-scale affects the scrolling behaviour. Somehow this 
does not affect mouse wheel scrolling une same way. Either the scrolling 
changes when a different device is used, or the device driver itself changes 
the values and/or behaviour.

Dex


From: Matthew Flatt 
Sent: Thursday, April 15, 2021 1:49:49 PM
To: Dexter Lagan 
Cc: Racket Users 
Subject: Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed 
scrolling fix for DrRacket

Thanks for this summary! But I remain puzzled...

As I understand it, `wheel-scale` ends up being 4 on your machine. So
removing the multiplication by `wheel-scale` means that `amt` is 1/4 of
what it used to be. But `amt` is effectively always divided by
`WHEEL_DELTA`, which you've also divided by 4 in switching to
`WHEEL_DELTA_S`.

It seems like those factors of 1/4 would cancel out. Do the numbers
passed to `do-key` end up being different in some way that I'm missing?

Matthew

At Mon, 12 Apr 2021 04:13:16 -0700 (PDT), Dexter Lagan wrote:
>   I started a new thread as the original topic no longer matched.
> I installed 8.1.0.2 x64 CS and enabled logging in gen-wheels. Matt was
> right: wheel-steps-mode is indeed set to 'integer while gen-wheels runs in
> DrRacket's editor. The only two changes required to get smooth/accurate
> scrolling on touchpad gestures and trackpoint are therefore:
>
> In share\pkgs\gui-lib\mred\private\wx\win32\window.rkt's gen-wheels private
> method:
>
> (let loop ([amt (* wheel-scale amt)])
> to
> (let loop ([amt amt])
>
> and reduce WHEEL_DELTA by a factor of 4, such as gen-wheels looks like:
>
>   (define/private (gen-wheels w msg lParam amt down up)
> (define WHEEL_DELTA_S (/ WHEEL_DELTA 4))
> (let loop ([amt amt])
>   (cond
> [((abs amt) . < . WHEEL_DELTA_S)
>  (case wheel-steps-mode
>[(one integer) amt]
>[(fraction)
> (unless (zero? amt)
>   (do-key w msg down lParam #f #f void (/ amt (exact->inexact
> WHEEL_DELTA_S
> 0.0])]
> [(negative? amt)
>  (case wheel-steps-mode
>[(one)
> (do-key w msg down lParam #f #f void 1.0)
> (loop (+ amt WHEEL_DELTA_S))]
>[(integer)
> (define steps (quotient (- amt) WHEEL_DELTA_S))
> (do-key w msg down lParam #f #f void (exact->inexact steps))
> (loop (+ amt (* steps WHEEL_DELTA_S)))]
>[else
> (do-key w msg down lParam #f #f void (/ (- amt) (exact->inexact
> WHEEL_DELTA_S)))
> 0.0])]
> [else
>  (case wheel-steps-mode
>[(one)
> (do-key w msg up lParam #f #f void 1.0)
> (loop (- amt WHEEL_DELTA_S))]
>[(integer)
> (define steps (quotient amt WHEEL_DELTA_S))
> (do-key w msg up lParam #f #f void (exact->inexact steps))
> (loop (- amt (* steps WHEEL_DELTA_S)))]
>[else
> (do-key w msg up lParam #f #f void (/ amt (exact->inexact
> WHEEL_DELTA_S)))
> 0.0])])))
>
> Happy Monday,
>
> Dex
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email
> to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/28e13460-c86d-4967-aa25-5527d672e
> 711n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/DM6PR08MB39467A9EDDE20FDD3161A7EEFC4D9%40DM6PR08MB3946.namprd08.prod.outlook.com.


Re: [racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-15 Thread Matthew Flatt
Thanks for this summary! But I remain puzzled...

As I understand it, `wheel-scale` ends up being 4 on your machine. So
removing the multiplication by `wheel-scale` means that `amt` is 1/4 of
what it used to be. But `amt` is effectively always divided by
`WHEEL_DELTA`, which you've also divided by 4 in switching to
`WHEEL_DELTA_S`.

It seems like those factors of 1/4 would cancel out. Do the numbers
passed to `do-key` end up being different in some way that I'm missing?

Matthew

At Mon, 12 Apr 2021 04:13:16 -0700 (PDT), Dexter Lagan wrote:
>   I started a new thread as the original topic no longer matched.
> I installed 8.1.0.2 x64 CS and enabled logging in gen-wheels. Matt was 
> right: wheel-steps-mode is indeed set to 'integer while gen-wheels runs in 
> DrRacket's editor. The only two changes required to get smooth/accurate 
> scrolling on touchpad gestures and trackpoint are therefore:
> 
> In share\pkgs\gui-lib\mred\private\wx\win32\window.rkt's gen-wheels private 
> method:
> 
> (let loop ([amt (* wheel-scale amt)])
> to
> (let loop ([amt amt])
> 
> and reduce WHEEL_DELTA by a factor of 4, such as gen-wheels looks like:
> 
>   (define/private (gen-wheels w msg lParam amt down up)
> (define WHEEL_DELTA_S (/ WHEEL_DELTA 4))
> (let loop ([amt amt])
>   (cond
> [((abs amt) . < . WHEEL_DELTA_S)
>  (case wheel-steps-mode
>[(one integer) amt]
>[(fraction)
> (unless (zero? amt)
>   (do-key w msg down lParam #f #f void (/ amt (exact->inexact 
> WHEEL_DELTA_S
> 0.0])]
> [(negative? amt)
>  (case wheel-steps-mode
>[(one)
> (do-key w msg down lParam #f #f void 1.0)
> (loop (+ amt WHEEL_DELTA_S))]
>[(integer)
> (define steps (quotient (- amt) WHEEL_DELTA_S))
> (do-key w msg down lParam #f #f void (exact->inexact steps))
> (loop (+ amt (* steps WHEEL_DELTA_S)))]
>[else
> (do-key w msg down lParam #f #f void (/ (- amt) (exact->inexact 
> WHEEL_DELTA_S)))
> 0.0])]
> [else
>  (case wheel-steps-mode
>[(one)
> (do-key w msg up lParam #f #f void 1.0)
> (loop (- amt WHEEL_DELTA_S))]
>[(integer)
> (define steps (quotient amt WHEEL_DELTA_S))
> (do-key w msg up lParam #f #f void (exact->inexact steps))
> (loop (- amt (* steps WHEEL_DELTA_S)))]
>[else
> (do-key w msg up lParam #f #f void (/ amt (exact->inexact 
> WHEEL_DELTA_S)))
> 0.0])])))
> 
> Happy Monday,
> 
> Dex
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email 
> to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/28e13460-c86d-4967-aa25-5527d672e
> 711n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20210415054949.249%40sirmail.smtps.cs.utah.edu.


[racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-12 Thread Dexter Lagan
  I started a new thread as the original topic no longer matched.
I installed 8.1.0.2 x64 CS and enabled logging in gen-wheels. Matt was 
right: wheel-steps-mode is indeed set to 'integer while gen-wheels runs in 
DrRacket's editor. The only two changes required to get smooth/accurate 
scrolling on touchpad gestures and trackpoint are therefore:

In share\pkgs\gui-lib\mred\private\wx\win32\window.rkt's gen-wheels private 
method:

(let loop ([amt (* wheel-scale amt)])
to
(let loop ([amt amt])

and reduce WHEEL_DELTA by a factor of 4, such as gen-wheels looks like:

  (define/private (gen-wheels w msg lParam amt down up)
(define WHEEL_DELTA_S (/ WHEEL_DELTA 4))
(let loop ([amt amt])
  (cond
[((abs amt) . < . WHEEL_DELTA_S)
 (case wheel-steps-mode
   [(one integer) amt]
   [(fraction)
(unless (zero? amt)
  (do-key w msg down lParam #f #f void (/ amt (exact->inexact 
WHEEL_DELTA_S
0.0])]
[(negative? amt)
 (case wheel-steps-mode
   [(one)
(do-key w msg down lParam #f #f void 1.0)
(loop (+ amt WHEEL_DELTA_S))]
   [(integer)
(define steps (quotient (- amt) WHEEL_DELTA_S))
(do-key w msg down lParam #f #f void (exact->inexact steps))
(loop (+ amt (* steps WHEEL_DELTA_S)))]
   [else
(do-key w msg down lParam #f #f void (/ (- amt) (exact->inexact 
WHEEL_DELTA_S)))
0.0])]
[else
 (case wheel-steps-mode
   [(one)
(do-key w msg up lParam #f #f void 1.0)
(loop (- amt WHEEL_DELTA_S))]
   [(integer)
(define steps (quotient amt WHEEL_DELTA_S))
(do-key w msg up lParam #f #f void (exact->inexact steps))
(loop (- amt (* steps WHEEL_DELTA_S)))]
   [else
(do-key w msg up lParam #f #f void (/ amt (exact->inexact 
WHEEL_DELTA_S)))
0.0])])))

Happy Monday,

Dex

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/28e13460-c86d-4967-aa25-5527d672e711n%40googlegroups.com.