Commit graph

244 commits

Author SHA1 Message Date
Marc Durdin
593aa1448b chore: move to .localhost for local server URLs
Match website-local-proxy nginx server setup.

Test-bot: skip
2026-05-18 13:15:51 +02:00
Marc Durdin
9666227b48 chore(developer): add null guard to TframeCEFHost.SetFocus
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2026-03-02 14:04:00 +01:00
Marc Durdin
0bd6f59382 fix(developer): handle window already destroyed when closing editor
Fixes: #15617
Fixes: KEYMAN-DEVELOPER-1JD
Fixes: KEYMAN-DEVELOPER-36K
Fixes: KEYMAN-DEVELOPER-2P5
Test-bot: skip
2026-02-24 15:35:44 +01:00
Marc Durdin
f813442c40
Merge pull request #15276 from keymanapp/revert-14799-change/windows/include-map2pdb-for-relevant-projects
change(windows): Revert "change(windows): include map2pdb generation for relevant Delphi projects"
2025-12-05 07:10:52 +01:00
Marc Durdin
6c99f33bcc
Revert "change(windows): include map2pdb generation for relevant Delphi projects" 2025-12-03 14:13:54 +01:00
Marc Durdin
94ac669ec1 maint(resources): verify order of builder_describe_internal_dependency
Test-bot: skip
2025-12-01 16:47:50 +01:00
Marc Durdin
89597cf8a2
Merge pull request #15156 from keymanapp/fix/windows/handle-keyman-root-forward-slash
fix(windows): handle forward slash for KEYMAN_ROOT env var
2025-11-17 17:02:41 +01:00
Marc Durdin
edca16f508 change(windows): include map2pdb generation for relevant Delphi projects
Adds a call to map2pdb for Delphi projects, if map2pdb is an executable
on the path. This way, we get .pdb files we can use for debugging and
for performance profiling. This also replaces tds2dbg.

If map2dbg is available, then the build and install actions will copy
the PDB to be alongside the corresponding executable, making most debug
actions relatively seamless for finding symbols.

Also fixes up setup.exe in Windows and Developer to extend setup.exe to
a 512-byte boundary after map2pdb patches the PE.

Relates-to: #14787
Build-bot: skip release:developer,windows
Test-bot: skip
2025-11-13 14:48:18 +01:00
Marc Durdin
7c9c21d260 fix(windows): handle exceptions when walking stack in exception handler
This change wraps the stack walk with an exception handler, which will
enable some crash handlers to continue. However, in some circumstances,
such as the stack captured below, it appears to be an unrecoverable
crash.

So, to mitigate this scenario, we also now only capture stack traces for
crashes that we know are serious -- the set of exception types listed in
the patch.

I experienced this issue on my machine after a Windows update; it is not
clear to me if this is related to the Windows update or if it is due to
my debugging environment for Keyman. The symptoms were that Keyman
Configuration would start up, but show just a blank white dialog, and a
few seconds later would abort. Observing process history showed that
kmshell.exe and kmbrowserhost.exe would both crash, with related call
stacks -- see below for a sample. These call stacks are coming out of
keyman32 calling OutputDebugString from DllMain, which may not be a safe
thing to do, because of the exception side-effect. A separate patch will
be submitted to address that - probably just removing any
OutputDebugString calls from DllMain paths.

In any case, this change adds robustness and should mitigate other
unexpected exceptions.

