lacasanova / shortcutrecorder

Automatically exported from code.google.com/p/shortcutrecorder
0 stars 0 forks source link

Invalid modifier bitmask passed to UCKeyTranslate #35

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
There is a bug in SRCommon.m's 
|SRCharacterForKeyCodeAndCocoaFlags()|. I don't know what this function 
is used for, so I don't know if this is an actual problem, but here goes:

The function contains the following code:

    if (cocoaFlags & NSAlternateKeyMask)    modifiers |= optionKey;
    if (cocoaFlags & NSShiftKeyMask)        modifiers |= shiftKey;
        // ...
    err = UCKeyTranslate( /* ... */, modifiers, /* ... */);

This is wrong. It should be:

        // ...
    err = UCKeyTranslate( /* ... */, modifiers >> 8, /* ... */);

See 
http://developer.apple.com/mac/library/documentation/Carbon/Reference
/Unicode_Utilities_Ref/Reference/reference.html#//apple_ref/c/func/UCKe
yTranslate (or pass in keyCode 0 ("m" key) and NSAlternateKeyMask. This 
should return "µ" but returns "m").

Original issue reported on code.google.com by thakis@chromium.org on 24 Oct 2009 at 10:02