Keyboard Event Weirdness
I put the following halt in HandMorph>>#handleEvent: anEvent isKeyboard ifTrue: [Transcript show: anEvent printString, ' keyChar: ', anEvent keyCharacter asString, ' keyValue: ', anEvent keyValue asString; cr]. Then I typed 'hi' in a Workspace and hit Cmd+a. Look at the weird Transcript output... [keyDown ''] keyChar: keyValue: 4 [keystroke 'h'] keyChar: h keyValue: 104 [keyUp ''] keyChar: keyValue: 4 [keyDown ''] keyChar: keyValue: 34 [keystroke 'i'] keyChar: i keyValue: 105 [keyUp ''] keyChar: keyValue: 34 [keyDown '<Cmd->'] keyChar: keyValue: 0 [keystroke '<Cmd-a>'] keyChar: a keyValue: 97 [keyUp '<Cmd->'] keyChar: keyValue: 0 It seems the keyUp/Downs do not have the correct charCode and the keyValue is different than the keystroke for the same key. What's going on here? ----- Cheers, Sean -- View this message in context: http://forum.world.st/Keyboard-Event-Weirdness-tp4737056.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
b.t.w. the position of the events has anInteger for x and aFloat for y. What's up with that? ----- Cheers, Sean -- View this message in context: http://forum.world.st/Keyboard-Event-Weirdness-tp4737056p4737064.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Which platform are you on? --- Philippe Back Dramatic Performance Improvements Mob: +32(0) 478 650 140 | Fax: +32 (0) 70 408 027 Mail:phil@highoctane.be | Web: http://philippeback.eu Blog: http://philippeback.be | Twitter: @philippeback Youtube: http://www.youtube.com/user/philippeback/videos High Octane SPRL rue cour Boisacq 101 | 1301 Bierges | Belgium Pharo Consortium Member - http://consortium.pharo.org/ Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller On Wed, Jan 15, 2014 at 9:30 PM, Sean P. DeNigris <sean@clipperadams.com>wrote:
b.t.w. the position of the events has anInteger for x and aFloat for y. What's up with that?
----- Cheers, Sean -- View this message in context: http://forum.world.st/Keyboard-Event-Weirdness-tp4737056p4737064.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
philippeback wrote
Which platform are you on?
Mac 10.8.5 ----- Cheers, Sean -- View this message in context: http://forum.world.st/Keyboard-Event-Weirdness-tp4737056p4737075.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
In the VM code, all three are generated in sequence by the segment below. So, yes, it is an unholy mess. The real key taken inside Pharo is the macRomanCharacter getting translated in the lookupString thing. The KeyDown and KeyUp events are holding the evt.charCode, whatever this happens to be. The file is sqSqueakOSXApplication+events.m in platforms\iOS\vm\OSX My current machine here is a Win8 box and I am on the move, so, no way to test at the moment. NSString *lookupString = [[NSString alloc] initWithCharacters: &unicode length: 1]; [lookupString getBytes: &macRomanCharacter maxLength: 1 usedLength: NULL encoding: NSMacOSRomanStringEncoding options: 0 range: picker remainingRange: NULL]; [lookupString release]; evt.pressCode = EventKeyDown; unsigned short keyCodeRemembered = evt.charCode; evt.utf32Code = 0; evt.reserved1 = 0; evt.windowIndex = (int)[[mainView windowLogic] windowIndex]; [self pushEventToQueue: (sqInputEvent *)&evt]; evt.charCode = macRomanCharacter; evt.pressCode = EventKeyChar; evt.modifiers = evt.modifiers; evt.utf32Code = unicode; [self pushEventToQueue: (sqInputEvent *) &evt]; if (i > 1 || ![mainView lastSeenKeyBoardStrokeDetails]) { evt.pressCode = EventKeyUp; evt.charCode = keyCodeRemembered; evt.utf32Code = 0; [self pushEventToQueue: (sqInputEvent *) &evt]; } I've attached the file so you can see it in its full glory. It is indeed very peculiar Regards, Phil On Wed, Jan 15, 2014 at 9:53 PM, Sean P. DeNigris <sean@clipperadams.com>wrote:
philippeback wrote
Which platform are you on?
Mac 10.8.5
----- Cheers, Sean -- View this message in context: http://forum.world.st/Keyboard-Event-Weirdness-tp4737056p4737075.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Sean P. DeNigris wrote
It seems the keyUp/Downs do not have the correct charCode and the keyValue is different than the keystroke for the same key. What's going on here?
This still has not been fixed. Any ideas? I sent a message to the VM list... ----- Cheers, Sean -- View this message in context: http://forum.world.st/Keyboard-Event-Weirdness-tp4737056p4808969.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
9 Le 2 mars 2015 21:35, "Sean P. DeNigris" <sean@clipperadams.com> a écrit :
Sean P. DeNigris wrote
It seems the keyUp/Downs do not have the correct charCode and the
keyValue
is different than the keystroke for the same key. What's going on here?
Each platform has its own idea about these events. That is where SDL will be welcome. Phil
This still has not been fixed. Any ideas? I sent a message to the VM
list...
----- Cheers, Sean -- View this message in context:
http://forum.world.st/Keyboard-Event-Weirdness-tp4737056p4808969.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (2)
-
phil@highoctane.be -
Sean P. DeNigris