```
0:026> kb
 # ChildEBP RetAddr      Args to Child
00 08a1d4c8 750d6e3d     750d6e20 750bd307 04447396 ucrtbase!abort+0x31
01 08a1d4d0 750bd307     04447396 051caaa0 629f52f0 ucrtbase!_purecall+0x1d
02 08a1d508 62ab2914     0495e1c8 00000000 08a1d5fc ucrtbase!__crt_state_management::wrapped_invoke<int (__cdecl*)(void),int>+0x2a
03 08a1d528 62aba00e     0495e1c8 00000000 08a1d5fc dbghelp!SymbolDataSimpleImpl<1,3>::getData+0x24
04 08a1d580 62ac649d     0495e1c8 08a1d5fc 08a1da34 dbghelp!GetData::getSymData+0x6e
05 08a1d5dc 62ac3272     08a1d5fc 05497580 08a1da5c dbghelp!CPubByAddrTrav::get+0xad
06 08a1d948 62ac7340     08a1da00 08a1da34 08a1da5c dbghelp!findBetterSymbol+0x62
07 08a1da40 62ac87eb     08a1da5c 08a1da64 62a05ea0 dbghelp!CAllSymsByAddrTrav::getEnclosingSymbol+0x80
08 08a1da6c 62abfb10     00000001 00030ed1 05497580 dbghelp!CAllSymsByAddrTrav::init+0xeb
09 08a1da88 62a876e9     00000001 00030ed1 043e9008 dbghelp!CAllSymsByAddrTrav::FInit+0xa0
0a 08a1daac 62a87846     043e9008 00000001 00030ed1 dbghelp!CDiaSession::findSymbolByAddr+0x2a9
0b 08a1dadc 62a87899     043e9008 00031ed1 00000000 dbghelp!CDiaSession::findSymbolByRVA+0x76
0c 08a1db10 62aed8f0     043e9008 00031ed1 00000000 dbghelp!CDiaSession::findSymbolByRVAEx+0x39
0d 08a1dbac 62b1a980     533b1ed1 00000000 00000000 dbghelp!FindSymbolByVA+0x117
0e 08a1dc00 629ed8da     533b1ed1 00000000 93b94d79 dbghelp!diaGetFpoFromAddr+0x6c
0f 08a1dc4c 629ed647     533b1ed1 00000000 93b94dad dbghelp!LookupFunctionEntryX86+0x23d
10 08a1dc98 629ed4c7     ffffffff 533b1ed1 00000000 dbghelp!SymFunctionTableAccess64AccessRoutines+0x167
11 08a1dcb4 629ec7a1     ffffffff 533b1ed1 00000000 dbghelp!FunctionTableAccessRoutineLocal+0x17
12 08a1dcd8 629eba25     533b1ed1 00000000 08a1dd10 dbghelp!DbhStackServices::GetFunctionEntry+0x31
13 08a1dd58 629eb126     00000001 08a1de00 08a1eda0 dbghelp!DbsStackUnwinder::StaticAdjustForNoReturn+0x4a
14 08a1ddbc 629e8a76     08a1ddf8 08a1dea8 08a1dec8 dbghelp!DbsX86StackUnwinder::UnwindAndUpdateInternalContext+0x136
15 08a1deec 629e88b4     08a1eda0 00000005 05482908 dbghelp!DbsStackUnwinder::DoDbhUnwind+0x177
16 08a1df1c 629e87b8     08a1eda0 00000005 05482908 dbghelp!DbsStackUnwinder::DbhUnwind+0x58
17 08a1e038 629e867e     08a1eda0 08a1f000 00725a60 dbghelp!PickX86Walk+0x109
18 08a1ecf4 62af77c9     08a1eda0 08a1f000 00000000 dbghelp!DoUnwindStackFrameUsingServices+0xbb
19 08a1ed4c 62b3ad4b     0000014c ffffffff fffffffe dbghelp!StackWalk2+0x1c9
1a 08a1eebc 2c7667c4     0000014c ffffffff fffffffe dbghelp!StackWalk64+0x8b
WARNING: Stack unwind information not available. Following frames may be wrong.
1b 08a1f2cc 2c765ad4     00000000 04e57318 08a1f32c kmshell+0x3667c4
1c 08a1f2dc 7726369f     08a1f2f8 08a1f428 08a1f3d8 kmshell+0x365ad4
1d 08a1f32c 7725eb04     00000000 5338cc66 08a1fbac ntdll!RtlpCallVectoredHandlers+0xf8
1e 08a1f3c0 7726b66f     08a1f3d8 08a1f428 08a1f3d8 ntdll!RtlDispatchException+0x67
1f 08a1f3c0 753e5004     08a1f3d8 08a1f428 08a1f3d8 ntdll!KiUserExceptionDispatcher+0xf
20 08a1f8ec 754c7ab0     40010006 00000000 00000002 KERNELBASE!RaiseException+0x64
21 08a1fb54 533ab6a2     08a1fbac 5338cc66 08a1fe38 KERNELBASE!OutputDebugStringA+0x50
22 08a1fcb0 533b1ba3     53673110 5338cc66 08a1fe38 keyman32!_OutputThreadDebugString+0x42 [D:\Projects\keyman\app\windows\src\engine\keyman32\K32_DBG.CPP @ 291]
23 08a1fd18 533b1ed2     00000000 5338cc66 08a1fe38 keyman32!ReleaseKeyboards+0x13 [D:\Projects\keyman\app\windows\src\engine\keyman32\keyman32.cpp @ 841]
24 08a1fd70 533b1fad     00000000 5338cc66 08a1fe38 keyman32!UninitialiseProcess+0x22 [D:\Projects\keyman\app\windows\src\engine\keyman32\keyman32.cpp @ 160]
25 08a1fdcc 53431b12     53380000 00000003 00000000 keyman32!DllMain+0x5d [D:\Projects\keyman\app\windows\src\engine\keyman32\keyman32.cpp @ 143]
26 08a1fe10 53431cf0     53380000 00000003 00000000 keyman32!dllmain_dispatch+0xb2 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp @ 281]
27 08a1fe24 77268ff6     53380000 00000003 00000000 keyman32!_DllMainCRTStartup+0x20 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\dll_dllmain.cpp @ 334]
28 08a1fe44 772a0df3     5338cc66 53380000 00000003 ntdll!LdrxCallInitRoutine+0x16
29 08a1fe68 7722b11c     00000003 00000000 fb42ae4c ntdll!LdrpCallInitRoutineInternal+0x22
2a 08a1feb0 77229812     00000003 00000000 fb42af9c ntdll!LdrpCallInitRoutine+0xae
2b 08a1ff60 77261670     1138e500 00000000 052cbe98 ntdll!LdrShutdownThread+0x1b2
2c 08a1ff74 757c5d50     00000000 757c5d30 08a1ffdc ntdll!RtlExitUserThread+0x30
2d 08a1ff84 7725d6db     052cbe98 fb42af20 00000000 kernel32!BaseThreadInitThunk+0x20
2e 08a1ffdc 7725d661     ffffffff 772a4680 00000000 ntdll!__RtlUserThreadStart+0x2b
2f 08a1ffec 00000000     1138e500 052cbe98 00000000 ntdll!_RtlUserThreadStart+0x1b
```
2025-11-13 14:47:14 +01:00
Marc Durdin
5879f087c7 fix(windows): handle forward slash for KEYMAN_ROOT env var
Test-bot: skip
2025-11-13 14:45:23 +01:00
Marc Durdin
23b5dca1b3 fix(developer): remove package version if FollowKeyboardVersion is set in Package Editor
To reduce confusion when 'Follow Keyboard Version' is set, clear the
cached package version data from UI and .kps source when saving the
package or making changes to it.

