SqueakJS icon indicating copy to clipboard operation
SqueakJS copied to clipboard

Cannot use mouse wheel to scroll in Squeak 5.3

Open LinqLover opened this issue 5 years ago • 6 comments

System

  • Chrome 83
  • Windows 10
  • Squeak 5.3

Steps to reproduce

  • Open a CodeHolder with a rather long method
  • Click into the text morph
  • Move the mouse wheel

Expected behavior

The text morph is scrolled as if you were using OSVM.

Actual behavior

Nothing happens. The mouse wheel is ignored.

LinqLover avatar Jul 10 '20 14:07 LinqLover

This should be fairly easy to implement. Add a wheel event handler https://github.com/codefrau/SqueakJS/blob/6112298dae73b05d453d7277894669bf31518659/squeak.js#L430 that uses fakeCmdOrCtrlKey() to generate an up/down event (squeak key code 30/31) with the ctrl/cmd modifiers set. Pull requests welcome :)

codefrau avatar Jul 10 '20 18:07 codefrau

This does not sound uninteresting to implement, but I won't be able before August :-)

Hm ... Wouldn't it be more convenient to generate full-featured MouseWheelEvents rather than fake keyboard events?

LinqLover avatar Jul 10 '20 18:07 LinqLover

Modifier-up/down is what older images expect.

I didn't know we changed the VM interface to support actual MouseWheelEvents. Is there documentation for that?

If so, then supporting that would make sense in addition to the keyboard-based scrolling interface.

codefrau avatar Jul 10 '20 20:07 codefrau

The best documentation for this feature I now is "A MouseWheelEvent is xxxxxxxxx." ;-)

Seriously, I've only been following these changes with half an eye, but afaik, @nicolas-cellier-aka-nice improved support for this feature recently. See http://forum.world.st/The-Trunk-Morphic-nice-1616-mcz-td5113016.html, OpenSmalltalk/opensmalltalk-vm#41, and all the nested references. At the moment I don't know further details about it.

LinqLover avatar Jul 10 '20 20:07 LinqLover

This seems relevant:

vmAttribute 48: various properties stored in the image header (that instruct the VM) as an integer encoding an array of bit flags. Bit 0: tells the VM that the image's Process class has threadId as its 5th inst var (after nextLink, suspendedContext, priority & myList) Bit 1: on Cog JIT VMs asks the VM to set the flag bit in interpreted methods Bit 2: if set, preempting a process puts it to the head of its run queue, not the back, i.e. preempting a process by a higher priority one will not cause the preempted process to yield to others at the same priority. Bit 3: in a muilt-threaded VM, if set, the Window system will only be accessed from the first VM thread Bit 4: in a Spur vm, if set, causes weaklings and ephemerons to be queued individually for finalization Bit 5: if set, implies wheel events will be delivered as such and not mapped to arrow key events Bit 6: if set, implies arithmetic primitives will fail if given arguments of different types (float vs int)

Does Squeak look at that flag ever? Does it still support cmd-arrow mouse events?

In any case we should emulate this I guess, and also read/store this word in the image header.

codefrau avatar Aug 11 '21 21:08 codefrau

I implemented wheel handling in 4c19c74f7758259f1469a727483b7a6ee9d29076

I did not implement vm parameter 48 handling yet. It simply defaults to wheel events if on spur.

codefrau avatar Mar 01 '24 07:03 codefrau

appears to work

codefrau avatar May 05 '24 04:05 codefrau