Unique Mouse Wheel Events

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Unique Mouse Wheel Events

Sean P. DeNigris
Administrator
 

Cross-posting to Pharo dev, Squeak dev, and Squeak VM lists...

Recently, we discovered on the Pharo dev list that the key combination used to fake wheel events - ctrl + arrowKey - may be a bit too simple. Apparently ctrl+horizontalArrowKey is a standard in-use combo in Linux and Windows, so adding horizontal wheel events broke some users' workflows. So I propose "ctrl + alt + shift + cmd + arrowKey".
The new combo is:

  • very unlikely to be typed
  • backward-compatible with existing Pharo and Squeak images, which only checks that either cmd or ctrl is pressed
  • frees up ctrl + arrow for our Linux/Windows friends

For Pharo, there is:

NB: I changed the combo in the VM for Mac OS and OSX. Are these the only two platforms that fake wheel events? I searched a bit but didn't see similar logic for other platforms...

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Unique Mouse Wheel Events

Bert Freudenberg
 

> On 23.03.2015, at 19:34, DeNigris Sean <[hidden email]> wrote:
>
> Cross-posting to Pharo dev, Squeak dev, and Squeak VM lists...
>
> Recently, we discovered on the Pharo dev list that the key combination used to fake wheel events - ctrl + arrowKey - may be a bit too simple. Apparently ctrl+horizontalArrowKey is a standard in-use combo in Linux and Windows, so adding horizontal wheel events broke some users' workflows. So I propose "ctrl + alt + shift + cmd + arrowKey".
> The new combo is:
>
> • very unlikely to be typed
> • backward-compatible with existing Pharo and Squeak images, which only checks that either cmd or ctrl is pressed
> • frees up ctrl + arrow for our Linux/Windows friends
I'm not quite sure I understand.

It shouldn't matter if ctrl-arrow OS keyboard events have some system-wide binding. E.g. on a Mac, this is the default to switch between desktops.

The mouse wheel does *not* generate an OS keyboard event. We only synthesize a VM keyboard event for the image to consume. So how could that possibly affect anything outside the image?

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 -


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Unique Mouse Wheel Events

Alain Rastoul-2
 
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

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Unique Mouse Wheel Events

Sean P. DeNigris
Administrator
> I had a look at the vm code, I think it could be done for Unix in
> sqUnixX11.c at line 3533:
> ...
> For Windows (not really needed but eventually) quite the same in
> sqWin32Window.c at 266
Okay, I took a first pass...
https://github.com/pharo-project/pharo-vm/pull/73
I have no idea if any of this works because: a) I can't compile it because I'm on a Mac and b) I haven't programmed C in almost 20 years. But it's a start!
Cheers,
Sean