Fixes: #11892
Test-bot: skip
2025-11-03 10:54:44 +01:00
Marc Durdin
9e1fe8e6de chore(windows): upgrade VC++ projects to v143 (VS2022)
Test-bot: skip
Build-bot: skip release:developer,windows
2025-10-30 16:31:45 +01:00
Marc Durdin
50ffbb2722 fix(windows): osk: handle simulated left Control event when AltGr pressed
When a European layout is active, and the user presses AltGr, Windows
generates a simulated VK_LCONTROL event alongside the VK_RMENU event.
This was causing the OSK to show LCtrl as depressed alongside RAlt, so
the OSK would show the wrong modifier layer, which was unhelpful and
confusing to the end user.

It is possible to detect the simulated VK_LCONTROL in the WH_KEYBOARD_LL
hook, because the scan code generated is 0x21D, instead of 0x1D.
Warning: this is not a documented value. (But, this 0x21D scan code is
not passed to the WM_KEYDOWN event!) Therefore, we use Keyman's existing
kmnLowLevelKeyboardProc to pass modifier key events on to the visual
keyboard.

This patch handles only this specific scenario, by watching for that
specific scan code in the new handler in the UfrmOSKOnScreenKeyboard
module, together with some minor refactoring so that it fits neatly.

A future improvement would be to have all modifier key processing go
through this new handler, and eliminate the timer-based polling of the
keyboard. However, there is some additional risk around missing events,
leading to 'stuck modifiers'.

