A PRERELEASE version of SDL 1.2.12 is now available:
Did you take time to look into the international keyboard composition
patch I gave you?
This is the current modification I have in my QZ_DoKey()
if (SDL_TranslateUNICODE) {
if(state == SDL_PRESSED) {
NSRect r = NSMakeRect(0.0, 0.0, 0.0, 0.0);
NSText *fieldEditor = [[NSTextView alloc] initWithFrame:r];
[fieldEditor interpretKeyEvents:[NSArray arrayWithObject:event]];
}
chars = [ event characters ];
numChars = [ chars length ];
} else {
numChars = 0;
}
I hope that this snippet was only meant to higlight the “spirit” of
your
patch, (wherever one might get the real thing), as it does two bad
things:
(a) it creates a NSTextView on every keypress (slow), and (b) leaks a
NSTextView upon each key press.
Of course, as I stated in earlier mail, it has to be cached
somewhere, but I lack enough knowledge in SDL to find the correct
spot. This is why I did NOT provide a patch (eg: .diff) but only this
snippset as a proposal.
Besides that, though, I fail to see the point – it seems to do
nothing?
I.e. I see what it is meant for (support for so-called “dead
keys”), but I
fail to see how it achieves that goal? Could you explain the rationale
behind this change?
It’s simple, the NSText will interpret the key event, thus providing
correct composition.
Without this code, if I press (let’s say on US keyboard) alt+e then
e, I got two events, one with empty [ event characters ] and the
second with “e” as [ event characters ]. (of course, I don’t count
the alt keypress)
With that code, the first event is still empty [ event characters ],
but the second contains, after the NSText processed it, “?”.
Hope I was clear.
RegardsOn 9 Jul 2007, at 2:47 PM, Max Horn wrote:
On Mo, Juli 9, 2007 14:29, Kuon wrote:
On 8 Jul 2007, at 11:58 PM, Sam Lantinga wrote:
–
Kuon
"Don’t press that button."
http://goyman.com/
Blog: http://kuon.goyman.com/