mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-08 09:55:32 +00:00
Fixes #4591. I fixed incxstr in 4 places: 1. Common/Core: kmx_xstring.cpp 2. Engine: xstring.cpp 3. Test project importkeyboard importkeyboard.cpp 4. Test project m-to-p m-to-p.cpp I updated mcompile to remove its own copy of incxstr (identical to that in xstring.cpp) to reduce WETness but opted not to do so for the test apps, which are pretty much throwaway anyway. I note that there is more work we could do here; we need to check every character as we increment so we don't miss a `U+0000` end of string with malformed data. But I would like to tackle that as a separate job at some point in the future after Core integration.
62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
#include "pch.h"
|
|
|
|
BOOL IsWow64();
|
|
|
|
BOOL LoadNewLibrary_NT_x64(PWSTR filename);
|
|
WCHAR CharFromVK_NT_x64(WORD VKey, UINT ShiftFlags, WCHAR *PDeadKey);
|
|
WORD VKUSToVKUnderlyingLayout_NT_x64(WORD VKey);
|
|
WORD VKUnderlyingLayoutToVKUS_NT_x64(WORD VKey);
|
|
int GetDeadkeys_NT_x64(WORD DeadKey, WORD *OutputPairs); // returns array of [USVK, ch] pairs
|
|
|
|
BOOL LoadNewLibrary_NT(PWSTR filename);
|
|
WCHAR CharFromVK_NT(WORD VKey, UINT ShiftFlags, WCHAR *PDeadKey);
|
|
WORD VKUSToVKUnderlyingLayout_NT(WORD VKey);
|
|
WORD VKUnderlyingLayoutToVKUS_NT(WORD VKey);
|
|
int GetDeadkeys_NT(WORD DeadKey, WORD *OutputPairs); // returns array of [USVK, ch] pairs
|
|
|
|
BOOL LoadNewLibrary(PWSTR filename) {
|
|
if(IsWow64()) {
|
|
return LoadNewLibrary_NT_x64(filename);
|
|
} else {
|
|
return LoadNewLibrary_NT(filename);
|
|
}
|
|
}
|
|
|
|
WCHAR CharFromVK(WORD VKey, UINT ShiftFlags, WCHAR *PDeadKey) {
|
|
if(IsWow64()) {
|
|
return CharFromVK_NT_x64(VKey, ShiftFlags, PDeadKey);
|
|
} else {
|
|
return CharFromVK_NT(VKey, ShiftFlags, PDeadKey);
|
|
}
|
|
}
|
|
|
|
int GetDeadkeys(WORD DeadKey, WORD *OutputPairs) {
|
|
if(IsWow64()) {
|
|
return GetDeadkeys_NT_x64(DeadKey, OutputPairs);
|
|
} else {
|
|
return GetDeadkeys_NT(DeadKey, OutputPairs);
|
|
}
|
|
}
|
|
|
|
WORD VKUSToVKUnderlyingLayout(WORD VKey) {
|
|
if(IsWow64()) {
|
|
return VKUSToVKUnderlyingLayout_NT_x64(VKey);
|
|
} else {
|
|
return VKUSToVKUnderlyingLayout_NT(VKey);
|
|
}
|
|
}
|
|
|
|
WORD VKUnderlyingLayoutToVKUS(WORD VKey) {
|
|
if(IsWow64()) {
|
|
return VKUnderlyingLayoutToVKUS_NT_x64(VKey);
|
|
} else {
|
|
return VKUnderlyingLayoutToVKUS_NT(VKey);
|
|
}
|
|
}
|
|
|
|
BOOL IsNumberPadKey(WORD VKey) {
|
|
return
|
|
(VKey >= VK_NUMPAD0 && VKey <= VK_NUMPAD9) || VKey == VK_DECIMAL ||
|
|
VKey == VK_DIVIDE /* NPSLASH */ || VKey == VK_MULTIPLY /* NPSTAR */ || VKey == VK_SUBTRACT /* NPMINUS */ ||
|
|
VKey == VK_ADD /* NPPLUS */ || VKey == 5 /* NPENTER faked */;
|
|
}
|