MouseWheel events

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

MouseWheel events

Matthieu
Hello everyone,

I have a question about MouseWheel events in Pharo.

On Linux, when I use the wheel of my mouse the event I get in return is an instance of MouseWheelEvent :
" [(606@633) mouseWheel Character arrowDown CTRL 33261828 nil] "

When I press "CTRL + ArrowUp" or "CTRL + ArrowDown" on my keyboard I get the same type of MouseWheelEvent.

On the other side, on Windows XP, when I press "CTRL + ArrowUp" or "CTRL + ArrowDown" on my keyboard I also get a MouseWheelEvent but when I use the wheel of my mouse I get a Keystroke event :
" [keystroke '<Ctrl->'] " with a keyValue of 30 for a mousewheel up and 31 for a mousewheel down.

I am a bit confused about this :

Shouldn't I get a MouseWheel event when i use the wheel and a keystroke when I use CTRL + Arrow ?

Why is it different from Linux to Windows ?

In both cases I used Pharo4 VM + a fresh pharo 4 image.

Thanks,

Matthieu
Reply | Threaded
Open this post in threaded view
|

Re: MouseWheel events

Sean P. DeNigris
Administrator
Matthieu Lacaton wrote
Shouldn't I get a MouseWheel event when i use the wheel and a keystroke
when I use CTRL + Arrow ?
Yes! But the hack that you discovered is what we have :) It's done well for us given it's simplicity. But it's far from ideal. For instance, IIRC the delta is fixed, so scrolling a lot sends a lot of tiny scrolls instead of more appropriately-sized ones. The keystroke-equivalence differences I think are due to the underlying platform - the meta key for Mac is CMD, so that is what's used. I extended the hack recently to get horizontal scrolling, but it's only implemented for the Mac VM (there is not even corresponding code in the image yet, pending Windows/Linux implementation). If you trap the events, you can see that now it's simulating cmd+alt+ctrl+shift+[up/down/left/right].
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: MouseWheel events

Matthieu
Okay, thank you for your answer, but there is one thing I am not sure I understand :

Let's say for example thant I want to create a rectangle on the screen and be able to move it up and down by pressing CTRL + up / down arrow and be able to rotate it with the mouse wheel. Does this mean that on Linux I just can't ?
And does this mean that if I create an application able to react to mouse wheel, I need to code it differently for Windows and for Linux ?

Matthieu

2015-05-06 23:55 GMT+02:00 Sean P. DeNigris <[hidden email]>:
Matthieu Lacaton wrote
> Shouldn't I get a MouseWheel event when i use the wheel and a keystroke
> when I use CTRL + Arrow ?

Yes! But the hack that you discovered is what we have :) It's done well for
us given it's simplicity. But it's far from ideal. For instance, IIRC the
delta is fixed, so scrolling a lot sends a lot of tiny scrolls instead of
more appropriately-sized ones. The keystroke-equivalence differences I think
are due to the underlying platform - the meta key for Mac is CMD, so that is
what's used. I extended the hack recently to get horizontal scrolling, but
it's only implemented for the Mac VM (there is not even corresponding code
in the image yet, pending Windows/Linux implementation). If you trap the
events, you can see that now it's simulating
cmd+alt+ctrl+shift+[up/down/left/right].



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/MouseWheel-events-tp4824839p4824929.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: MouseWheel events

Sean P. DeNigris
Administrator
Matthieu Lacaton wrote
Let's say for example thant I want to create a rectangle on the screen and
be able to move it up and down by pressing CTRL + up / down arrow and be
able to rotate it with the mouse wheel. Does this mean that on Linux I just
can't ?
That is correct by default, but you can always hack the VM if you reeeeally want that behavior. Also, if you just wait a bit, I'm in the process of remapping the wheel simulation shortcuts to be extremely less likely to conflict with actual keyboard events. It is already done for Mac. I wrote the patch for GNU/Linux & Windows, but didn't have machines available when I was testing (the code may take a bit of massaging to compile). The upside is that it's a backward compatible VM change, so you will be able to take advantage of it in any Pharo version that will run on the latest VMs.

Matthieu Lacaton wrote
And does this mean that if I create an application able to react to mouse
wheel, I need to code it differently for Windows and for Linux ?
No, you would code it the same way. In the image, MouseWheelEvents are created regardless of the keyboard event used to simulate them. The only thing different would be the keyboard equivalents.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: MouseWheel events

Matthieu
That is correct by default, but you can always hack the VM if you reeeeally
want that behavior. Also, if you just wait a bit, I'm in the process of
remapping the wheel simulation shortcuts to be extremely less likely to
conflict with actual keyboard events. It is already done for Mac. I wrote
the patch for GNU/Linux & Windows, but didn't have machines available when I
was testing (the code may take a bit of massaging to compile). The upside is
that it's a backward compatible VM change, so you will be able to take
advantage of it in any Pharo version that will run on the latest VMs.

Okay, no problem I'll wait.

No, you would code it the same way. In the image, MouseWheelEvents are
created regardless of the keyboard event used to simulate them. The only
thing different would be the keyboard equivalents.

Okay, I double checked that and in the Pharo 4 version of the VM found on http://pharo.org/download by clicking the big blue "windows" button MouseWheel events are not created on an actual mouse wheel because the charcode returned is 0.
But with the latest VM it works and mousewheel events are indeed created so it is my fault for not using the latest VM :)

