SDL2SpecialCharacterMapping problem

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

SDL2SpecialCharacterMapping problem

alvaro piorno
Hi,

Iam having a problem handling some OSKeywordEvents. These events should have character associated.

The mapping is resolved by SDL2SpecialCharacterMapping using a dictionary(Mappings), it has the mapping, for example, for left arrow and right arrow.

It resolve correctly for "left arrow" with key: 1073741904(Integer) , but it does not found "right arrow" with key: 1073741903(Integer).

Both keys are present.
Any idea?

Reply | Threaded
Open this post in threaded view
|

Re: SDL2SpecialCharacterMapping problem

Ben Coman
Hi Alvaro,

This is not an area I've been involved in, but just a general comment...

Can you export a self contained example from your code that can be loaded
into a fresh Image that demonstrate the problem?
Its always easier if people can see the problem with their own eyes.

Also, what version OS/VM/Image are you running?
i.e. World Menu > System > System Reporter

cheers -ben

On 1 April 2018 at 11:45, alvaro piorno <[hidden email]> wrote:
Hi,

Iam having a problem handling some OSKeywordEvents. These events should have character associated.

The mapping is resolved by SDL2SpecialCharacterMapping using a dictionary(Mappings), it has the mapping, for example, for left arrow and right arrow.

It resolve correctly for "left arrow" with key: 1073741904(Integer) , but it does not found "right arrow" with key: 1073741903(Integer).

Both keys are present.
Any idea?


Reply | Threaded
Open this post in threaded view
|

Re: SDL2SpecialCharacterMapping problem

alvaro piorno
Hi Ben,
The thing is that i found that the problem can be reproduced without my code.



The class has a class variable named "Mappings" (photo shows an inspector of it).
There are associations for left and right arrow:
                                - (1073741904 -> arrowLeft)
                                - (1073741903 -> arrowRight)
If i send  "Mappings at: 1073741904" i get "arrowLeft",
but if i send "Mappings at: 1073741903" i get "nil" instead of "arrowRight".

This is done automatically when handling OS events, but as this fails i am not getting associated character for "arrowRight".

Just in case i send you the information you requested.
Thanks

 OS/VM/Image versions:

Operating System/Hardware
-------------------------
unix linux-gnu x86_64

Virtual Machine
---------------
/home/alvaro/Desktop/pharo6.1-64/bin/lib/pharo/5.0-201707201942/pharo
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017
VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $

Unix built on Jul 20 2017 20:40:36 Compiler: 4.6.3
VMMaker versionString VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017

Image
------------
6.1

2018-04-01 19:59 GMT-03:00 Ben Coman <[hidden email]>:
Hi Alvaro,

This is not an area I've been involved in, but just a general comment...

Can you export a self contained example from your code that can be loaded
into a fresh Image that demonstrate the problem?
Its always easier if people can see the problem with their own eyes.

Also, what version OS/VM/Image are you running?
i.e. World Menu > System > System Reporter

cheers -ben

On 1 April 2018 at 11:45, alvaro piorno <[hidden email]> wrote:
Hi,

Iam having a problem handling some OSKeywordEvents. These events should have character associated.

The mapping is resolved by SDL2SpecialCharacterMapping using a dictionary(Mappings), it has the mapping, for example, for left arrow and right arrow.

It resolve correctly for "left arrow" with key: 1073741904(Integer) , but it does not found "right arrow" with key: 1073741903(Integer).

Both keys are present.
Any idea?



Reply | Threaded
Open this post in threaded view
|

Re: SDL2SpecialCharacterMapping problem

EstebanLM
In fact, I have the answer.
But I’m afk, I will answer later, sorry :)

On 18 Apr 2018, at 21:00, alvaro piorno <[hidden email]> wrote:

Hi Ben,
The thing is that i found that the problem can be reproduced without my code.

<asd.png>

The class has a class variable named "Mappings" (photo shows an inspector of it).
There are associations for left and right arrow:
                                - (1073741904 -> arrowLeft)
                                - (1073741903 -> arrowRight)
If i send  "Mappings at: 1073741904" i get "arrowLeft",
but if i send "Mappings at: 1073741903" i get "nil" instead of "arrowRight".

This is done automatically when handling OS events, but as this fails i am not getting associated character for "arrowRight".

Just in case i send you the information you requested.
Thanks

 OS/VM/Image versions:

Operating System/Hardware
-------------------------
unix linux-gnu x86_64

Virtual Machine
---------------
/home/alvaro/Desktop/pharo6.1-64/bin/lib/pharo/5.0-201707201942/pharo
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017
VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $

Unix built on Jul 20 2017 20:40:36 Compiler: 4.6.3
VMMaker versionString VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017

Image
------------
6.1

2018-04-01 19:59 GMT-03:00 Ben Coman <[hidden email]>:
Hi Alvaro,

This is not an area I've been involved in, but just a general comment...

