decorations

This commit is contained in:
shenleban tongying 2024-11-12 07:23:44 -05:00
parent 8720a1a183
commit 659bf38bda

View file

@ -33,7 +33,7 @@ struct ReverseMapEntry {
UInt16 keyCode; UInt16 keyCode;
}; };
std::vector<ReverseMapEntry> mapping; static std::vector<ReverseMapEntry> mapping;
/// References: /// References:
/// * https://github.com/libsdl-org/SDL/blob/fc12cc6dfd859a4e01376162a58f12208e539ac6/src/video/cocoa/SDL_cocoakeyboard.m#L345 /// * https://github.com/libsdl-org/SDL/blob/fc12cc6dfd859a4e01376162a58f12208e539ac6/src/video/cocoa/SDL_cocoakeyboard.m#L345
@ -52,13 +52,13 @@ void createMapping()
CFDataRef uchrDataRef = (CFDataRef)TISGetInputSourceProperty(inputSourceRef, kTISPropertyUnicodeKeyLayoutData); CFDataRef uchrDataRef = (CFDataRef)TISGetInputSourceProperty(inputSourceRef, kTISPropertyUnicodeKeyLayoutData);
const UCKeyboardLayout* UCkeyboardLayoutPtr; const UCKeyboardLayout* UCKeyboardLayoutPtr;
if (uchrDataRef) { if (uchrDataRef) {
UCkeyboardLayoutPtr = (const UCKeyboardLayout*)CFDataGetBytePtr(uchrDataRef); UCKeyboardLayoutPtr = (const UCKeyboardLayout*)CFDataGetBytePtr(uchrDataRef);
} }
if (!UCkeyboardLayoutPtr) { if (!UCKeyboardLayoutPtr) {
return; return;
} }
@ -66,7 +66,7 @@ void createMapping()
UInt32 theDeadKeyState = 0; UInt32 theDeadKeyState = 0;
UniCharCount theLength = 0; UniCharCount theLength = 0;
UniChar temp_char_buf; UniChar temp_char_buf;
if (UCKeyTranslate(UCkeyboardLayoutPtr, i, kUCKeyActionDown, 0, LMGetKbdType(), if (UCKeyTranslate(UCKeyboardLayoutPtr, i, kUCKeyActionDown, 0, LMGetKbdType(),
kUCKeyTranslateNoDeadKeysBit, &theDeadKeyState, 1, &theLength, kUCKeyTranslateNoDeadKeysBit, &theDeadKeyState, 1, &theLength,
&temp_char_buf) &temp_char_buf)
== noErr == noErr