[Vm-dev] Re: [squeak-dev] Unique Mouse Wheel Events

Alain Rastoul alf.mmm.cat at gmail.com
Tue Mar 24 23:02:57 UTC 2015


Le 24/03/2015 14:35, Bert Freudenberg a écrit :

> I'm not against changing how the VM handles scroll events. However, I would like to understand what the actual problem is in the first place.
>
> - Bert -
>
Hi Bert,

(a bit long, sorry).

I don't know is Squeak vm is impacted, it was originally about Pharo,
the source was the same but may be the repos are not the same (?),
but may be Squeak could be interested in that?

The problem is about the current handling for horizontal mouse wheel 
that maps mouse wheel events to Ctrl-Arrow  keyboard events.
Currently the image side detect Ctrl-ArrowUp and Ctrl-ArrowDown and
maps them as Vertical Mouse wheel event (this mapping done at the vm 
level). It works fine.

An attempt was made in Pharo image to detect and handle horizontal mouse 
wheel event the same way (Ctrl-Left Ctrl-Right) and to map
them as MouseWheelEvent in HandMorph class (generateKeyboarEvent:) but 
we lost the ability to use Ctrl-left / Ctrl-right
for editing (jump from word to word).
You could use Alt-left Alt-Right but it gets hard when you want to 
cut/paste along the way
(the switch between Alt and Ctrl keys was prone to editing errors)
It was a pain.

So the question was about the ability to add an extra modifier at the VM 
level
for the generated event, precisely to add ALT and CTRL extra modifiers 
to the generated event
(and handling them correctly in the image of course - in HandMorph class 
first).
This should be a non breaking change for the vm part (correct me if I'm 
wrong).


I had a look at the vm code, I think it could be done for Unix in 
sqUnixX11.c at line 3533:
	    int modifiers= modifierState ^ CtrlKeyBit;
=> Add ALT + CTRL modifiers (xored)

For Windows (not really needed but eventually) quite the same in 
sqWin32Window.c at 266
       evt->modifiers = CtrlKeyBit;
(to check xored or not?)
As stated by MS, at https://msdn.microsoft.com/en-us/library/ms997498.aspx
the horizontal mouse wheel seems to be not really handled:
"...
Horizontal scrolling will not work, or is likely not to work, in the 
following scenarios:

     The application uses custom horizontal scroll bars.
     The application has no horizontal scroll bars.
     The horizontal scroll bar is physically placed in a nonstandard way 
relative to the window it is associated with.
"
As Pharo (squeak too) do not have native widgets , my understanding is 
that it should not work.
=>No problem

For Mac  .... well I don't know mac
but had a look at the source anyway
sqMacUIEvents around l 1912 ?

     if (wheelMouseDelta != 0) {
...
	evt->modifiers = modifierMap[(controlKey >> 8)];
my guess-> the change goes around here ?

May be an interested Mac developer could have a look and try?
(nb I can do the mod build and test for unix and windows not for mac)

(Sean ?)


-- 
Regards,

Alain



More information about the Vm-dev mailing list