[Cuis-dev] [RFC] True Mouse Wheel Support

Phil B pbpublist at gmail.com
Thu Aug 12 20:34:39 PDT 2021


Gerald,

It looks fine to me testing on 64-bit Debian 11.  I confirmed that when you
toggle the VM setting on and off the image only receives events from the
appropriate source (i.e. keyboard or mousewheel.)  It is odd that the event
rate of the uncooked events does appear slower.  I would expect it to be
the other way around (i.e. that the cooked keyboard event rate would be
slower.)  I'm assuming that this is a VM thing that probably needs to be
fixed there (i.e. higher resolution scroll events are quite handy for
scrolling long lists, zooming etc)  Nice to finally see those wheel
side-to-side direction events... nice work!

The only question I have is if there's a way to detect the capability and
set the VM parameter automatically on image start?  If so, we could have a
preference as to whether or not it should automatically be set. (I imagine
most would)

Thanks,
Phil

On Thu, Aug 12, 2021 at 4:20 PM Gerald Klix <cuis.01 at klix.ch> wrote:

> Hi all, Hi Phil,
>
> Please find attached a preliminary version of my mouse-wheel support
> code. Please review the coding style and check for any errors.
> I only tested it on Linux 64bit, but will also
> test on Windows tomorrow.
>
> The code needs `Smalltalk sendMouseWheelEvents: true` to be active.
> Vertical scrolling should be smoother/slower,
> horizontal scrolling should work.
>
>
> Have Fun and Best Regards,
>
> Gerald
>
>
>
> On 8/11/21 11:07 PM, Gerald Klix via Cuis-dev wrote:
> > Hoi Phil,
> >
> > On 8/11/21 10:31 PM, Phil B via Cuis-dev wrote:
> >> Gerald,
> >>
> >> I implemented the wheel event support for Cuis anticipating that at some
> >> point in the future we'd be able to get 'uncooked' events from the VM.
> > Cool!
> >> So
> >> if you see a way to get them, by all means please do so.
> > You won't believe it, its dead simple, just copy this SystemDirectory
> > method from Squeak
> >
> > --- snip ---
> > sendMouseWheelEvents: aBoolean
> >      "The Cog VM can be instructed to deliver mouse wheel events as
> > mouse wheel events.
> >       By default mouse wheel events are mapped to arrow events.
> >       This flag persists across snapshots, stored in the image header."
> >
> >      self vmParameterAt: 48 put: ((self vmParameterAt: 48) bitClear: 32)
> > + (aBoolean ifTrue: [32] ifFalse: [0])
> > --- snap ---
> >
> > and send the apropriate message.
> >
> > I verified this behavior by dumping the events with `Sensor test` on a
> > Linux 64-bit VM. The VM sends events of type 7.
> >
> >> It's been a few
> >> years, but the last time I looked the Unix VM didn't have it yet.  IIRC,
> >> only one platform (Windows?) did and *all* VM platforms need to
> >> support it
> >> before you can flip the switch on the functionality.
> >
> > I discovered this feature accidentally, while looking at the X11 code;
> > I wanted all buttons of my trackball supported, some more modifier keys.
> >
> > I now see the problem (vm/platforms):
> >  >>> find -name '*.c'| xargs grep sendWheelEvents
> >
> > yields:
> >
> > ./win32/vm/sqWin32Window.c:extern sqInt sendWheelEvents; /* If true
> > deliver EventTypeMouseWheel else kybd */
> > ./win32/vm/sqWin32Window.c:/* if sendWheelEvents is false this maps
> > wheel events to arrow keys */
> > ./win32/vm/sqWin32Window.c:    if (inputSemaphoreIndex &&
> > sendWheelEvents) {
> > ./win32/vm/sqWin32Window.c:      if (sendWheelEvents) {
> > ./unix/vm-display-X11/sqUnixX11.c:extern sqInt sendWheelEvents; /* If
> > true deliver EventTypeMouseWheel else kybd */
> > ./unix/vm-display-X11/sqUnixX11.c:/* if sendWheelEvents is false this
> > maps wheel events to arrow keys */
> > ./unix/vm-display-X11/sqUnixX11.c:/* if sendWheelEvents is true this
> > determines how much x & y are incremented */
> > ./unix/vm-display-X11/sqUnixX11.c:        if (sendWheelEvents)
> > ./unix/vm-display-fbdev/sqUnixEvdevKeyMouse.c:extern sqInt
> > sendWheelEvents; /* If true deliver EventTypeMouseWheel else kybd */
> > ./unix/vm-display-fbdev/sqUnixEvdevKeyMouse.c:      if (sendWheelEvents)
> {
> >
> >
> > In this case the old code needs to remain for the unsupported OSes.
> >
> > It's now 11pm here, I will look into it tomorrow.
> >
> >
> > Best Regards,
> >
> > Gerald
> >
> >
> >>
> >> Thanks,
> >> Phil
> >>
> >> On Wed, Aug 11, 2021, 3:02 PM Gerald Klix via Cuis-dev <
> >> cuis-dev at lists.cuis.st> wrote:
> >>
> >>> I just noticed that all the events and processing methods are there.
> >>> I searched for '*Wheel*' instead of '*Scroll*'.
> >>>
> >>>
> >>>
> >>> On 8/11/21 8:46 PM, Gerald Klix via Cuis-dev wrote:
> >>>> Hi all, Hi Juan,
> >>>>
> >>>> Is there interest in implementing or porting *true*
> >>>> mouse wheel support for/to Cuis?
> >>>> I mean switching off the up/down-key emulation
> >>>> in the VM and add the necessary event classes
> >>>> and processing methods.
> >>>>
> >>>> Benefits:
> >>>> Mouses with a tilting wheel -- wheel left/right -- will be supported.
> >>>>
> >>>> I would like to see all of the keys my Elecom trackballs
> >>>> provide supported, alas this will require patching the VM.
> >>>> Maybe I will change the VM's X11 code.
> >>>>
> >>>>
> >>>> Best Regards,
> >>>>
> >>>> Gerald
> >>>>
> >>>>
> >>>> Trackball images:
> >>>> https://i.ebayimg.com/images/i/272219997851-0-1/s-l1000.jpg
> >>>> https://i.ebayimg.com/images/g/wWAAAOSwB5Fe5vK-/s-l640.jpg
> >>> --
> >>> Cuis-dev mailing list
> >>> Cuis-dev at lists.cuis.st
> >>> https://lists.cuis.st/mailman/listinfo/cuis-dev
> >>>
> >>
> >>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210812/9bf09d1a/attachment-0001.htm>


More information about the Cuis-dev mailing list