fix cmd+C+C not working under Japanese Input

This commit is contained in:
子湑 2021-10-20 19:51:02 +08:00 committed by Abs62
parent 519670ad18
commit e92797a98a

View file

@ -29,8 +29,16 @@ void createMapping()
CFDataRef dataRef = ( CFDataRef )TISGetInputSourceProperty( inputSourceRef,
kTISPropertyUnicodeKeyLayoutData );
// this method returns null under macos Japanese input method(and also Chinese), which causes cmd+C+C not to be registered as a hotkey
if( !dataRef )
return;
{
// solve the null value under Japanese keyboard
inputSourceRef = TISCopyCurrentKeyboardLayoutInputSource();
dataRef = static_cast<CFDataRef>((TISGetInputSourceProperty(inputSourceRef, kTISPropertyUnicodeKeyLayoutData)));
if (!dataRef) {
return;
}
}
const UCKeyboardLayout * keyboardLayoutPtr = ( const UCKeyboardLayout * )CFDataGetBytePtr( dataRef );
if( !keyboardLayoutPtr )