Fixes: #14890
Build-bot: skip release:windows
2025-10-08 14:32:40 +02:00
Marc Durdin
39b4d630dd docs(windows): add documentation for localization functions
Build-bot: skip
2025-09-25 09:46:24 +02:00
Marc Durdin
ad9ab53c72 feat(windows): improve startup time by caching locale names
This was flagged years ago as a potential performance hotspot: each
locale is loaded at process start for any kmcomapi-involved process,
which takes quite a long time. This refactor moves the locale
enumeration out of kmcomapi and into the build process, so we have a
static list of locales put into locale/index.xml.

This includes a minor breaking change to Keyman Engine API on Windows:
`MessageFromID(id, locale)` now only allows the three ids
SKUILanguageName, SKUILanguageNameWithEnglish, and SKLanguageCode, for
performance reasons. At this point, only SKUILanguageNameWithEnglish is
actually used anywhere in Keyman, and it is unlikely that any other
consumers are requesting alternate IDs.

Fixes: #14787
Build-bot: skip release:windows
2025-09-19 14:11:37 +02:00
Marc Durdin
fa5278a361 fix(developer): transform slashes to backslashes in paths in Package Editor
When loading package files generated by kmc or edited on non-Windows
systems, the Package Editor will now convert any forward slashes in the
path to backslashes. This is necessary because the path manipulation
functions in Keyman Developer work only with backslashes.

Fixes: #14719
Build-bot: skip release:developer
2025-09-10 14:58:13 +02:00
Marc Durdin
00b98f2286 fix(windows): emit nunit report path correctly and update TeamCity links
* Windows and Developer sources
* Fixes the report path to be fully qualified
* Adds the TeamCity report logger to remaining DUnitX automated tests

Fixes: #14197
Build-bot: skip build:windows,developer
Test-bot: skip
2025-08-20 07:21:03 +02:00
Marc Durdin
47e21331dd maint(common): additional builder.inc.sh script renames
Fixes: #14065
2025-08-02 13:16:19 +10:00
Marc Durdin
f394245636 maint(common): consolidate builder scripts
Clarifies the confusing builder.inc.sh / build-utils.sh distinction by
giving the scripts more appropriate names. Most build scripts should use
builder-full.inc.sh; some helper scripts can use builder-basic.inc.sh.
Documented in resources/build/README.md.

Renames:
* resources/build/builder.inc.sh to resources/build/builder-full.inc.sh
* resources/build/build-utils.sh to resources/build/builder-basic.inc.sh

Other changes:
* Moves Android-specific functions out of builder-basic.inc.sh and into
  android/build.sh.
* Renames functions in builder-basic.inc.sh

More functions may be moved from builder-basic.inc.sh into utils.inc.sh
or other scripts in the future.

Fixes: #14065
Build-bot: build all
Test-bot: skip
2025-08-02 08:11:24 +10:00
Eberhard Beilharz
460de65f0d
maint(common): use same TC variable everywhere
Standardize on `TEAMCITY_GIT_PATH` environment variable to detect
if we're running on TeamCity.

