Closed LinqLover closed 4 months ago
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 :)
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?
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.
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.
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.
I implemented wheel handling in 4c19c74f7758259f1469a727483b7a6ee9d29076
I did not implement vm parameter 48 handling yet. It simply defaults to wheel events if on spur.
appears to work
System
Steps to reproduce
Expected behavior
The text morph is scrolled as if you were using OSVM.
Actual behavior
Nothing happens. The mouse wheel is ignored.