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

Gerald Klix cuis.01 at klix.ch
Wed Aug 11 14:07:19 PDT 2021


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
>>
> 
> 


More information about the Cuis-dev mailing list