Test-bot: skip
2025-05-06 17:42:25 +02:00
Marc Durdin
0f05da957f fix(developer): remove redundant Name and RTL fields from .kps LexicalModel
Follows on from the similar changes to `Keyboard` fields in #13600. This
deprecates the `RTL` and `Name` fields. `RTL` was never used. `Name` was
written but never presented to end users, so effectively irrelevant.
`Name` also was present in `File.Description` (already deprecated) for
the corresponding model.js _and_ `Info.Name`, so doubly redundant.

Also updates the schema documentation to mark the deprecated fields.

Relates-to: #13600
2025-04-02 05:39:09 +07:00
Marc Durdin
9dabcc0306 fix(developer): remove redundant keyboard fields from .kps
The fields 'name', 'version', and 'rtl' were defined in the .kps file,
but were not actually used by the compiler, as kmc-package reads the
metadata from the keyboard file rather than relying on this data, which
often is out of date. This led to confusion for keyboard authors, so
this change removes that metadata from the package.

The one visible side-effect (apart from the data disappearing from
future .kps files) is that the package editor no longer shows this
metadata in the Keyboards view (but as it may be out-of-date, this is
probably a good thing).

Fixes: #13576
Fixes: #13593
2025-03-28 14:07:23 +07:00
rc-swag
df938fef51 Merge pull request #13444 from keymanapp/feat/windows/13106-hard-code-osk-font-colour
feat(windows): hard code key cap colour
2025-03-17 17:14:45 +10:00
Marc Durdin
f9ab3c7045
Apply suggestions from code review
Co-authored-by: Darcy Wong <darcy_wong@sil.org>
2025-02-24 09:58:48 +01:00
Marc Durdin
ef60c08d7c chore: add build.sh edit action for Delphi projects
This opens up the Delphi IDE with the correct KEYMAN_ROOT environment,
which allows for debugging. This is very helpful when working with
multiple worktrees, and also helps to avoid editing a project in the
wrong tree.
2025-02-22 06:18:47 +01:00
Marc Durdin
2d5e3ee440
Merge pull request #13156 from keymanapp/feat/developer/13134-improve-messages-and-links
feat(developer): improve compiler messages and user interface
2025-02-10 08:19:11 +07:00
Marc Durdin
d4ecd83459 chore(developer): use kmn.sh instead of deeplink into help.keyman.com for message links 2025-02-07 12:50:38 +07:00
Marc Durdin
bd4633333b feat(developer): improve compiler messages and user interface
* Add unit test to verify the format of message detail strings
  (max line length of 80 chars)
* Add unit test to verify non-null, non-empty message strings
* Tidy up a number of messages (to pass unit tests)
* Add message details for all kmw compiler messages
* Add a clickable link for the TIKE message window for each message
  so that explanations and further message details are more accessible
  to authors (`kmc message` is already available for command-line users)
* Fixes a number of minor issues with the messages window in TIKE,
  mostly relating to when popup menu commands are enabled and how
  messages are selected.

Fixes: #13134
2025-02-07 08:46:46 +07:00
rc-swag
46c6a44f90
Merge pull request #13115 from keymanapp/feat/windows/13114/merge-update-reg-key
feat(windows): check updates and automatic update merged
2025-02-06 21:46:45 +10:00
rc-swag
9eec271011 feat(windows): check updates and automatic update merged
Check updates meaning has slightly changed it is now automatic updates
and it will now check, download and when possible start the install.

Previously it just meant a check for upates was made and notified
the user of updates.