Can you export a self contained example from your code that can be loaded
into a fresh Image that demonstrate the problem?
Its always easier if people can see the problem with their own eyes.

Also, what version OS/VM/Image are you running?
i.e. World Menu > System > System Reporter

cheers -ben

On 1 April 2018 at 11:45, alvaro piorno <[hidden email]> wrote:
Hi,

Iam having a problem handling some OSKeywordEvents. These events should have character associated.

The mapping is resolved by SDL2SpecialCharacterMapping using a dictionary(Mappings), it has the mapping, for example, for left arrow and right arrow.

It resolve correctly for "left arrow" with key: 1073741904(Integer) , but it does not found "right arrow" with key: 1073741903(Integer).

Both keys are present.
Any idea?



Reply | Threaded
Open this post in threaded view
|

Re: SDL2SpecialCharacterMapping problem

alvaro piorno
Ok,
waiting for your answer.
Thnks.

2018-04-18 16:10 GMT-03:00 Esteban Lorenzano <[hidden email]>:
In fact, I have the answer.
But I’m afk, I will answer later, sorry :)

On 18 Apr 2018, at 21:00, alvaro piorno <[hidden email]> wrote:

Hi Ben,
The thing is that i found that the problem can be reproduced without my code.

<asd.png>

The class has a class variable named "Mappings" (photo shows an inspector of it).
There are associations for left and right arrow:
                                - (1073741904 -> arrowLeft)
                                - (1073741903 -> arrowRight)
If i send  "Mappings at: 1073741904" i get "arrowLeft",
but if i send "Mappings at: 1073741903" i get "nil" instead of "arrowRight".

This is done automatically when handling OS events, but as this fails i am not getting associated character for "arrowRight".

Just in case i send you the information you requested.
Thanks

 OS/VM/Image versions:

Operating System/Hardware
-------------------------
unix linux-gnu x86_64

Virtual Machine
---------------
/home/alvaro/Desktop/pharo6.1-64/bin/lib/pharo/5.0-201707201942/pharo
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017
VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $

Unix built on Jul 20 2017 20:40:36 Compiler: 4.6.3
VMMaker versionString VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017

Image
------------
6.1

2018-04-01 19:59 GMT-03:00 Ben Coman <[hidden email]>:
Hi Alvaro,

This is not an area I've been involved in, but just a general comment...

Can you export a self contained example from your code that can be loaded
into a fresh Image that demonstrate the problem?
Its always easier if people can see the problem with their own eyes.

Also, what version OS/VM/Image are you running?
i.e. World Menu > System > System Reporter

cheers -ben

On 1 April 2018 at 11:45, alvaro piorno <[hidden email]> wrote:
Hi,

Iam having a problem handling some OSKeywordEvents. These events should have character associated.

The mapping is resolved by SDL2SpecialCharacterMapping using a dictionary(Mappings), it has the mapping, for example, for left arrow and right arrow.

It resolve correctly for "left arrow" with key: 1073741904(Integer) , but it does not found "right arrow" with key: 1073741903(Integer).

Both keys are present.
Any idea?




Reply | Threaded
Open this post in threaded view
|

Re: SDL2SpecialCharacterMapping problem

EstebanLM
Hi again, 

well, the problem is that 64bit images are translated from a 32bit version and some particular dictionaries need to be rehashed. 

1073741904 is a long integer in 32bit and a small integer in 64bit ;)

If you execute this: 

SDL2Structure allSubclassesDo: #compileFields.
OSWindowMorphicEventHandler initialize.
SDL2SpecialCharacterMapping initialize.

and you will be ok :)

Of course, right fix would be to rehash dictionaries when converting. 
and right-right fix would be to bootstrap also 64bit version instead bootstrap 32bit and then translate. 

but since just a few people uses SDL2 right now, the problem arose recently (in fact, I realised it recently, when I was doing some experiments).

cheers!
Esteban


On 19 Apr 2018, at 00:41, alvaro piorno <[hidden email]> wrote:

Ok,
waiting for your answer.
Thnks.

2018-04-18 16:10 GMT-03:00 Esteban Lorenzano <[hidden email]>:
In fact, I have the answer.
But I’m afk, I will answer later, sorry :)

On 18 Apr 2018, at 21:00, alvaro piorno <[hidden email]> wrote:

Hi Ben,
The thing is that i found that the problem can be reproduced without my code.

<asd.png>

The class has a class variable named "Mappings" (photo shows an inspector of it).
There are associations for left and right arrow:
                                - (1073741904 -> arrowLeft)
                                - (1073741903 -> arrowRight)
If i send  "Mappings at: 1073741904" i get "arrowLeft",
but if i send "Mappings at: 1073741903" i get "nil" instead of "arrowRight".

This is done automatically when handling OS events, but as this fails i am not getting associated character for "arrowRight".

Just in case i send you the information you requested.
Thanks

 OS/VM/Image versions:

Operating System/Hardware
-------------------------
unix linux-gnu x86_64

Virtual Machine
---------------
/home/alvaro/Desktop/pharo6.1-64/bin/lib/pharo/5.0-201707201942/pharo
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017
VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $

Unix built on Jul 20 2017 20:40:36 Compiler: 4.6.3
VMMaker versionString VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017

Image
------------
6.1

2018-04-01 19:59 GMT-03:00 Ben Coman <[hidden email]>:
Hi Alvaro,

This is not an area I've been involved in, but just a general comment...

Can you export a self contained example from your code that can be loaded
into a fresh Image that demonstrate the problem?
Its always easier if people can see the problem with their own eyes.

Also, what version OS/VM/Image are you running?
i.e. World Menu > System > System Reporter

cheers -ben

On 1 April 2018 at 11:45, alvaro piorno <[hidden email]> wrote:
Hi,

Iam having a problem handling some OSKeywordEvents. These events should have character associated.

The mapping is resolved by SDL2SpecialCharacterMapping using a dictionary(Mappings), it has the mapping, for example, for left arrow and right arrow.

It resolve correctly for "left arrow" with key: 1073741904(Integer) , but it does not found "right arrow" with key: 1073741903(Integer).

Both keys are present.
Any idea?





Reply | Threaded
Open this post in threaded view
|

Re: SDL2SpecialCharacterMapping problem

alvaro piorno
Thank you very much

2018-04-19 3:34 GMT-03:00 Esteban Lorenzano <[hidden email]>:
Hi again, 

well, the problem is that 64bit images are translated from a 32bit version and some particular dictionaries need to be rehashed. 

1073741904 is a long integer in 32bit and a small integer in 64bit ;)

If you execute this: 

SDL2Structure allSubclassesDo: #compileFields.
OSWindowMorphicEventHandler initialize.
SDL2SpecialCharacterMapping initialize.

and you will be ok :)

Of course, right fix would be to rehash dictionaries when converting. 
and right-right fix would be to bootstrap also 64bit version instead bootstrap 32bit and then translate. 

but since just a few people uses SDL2 right now, the problem arose recently (in fact, I realised it recently, when I was doing some experiments).

cheers!
Esteban


On 19 Apr 2018, at 00:41, alvaro piorno <[hidden email]> wrote:

Ok,
waiting for your answer.
Thnks.

2018-04-18 16:10 GMT-03:00 Esteban Lorenzano <[hidden email]>:
In fact, I have the answer.
But I’m afk, I will answer later, sorry :)

On 18 Apr 2018, at 21:00, alvaro piorno <[hidden email]> wrote:

Hi Ben,
The thing is that i found that the problem can be reproduced without my code.

<asd.png>

The class has a class variable named "Mappings" (photo shows an inspector of it).
There are associations for left and right arrow:
                                - (1073741904 -> arrowLeft)
                                - (1073741903 -> arrowRight)
If i send  "Mappings at: 1073741904" i get "arrowLeft",
but if i send "Mappings at: 1073741903" i get "nil" instead of "arrowRight".

This is done automatically when handling OS events, but as this fails i am not getting associated character for "arrowRight".

Just in case i send you the information you requested.
Thanks

 OS/VM/Image versions:

Operating System/Hardware
-------------------------
unix linux-gnu x86_64

Virtual Machine
---------------
/home/alvaro/Desktop/pharo6.1-64/bin/lib/pharo/5.0-201707201942/pharo
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017
VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $

Unix built on Jul 20 2017 20:40:36 Compiler: 4.6.3
VMMaker versionString VM: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Thu Jul 20 12:42:21 2017 -0700 $ Plugins: 201707201942 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $
CoInterpreter VMMaker.oscog-eem.2254 uuid: 4f2c2cce-f4a2-469a-93f1-97ed941df0ad Jul 20 2017
StackToRegisterMappingCogit VMMaker.oscog-eem.2252 uuid: 2f3e9b0e-ecd3-4adf-b092-cce2e2587a5c Jul 20 2017

Image
------------
6.1

2018-04-01 19:59 GMT-03:00 Ben Coman <[hidden email]>:
Hi Alvaro,

This is not an area I've been involved in, but just a general comment...

Can you export a self contained example from your code that can be loaded
into a fresh Image that demonstrate the problem?
Its always easier if people can see the problem with their own eyes.

Also, what version OS/VM/Image are you running?
i.e. World Menu > System > System Reporter

cheers -ben

On 1 April 2018 at 11:45, alvaro piorno <[hidden email]> wrote:
Hi,

Iam having a problem handling some OSKeywordEvents. These events should have character associated.

The mapping is resolved by SDL2SpecialCharacterMapping using a dictionary(Mappings), it has the mapping, for example, for left arrow and right arrow.

It resolve correctly for "left arrow" with key: 1073741904(Integer) , but it does not found "right arrow" with key: 1073741903(Integer).

Both keys are present.
Any idea?