Thanks a lot !

2015-05-11 2:34 GMT+02:00 Sean P. DeNigris <[hidden email]>:
Matthieu Lacaton wrote
> Let's say for example thant I want to create a rectangle on the screen and
> be able to move it up and down by pressing CTRL + up / down arrow and be
> able to rotate it with the mouse wheel. Does this mean that on Linux I
> just
> can't ?

That is correct by default, but you can always hack the VM if you reeeeally
want that behavior. Also, if you just wait a bit, I'm in the process of
remapping the wheel simulation shortcuts to be extremely less likely to
conflict with actual keyboard events. It is already done for Mac. I wrote
the patch for GNU/Linux & Windows, but didn't have machines available when I
was testing (the code may take a bit of massaging to compile). The upside is
that it's a backward compatible VM change, so you will be able to take
advantage of it in any Pharo version that will run on the latest VMs.


Matthieu Lacaton wrote
> And does this mean that if I create an application able to react to mouse
> wheel, I need to code it differently for Windows and for Linux ?

No, you would code it the same way. In the image, MouseWheelEvents are
created regardless of the keyboard event used to simulate them. The only
thing different would be the keyboard equivalents.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/MouseWheel-events-tp4824839p4825605.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: MouseWheel events

stepharo
In reply to this post by Sean P. DeNigris
Sean

We are working on SDL based events so we should probably synchronise.
Because mouse wheel should be an event and not simulated.
Merwan is producing touch event.
Stef

Le 11/5/15 02:34, Sean P. DeNigris a écrit :
> Matthieu Lacaton wrote
>> Let's say for example thant I want to create a rectangle on the screen and
>> be able to move it up and down by pressing CTRL + up / down arrow and be
>> able to rotate it with the mouse wheel. Does this mean that on Linux I
>> just
>> can't ?
Mathieu contact Merwan to see if he has support for that.

> That is correct by default, but you can always hack the VM if you reeeeally
> want that behavior. Also, if you just wait a bit, I'm in the process of
> remapping the wheel simulation shortcuts to be extremely less likely to
> conflict with actual keyboard events. It is already done for Mac. I wrote
> the patch for GNU/Linux & Windows, but didn't have machines available when I
> was testing (the code may take a bit of massaging to compile). The upside is
> that it's a backward compatible VM change, so you will be able to take
> advantage of it in any Pharo version that will run on the latest VMs.
>
>
> Matthieu Lacaton wrote
>> And does this mean that if I create an application able to react to mouse
>> wheel, I need to code it differently for Windows and for Linux ?
> No, you would code it the same way. In the image, MouseWheelEvents are
> created regardless of the keyboard event used to simulate them. The only
> thing different would be the keyboard equivalents.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: MouseWheel events

Matthieu
Le 11/5/15 02:34, Sean P. DeNigris a écrit :
Matthieu Lacaton wrote
Let's say for example thant I want to create a rectangle on the screen and
be able to move it up and down by pressing CTRL + up / down arrow and be
able to rotate it with the mouse wheel. Does this mean that on Linux I
just
can't

 Mathieu contact Merwan to see if he has support for that.

With OSWindow events (based on SDL ones) I was able to do so without trouble.
I was just surprised by VM events but no big deal.

2015-05-11 21:32 GMT+02:00 stepharo <[hidden email]>:
Sean

We are working on SDL based events so we should probably synchronise.
Because mouse wheel should be an event and not simulated.
Merwan is producing touch event.
Stef

Le 11/5/15 02:34, Sean P. DeNigris a écrit :
Matthieu Lacaton wrote
Let's say for example thant I want to create a rectangle on the screen and
be able to move it up and down by pressing CTRL + up / down arrow and be
able to rotate it with the mouse wheel. Does this mean that on Linux I
just
can't ?
Mathieu contact Merwan to see if he has support for that.


That is correct by default, but you can always hack the VM if you reeeeally
want that behavior. Also, if you just wait a bit, I'm in the process of
remapping the wheel simulation shortcuts to be extremely less likely to
conflict with actual keyboard events. It is already done for Mac. I wrote
the patch for GNU/Linux & Windows, but didn't have machines available when I
was testing (the code may take a bit of massaging to compile). The upside is
that it's a backward compatible VM change, so you will be able to take
advantage of it in any Pharo version that will run on the latest VMs.


Matthieu Lacaton wrote
And does this mean that if I create an application able to react to mouse
wheel, I need to code it differently for Windows and for Linux ?
No, you would code it the same way. In the image, MouseWheelEvents are
created regardless of the keyboard event used to simulate them. The only
thing different would be the keyboard equivalents.





Reply | Threaded
Open this post in threaded view
|

Re: MouseWheel events

Sean P. DeNigris
Administrator
In reply to this post by stepharo
stepharo wrote
We are working on SDL based events so we should probably synchronise.
Because mouse wheel should be an event and not simulated.
Absolutely! I was just improving the existing hack (mainly because I want horizontal wheel events) until you guys finish something really good :)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: MouseWheel events

Sean P. DeNigris
Administrator
In reply to this post by Matthieu
Matthieu Lacaton wrote
I was just surprised by VM events...
That's understandable. We inherited quite a mess with events, but we've been slowly cleaning and SDL seems exciting!
Cheers,
Sean