Fixes:#13114
2025-02-03 14:25:44 +10:00
Marc Durdin
46fc4d52cf feat(developer): add user interface for kmc copy to TIKE
Adds a new set of 'New Project' dialogs to allow authors to easily copy
keyboards from local filesystem, Keyman Cloud (including a keyboard
search web page, implemented in keymanapp/keyman.com#536), and
directly from a GitHub URL. Adds related documentation.

Fixes: #13073
Depends-on: keymanapp/keyman.com#536
2025-01-30 11:04:18 +07:00
Marc Durdin
7cb6be6a97 fix(developer): support &displayMap font in web debugger
Adds a new design-time font property for when `&displayMap` is in use in
a keyboard, so that the web debugger can use that font as appropriate.

If the keyboard does not have a `&displayMap` store, then the DisplayMap
font property is disabled, and the web debugger will use the OSK Font
instead, as previously was the case.

Note that the font for `&displayMap` has to be installed on the keyboard
author's system in order for it to be served up.

Fixes: #12123
2025-01-17 11:03:20 +07:00
Marc Durdin
974b16f722
Merge branch 'epic/windows-updates' into chore/merge-master-into-windows-updates 2024-12-05 08:49:34 +01:00
Marc Durdin
18d00c7701 fix(core): use NDEBUG flag to disable assertions in release build for VC++
This disables assertions in release builds in Windows only. Other
platforms may have different outcomes.

Fixes: #12619
2024-11-27 15:34:34 +07:00
rc-swag
f2d0e268a7 feat(windows): remove TUpdateStateMachineParams
There was some dead code from before the RemoteUpdateCheck refactor
was created. This is removed in this commit
2024-10-30 16:59:32 +10:00
rc-swag
c988271628
feat(windows): formatting review suggestions
Co-authored-by: Marc Durdin <marc@durdin.net>
2024-10-15 12:12:21 +10:00
rc-swag
4ad5f0fc64 chore(windows): Merge branch 'epic/windows-updates' into feat/windows/add-apply-now-update 2024-10-01 17:38:59 +10:00
Marc Durdin
2d09c805d0
Merge pull request #12417 from keymanapp/chore/merge-master-into-windows-updates
chore: merge master into windows-updates
2024-09-13 09:24:17 +02:00
rc-swag
5c187db7a6 feat(windows): address review comments 2024-09-12 13:40:42 +10:00
rc-swag
3f1236ab59 feat(windows): comments copyright formating 2024-09-10 17:22:21 +10:00
rc-swag
bfe1b45983 feat(windows): automatic updates option to config reg 2024-09-09 15:51:32 +10:00
rc-swag
e41a8cbbb6
Merge pull request #12259 from keymanapp/feat/windows/11471/right-modifier-hk
feat(windows): add right modifier included in hotkey optional functionality
2024-09-06 13:40:14 +10:00
rc-swag
85a998bb73 feat(windows): rename executehistory module for clarity 2024-09-03 15:31:49 +10:00
rc-swag
1667cfed09 feat(windows): clean up ready for review 2024-09-03 14:38:09 +10:00
rc-swag
10c343fc43 feat(windows): change verb use to allow for clarity 2024-09-02 13:31:21 +10:00
rc-swag
f0827b4d1e
Merge pull request #12252 from keymanapp/feat/windows/11471/remove-old-flags-modifier
feat(windows): Remove hotkey related feature flags
2024-09-02 12:59:12 +10:00
Marc Durdin
fd5c1c31b6
Merge pull request #12323 from keymanapp/chore/merge-master-into-windows-updates
chore: merge master into windows-updates
2024-08-30 04:33:54 +02:00
rc-swag
e2ec08ca9b feat(windows): remove klogging enable 2024-08-27 18:03:57 +10:00
rc-swag
50a56c94fc chore(windows): Merge branch 'epic/windows-updates' into feat/windows/add-apply-now-update 2024-08-27 13:02:46 +10:00
Marc Durdin
e1bf42ed31
Merge pull request #12274 from keymanapp/chore/windows/12247-remove-remaining-makefiles
chore(windows): remove remaining unused Makefiles
2024-08-24 04:34:14 +02:00