Mantis - tweak
Viewing Issue Advanced Details
38 block always 07-14-04 22:03 08-04-04 04:28
johnmci  
andreas  
normal  
resolved  
fixed  
none    
none  
0000038: Use of option -key in tweak browser windows can cause failure
Three events are generated, keydown, keychar keyup. In this example the option key generates the unicode 8706 (keyup/keydown) for keychar 182 http://www.alanwood.net/demos/charsetdiffs.html. [^]
On the self pressedKeys at: keyValue put: false. we die because 8706 is evil.

CHandPlayer>>sendKeyboardEvent: anEvent
    "Send the event to the costume currently holding the focus, or if none to the owner of the hand."
    | keyValue focus context |
    keyValue := anEvent keyValue.
    focus := self keyboardFocus.
    anEvent isKeyDown ifTrue:[
        self pressedKeys at: keyValue put: true.
        context := focus ifNotNil:[focus world].
        context ifNotNil:[context costume pressedKeys at: keyValue put: true].
    ].
    anEvent isKeyUp ifTrue:[
        self pressedKeys at: keyValue put: false.
        context := focus ifNotNil:[focus world].
        context ifNotNil:[context costume pressedKeys at: keyValue put: false].
    ].
    ^self sendEvent: anEvent focus: self keyboardFocus clear:[self keyboardFocus: nil]
]
Now should
CPrimitiveCostume>>pressedKeys
    self isWorld ifFalse:[^nil].
    ^self propertyValueAt: #pressedKeys ifAbsentPut:[Array new: 256 withAll: false].
 
Become a dictionary? or something else to handle unicode characters correctly?

Also each player get is allocating 256 pointers to true/false to track keyboard state? Would a dictionary save some space (say for 100K players that's 100K of space in the VM eh?). We are only interested in keystate being down, if no entry the default is false

Notes
(0000027)
johnmci   
07-14-04 22:37   
I've a change set for this to change things to a dictionary. However I'm not sure how that impacts current work on formal unicode support.
(0000028)
johnmci   
07-15-04 00:41   
I've a change set for this to change things to a dictionary. However I'm not sure how that impacts current work on formal unicode support.
(0000033)
andreas   
07-21-04 07:42   
John -- since I don't have a Mac available right now, how about you fixing this if possible and sending the fix to me? -- Andreas