Merge pull request #14865 from keymanapp/refactor/windows/refactor-keymanx64

refactor(windows): refactor keymanx64 🦾
This commit is contained in:
rc-swag 2025-10-15 15:17:28 +10:00 committed by GitHub
commit 421de2a0be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 41 additions and 27 deletions

4
.gitignore vendored
View file

@ -103,8 +103,8 @@
/windows/src/engine/keyman32/*.cod
/windows/src/engine/keyman32/*.pdb
# /engine/keymanx64/
/windows/src/engine/keymanx64/x64
# /engine/keymanhp/
/windows/src/engine/keymanhp/x64
# /engine/kmcomapi/
/windows/src/engine/kmcomapi/kmcomapi.tlb

View file

@ -17,7 +17,7 @@
# These files are generated during build
engine/keyman32/KEYMAN32.res
engine/keyman32/Keyman64.res
engine/keymanx64/keymanx64.res
engine/keymanhp/keymanx64.res
engine/mcompile/Release/
tds_file.txt
global/delphi/cust/MessageIdentifierConsts.pas

View file

@ -19,7 +19,7 @@ builder_describe \
":keyman Main host process (32 bit)" \
":keyman32 Keystroke processing engine (all archs)" \
":keymanmc Message library" \
":keymanx64 Host process (64 bit)" \
":keymanhp Host process (64 bit)" \
":kmcomapi COM API library" \
":kmrefresh Helper app to refresh Windows language settings" \
":kmtip Text Services Framework Text Input Processor" \

View file

@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.31313.79
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "keyman32", "keyman32\Keyman32.vcxproj", "{BD5564FB-35A5-4A3C-B96A-4A6578E2B593}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "keymanx64", "keymanx64\keymanx64.vcxproj", "{A34650EA-D6E8-4229-8091-6BF1443565B5}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "keymanhp", "keymanhp\keymanhp.vcxproj", "{A34650EA-D6E8-4229-8091-6BF1443565B5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kmtip", "kmtip\kmtip.vcxproj", "{93391ECB-E2F1-4D23-B85E-6FDEB7ACF9B4}"
EndProject

View file

@ -18,12 +18,12 @@ X64_TARGET="$X64_TARGET_PATH/keymanx64.exe"
builder_describe_outputs \
configure:project /resources/build/win/delphi_environment_generated.inc.sh \
build:project /windows/src/engine/keymanx64/$X64_TARGET
build:project /windows/src/engine/keymanhp/$X64_TARGET
#-------------------------------------------------------------------------------------------------------------------
function do_clean() {
vs_msbuild keymanx64.vcxproj //t:Clean
vs_msbuild keymanhp.vcxproj //t:Clean
clean_windows_project_files
}
@ -31,7 +31,7 @@ function do_build() {
create-windows-output-folders
build_version.res
build_manifest.res
vs_msbuild keymanx64.vcxproj //t:Build "//p:Platform=x64"
vs_msbuild keymanhp.vcxproj //t:Build "//p:Platform=x64"
cp "$X64_TARGET" "$WINDOWS_PROGRAM_ENGINE"
builder_if_release_build_level cp "$X64_TARGET_PATH/keymanx64.pdb" "$WINDOWS_DEBUGPATH_ENGINE"
}

View file

@ -1,5 +1,5 @@
/*
Name: keymanx64
Name: keymanhp
Copyright: Copyright (C) SIL International.
Documentation:
Description:
@ -21,7 +21,7 @@
17 Jan 2013 - mcdurdin - I3758 - V9.0 - keymanx64 can find incorrect window handle for keyman.exe
25 Oct 2016 - mcdurdin - I5136 - Remove additional product references from Keyman Engine
*/
#include "keymanx64.h" // I5136
#include "keymanhp.h" // I5136
#include "../../../../common/windows/cpp/include/keymansentry.h"
// Forward declarations of functions included in this code module
@ -62,25 +62,32 @@ HANDLE hWatcherThreadTerminateEvent = NULL;
BOOL KeymanStarted = FALSE;
// Global strings
#if defined(_M_X64)
#define WINDOW_TITLE L"Keymanhp-x64"
#elif defined(_M_ARM64)
#define WINDOW_TITLE L"Keymanhp-arm64"
#else
#error Unknown architecture
#endif
const PWSTR
szWindowClass = L"Keymanx64", // Do not localize
szWindowTitle = L"Keymanx64", // Do not localize
szWindowClass = WINDOW_TITLE, // Do not localize
szWindowTitle = WINDOW_TITLE, // Do not localize
szTitle = L"Keyman Engine x64",
szError_Keymanx86NotFound = L"Keyman Engine x86 is not running. Do not run keymanx64.exe -- it must be started by Keyman Engine x86",
szError_Keymanx86NotFound_Comms = L"Keyman Engine x86 has closed unexpectedly. Closing down Keyman Engine x64",
szError_Keymanx86NotFound = L"Keyman Engine x86 is not running. Do not run keymanhp.*.exe -- it must be started by Keyman Engine x86",
szError_Keymanx86NotFound_Comms = L"Keyman Engine x86 has closed unexpectedly. Closing down Keyman Engine hp64",
szError_FailedToRegisterController = L"Failed to register controller window",
szError_FailedToInitialise = L"Failed to initialise Keyman Engine x64",
szError_FailedToInitialise = L"Failed to initialise Keyman Engine hp",
szError_FailedToFindParentProcess = L"Unable to open parent process; it may have disappeared",
szError_ChangeWindowMessageFilter = L"Failed to prepare message filters",
szError_CannotRunMultipleInstances = L"Only one instance of Keyman Engine x64 can run at a time",
szError_CannotRunMultipleInstances = L"Only one instance of Keyman Engine hp can run at a time",
szError_FailedToRegister = L"Failed to register window class",
szError_FailedToInitInstance = L"Failed to initialise application",
szError_InvalidCommandline = L"Incorrect command line for Keyman Engine x64; should be passed handle of Keyman Engine x86",
szError_InvalidCommandline = L"Incorrect command line for Keyman Engine hp; should be passed handle of Keyman Engine x86",
szError_WatcherThreadFailed = L"Failed to create watcher thread",
szFail_UnknownError = L"Unknown error %d",

