Cleanup: style

This commit is contained in:
Campbell Barton 2015-01-12 18:49:27 +11:00
parent bae5826b65
commit d8fc404415
2 changed files with 21 additions and 21 deletions

@ -205,6 +205,7 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
return GHOST_kKeyUnknown; return GHOST_kKeyUnknown;
default: default:
{
/* alphanumerical or punctuation key that is remappable in int'l keyboards */ /* alphanumerical or punctuation key that is remappable in int'l keyboards */
if ((recvChar >= 'A') && (recvChar <= 'Z')) { if ((recvChar >= 'A') && (recvChar <= 'Z')) {
return (GHOST_TKey) (recvChar - 'A' + GHOST_kKeyA); return (GHOST_TKey) (recvChar - 'A' + GHOST_kKeyA);
@ -213,27 +214,25 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
return (GHOST_TKey) (recvChar - 'a' + GHOST_kKeyA); return (GHOST_TKey) (recvChar - 'a' + GHOST_kKeyA);
} }
else { else {
/* Leopard and Snow Leopard 64bit compatible API*/
/* Leopard and Snow Leopard 64bit compatible API*/ CFDataRef uchrHandle; /*the keyboard layout*/
CFDataRef uchrHandle; /*the keyboard layout*/ TISInputSourceRef kbdTISHandle;
TISInputSourceRef kbdTISHandle;
kbdTISHandle = TISCopyCurrentKeyboardLayoutInputSource();
uchrHandle = (CFDataRef)TISGetInputSourceProperty(kbdTISHandle,kTISPropertyUnicodeKeyLayoutData);
CFRelease(kbdTISHandle);
/*get actual character value of the "remappable" keys in int'l keyboards,
if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
then fallback on using the received charactersIgnoringModifiers */
if (uchrHandle)
{
UInt32 deadKeyState=0;
UniCharCount actualStrLength=0;
UCKeyTranslate((UCKeyboardLayout*)CFDataGetBytePtr(uchrHandle), rawCode, keyAction, 0, kbdTISHandle = TISCopyCurrentKeyboardLayoutInputSource();
LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &actualStrLength, &recvChar); uchrHandle = (CFDataRef)TISGetInputSourceProperty(kbdTISHandle,kTISPropertyUnicodeKeyLayoutData);
CFRelease(kbdTISHandle);
} /*get actual character value of the "remappable" keys in int'l keyboards,
if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
then fallback on using the received charactersIgnoringModifiers */
if (uchrHandle) {
UInt32 deadKeyState=0;
UniCharCount actualStrLength=0;
UCKeyTranslate((UCKeyboardLayout*)CFDataGetBytePtr(uchrHandle), rawCode, keyAction, 0,
LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &actualStrLength, &recvChar);
}
switch (recvChar) { switch (recvChar) {
case '-': return GHOST_kKeyMinus; case '-': return GHOST_kKeyMinus;
@ -251,6 +250,7 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
return GHOST_kKeyUnknown; return GHOST_kKeyUnknown;
} }
} }
}
} }
return GHOST_kKeyUnknown; return GHOST_kKeyUnknown;
} }
@ -270,7 +270,7 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
return 1; return 1;
} }
else { else {
return 0; return 0;
} }
} }

@ -545,7 +545,7 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
aci->array_index = fcu->array_index; aci->array_index = fcu->array_index;
/* detect if this is a bone. We do that here rather than during pasting because ID pointers will get invalidated if we undo. /* detect if this is a bone. We do that here rather than during pasting because ID pointers will get invalidated if we undo.
* storing the relavant information here helps avoiding crashes if we undo-repaste */ * storing the relevant information here helps avoiding crashes if we undo-repaste */
if ((aci->id_type == ID_OB) && (((Object *)aci->id)->type == OB_ARMATURE) && aci->rna_path) { if ((aci->id_type == ID_OB) && (((Object *)aci->id)->type == OB_ARMATURE) && aci->rna_path) {
Object *ob = (Object *)aci->id; Object *ob = (Object *)aci->id;
char *str_start; char *str_start;