View file

@ -1,5 +1,5 @@
/*
Name: keymanx64
Name: keymanhp
Copyright: Copyright (C) SIL International.
Documentation:
Description:

View file

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "keymanx64", "keymanx64.vcxproj", "{A34650EA-D6E8-4229-8091-6BF1443565B5}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "keymanhp", "keymanhp.vcxproj", "{A34650EA-D6E8-4229-8091-6BF1443565B5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View file

@ -12,9 +12,10 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A34650EA-D6E8-4229-8091-6BF1443565B5}</ProjectGuid>
<RootNamespace>keymanx64</RootNamespace>
<RootNamespace>keymanhp</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>keymanhp</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
@ -57,6 +58,12 @@
<ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">*.cdf;*.cache;*.obj;*.ilk;*.resources;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;*.tlog;*.manifest;*.res;*.pch;*.exp;*.idb;*.rep;*.xdc;*.pdb;*_manifest.rc;*.bsc;*.sbr;*.metagen;*.bi</ExtensionsToDeleteOnClean>
<ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Release|x64'">*.cdf;*.cache;*.obj;*.ilk;*.resources;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;*.tlog;*.manifest;*.res;*.pch;*.exp;*.idb;*.rep;*.xdc;*.pdb;*_manifest.rc;*.bsc;*.sbr;*.metagen;*.bi</ExtensionsToDeleteOnClean>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>keymanx64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>keymanx64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
@ -137,15 +144,15 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(KEYMAN_ROOT)\common\windows\cpp\src\keymansentry.cpp" />
<ClCompile Include="keymanx64.cpp" />
<ClCompile Include="keymanhp.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(KEYMAN_ROOT)\common\windows\cpp\include\keymansentry.h" />
<ClInclude Include="keymanx64.h" />
<ClInclude Include="keymanhp.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="keymanx64.rc" />
<ResourceCompile Include="keymanhp.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View file

@ -15,7 +15,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="keymanx64.cpp">
<ClCompile Include="keymanhp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(KEYMAN_ROOT)\common\windows\cpp\src\keymansentry.cpp">
@ -23,7 +23,7 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="keymanx64.h">
<ClInclude Include="keymanhp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
@ -34,7 +34,7 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="keymanx64.rc">
<ResourceCompile Include="keymanhp.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity type="win32" name="com.keyman.windows.engine.keymanx64" version="$VersionWin" processorArchitecture="amd64"/>
<assemblyIdentity type="win32" name="com.keyman.windows.engine.keymanhp" version="$VersionWin" processorArchitecture="amd64"/>
<description>Keyman Engine x64</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>