Commit graph

3751 commits

Author SHA1 Message Date
Marc Durdin
83251358b0 fix(windows): reinstall low level keyboard hook if it gets removed 🍒
This change improves the stability of Keyman for Windows by monitoring
the health of the low level keyboard hook. If keyman.exe is unresponsive
at any time, Windows can silently uninstall its low level keyboard hook,
which results in (at least) two problems:

* Keyman's hotkeys stop working
* A modifier key can become stuck, if it was pressed around the time
  Keyman became unresponsive.

The most common scenario in which Keyman can become unresponsive is high
system load, e.g. rendering graphics, videoconference calls, compiling
software.

Restarting Keyman always resolved both of these two issues in the past,
but with this patch, I hope that this will no longer be necessary.

A related 'fakefreeze' project is not included in this cherry-pick; see
PR #15179 for this.

Logging has been updated; look for "LowLevelHookWatchDog" in the log for
related events.

One final small change in keyman32.cpp, as I refactored the
WH_KEYBOARD_LL hook installation/uninstallation, was to always clear out
hook variables when uninstalling a hook, because if the hook fails to
uninstall, there's really nothing we can do about it anyway, and we
probably shouldn't be trying again.

Fixes: #8064
Cherry-pick-of: #15179
Test-bot: skip
Build-bot: skip
2025-11-21 16:00:28 +01:00
rc-swag
b5b916abbf fix(windows): remove dead code 2025-11-15 05:43:27 +01:00
rc-swag
b04229efe5 fix(windows): free the correct object KeyboardToggleReg 2025-11-15 05:43:26 +01:00
rc-swag
5bf1f635a6 fix(windows): add check a fix for registry datatypes
Fixes: #14342
The Windows system level keyboard hotkeys controlled in
registry have sometimes been incorrectly written as
a DWORD datatype. There 106 events in sentry for just
July. When opening the Windows setting dialog and the registry
has DWORDS it will show unassinged in the dialog if apply
is pressed it will convert the keys to REG_SZ.
This fix follows a similar pattern it will check the data
type of the registry key if it is DWORD it will remove it
and add a new key of the same name as REG_SZ and set it to
the unassigned value.

Fixes: KEYMAN-WINDOWS-4NK
2025-11-15 05:43:25 +01:00
Marc Durdin
d7b16aece9 chore(windows): upgrade VC++ projects to v143 (VS2022)
Test-bot: skip
Build-bot: skip release:developer,windows
2025-10-31 13:37:24 +01:00
Marc Durdin
0653e10c25 chore: unix line endings and unused include 2025-10-30 07:41:00 +01:00
Marc Durdin
00c1eada74
Merge pull request #14832 from keymanapp/feat/windows/cherry-pick/14787-improve-startup-time
feat(windows): improve startup time by caching locale names 🍒 🏠
2025-09-29 07:43:10 +02:00
Marc Durdin
dbf2815846 docs(windows): add documentation for localization functions
Build-bot: skip
2025-09-25 14:56:21 +02:00
Marc Durdin
ca83712765 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-25 14:56:20 +02:00
Marc Durdin
2a81279dc1 fix(windows): disable .msi shortcut advertisement
Change Keyman shortcuts to standard Windows shortcuts, rather than
advertised shortcuts, to work around a problem with advertised shortcuts,
elevated custom actions, and non-admin users, as described in #14791.

The problem is related to advertised shortcuts in Windows Installer. When
you have an advertised shortcut, the first use of the shortcut triggers a
repair to prepare the app for use in the new user's context. And now, with
Aug 2025 Windows security patch KB5063878, tweaked in Sep 2025, this
triggers an elevation dialog, which the non-admin user cannot work around.

This means that the shortcuts will be regular Windows shortcut files rather
than advertised shortcuts, and are added to
`%ProgramData%\Microsoft\Windows\Start Menu\Programs\Keyman for Windows`
(so, available for all users on that machine, but will not follow a user
across machines).

* DISABLEADVTSHORTCUTS: https://learn.microsoft.com/en-us/windows/win32/msi/disableadvtshortcuts
* Shortcut advertisement: https://learn.microsoft.com/en-us/windows/win32/msi/advertisement

Relates-to: #14809
Fixes: #14791
Cherry-pick-of: #14814
Build-bot: skip release:windows
2025-09-25 09:06:53 +02:00
rc-swag
ace21ea91b fix(windows): review comments
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2025-06-19 11:50:11 +10:00
rc-swag
257ad64f84 feat(windows): review comments
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2025-06-19 11:50:09 +10:00
rc-swag
2fe08f1801 fix(windows): if only keyboards return to idle
There will be no `firstrun` for kmshell.exe if it is a keyboard only
install. We can therefore return to the idle state in the current
process
2025-06-19 11:50:09 +10:00
rc-swag
24ff70744c fix(windows): TRemoteUpdateCheckResult two new values
TRemoteUpdateCheckResult now has wucUpdateAvailable and
wucNotChecked to avoid confusion
2025-06-19 11:46:46 +10:00
rc-swag
f3c61ec6f0 fix(windows): early return when download meta data invalid
is invalid or the version is not newer then currently installed
2025-06-19 11:20:37 +10:00
rc-swag
74da0c6ae4 fix(windows): update TODO with issue number 2025-06-19 11:20:36 +10:00
rc-swag
a263d3e0a8 fix(windows): update all update check code 2025-06-19 11:20:35 +10:00
rc-swag
bae1161fe6 fix(windows): use ucrsUpdateReady in check for updates
When determining whether to move to the update available the
ucrsUpdateReady is now taken into account, not just the wucSuccess
flag. All the cases that check if there is Keyman installer file in
the metadata now check for this, and this was the original intent.
A two new function HasKeymanInstallFileUpdate and
CheckMetaDataForUpdate have been added to aid this check.
2025-06-19 11:20:34 +10:00
rc-swag
de2d13bb1c fix(windows): fix download failing when cache.json missing
or stale. This commit adds a precondition check when entering the
Download state. It checks to see if the cache.json file still exists
then it checks if there are packages or installer files to download.
This will also check the version with ucrsUpdateReady, so if the
installed version is already newer it will not attempt the download.
If the check fails it will removed any cached files and return to
the idle state and check for updates.

Fixes: #13767
2025-06-19 11:20:33 +10:00
rc-swag
81f0a20c65
Merge pull request #14029 from keymanapp/fix/windows/cherry-sentry-message-reporting-fix
fix(windows): fix sentry error message reporting 🍒🏠
2025-05-23 09:01:03 +10:00
rc-swag
b27ade5e87
Merge pull request #14028 from keymanapp/fix/windows/13770/cherry-skip-sm
fix(windows): skip sending handle kmshell events to upgrade state machine for keyboard install modes 🍒  🏠
2025-05-23 09:00:30 +10:00
rc-swag
f67e919b59 fix(windows): fix sentry error message reporting 2025-05-22 15:33:36 +10:00
rc-swag
e9fa2b863d fix(windows): commit review suggestions
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-05-22 15:20:06 +10:00
rc-swag
e10c34fcf6 fix(windows): skip handlekmshell for kbb updates
Before we only skipped the handlekmshell checks if we
were in installing state and the FMode was related to
upgrading or installing the keyboard packages. However
like as seen in 13984 if an upgraded is started from the
standalone installer the statemachine state could be
in UpdateAvailable instead of the Installing State.
Due to this limitation we will skip handlekmshell when in
these FModes in any state.

Fixes: #13770
2025-05-22 15:20:05 +10:00
rc-swag
16f54321e5 fix(windows): only breadcrumb unexpected state on first run
If configuration is set to not automatically downloadupdates
and then from the configuration tab the check for update button is
clicked. If an update is found the upgrade statemachine is now in
state UpdateAvailable. If a updated keyman installer file is then
download direclty from keyman.com. Then installed by running the self
installer then on firstrun the statemachine will still be in the
UpdateState. This is should be fine, but it will be good to breadcrumb
incase we start to see some crashes on firstrun with this interaction.

The setup executable could modify the registry state directly but it is
cleaner to have the one master of the registry state value.

Fixes: #13771
2025-05-22 11:54:07 +10:00
rc-swag
2bc9aa71f8 fix(windows): add info breadcrumb for keyman installer
status
2025-05-21 15:17:27 +10:00
rc-swag
cf0a7981b9 fix(windows): add breadcrumbs and remove klogs
Add some extra breadcrumbs for when loading cache file fails.
2025-05-21 15:17:07 +10:00
rc-swag
bf93a418a2 fix(windows): rename Enter and Exit methods TState
The state machine method for Exiting a a state was overiding
the Delphi system Exit. This meant that any intended early returns
inside TState method where actually just calling the State.Exit
method then continuing execution within the method.

Fixes: 13831
2025-05-21 15:15:15 +10:00
rc-swag
a4dbf58265 fix(windows): address review comment ignore case
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-05-21 15:14:18 +10:00
rc-swag
2e2ec28857 fix(windows): use json file name against cache folder
Be more precise by matching the file name in the cache.json file
with the downloaded file in the cache folder. This will mean any
older installation versions that were not correctly cleaned up will
not be installed.

fixes #13831
2025-05-21 15:14:17 +10:00
Darcy Wong
41de14a077 chore(windows): Update Crowdin strings for Italian 2025-05-09 10:32:24 +07:00
Eberhard Beilharz
682e33893f
docs(windows): update FAQ
- add link to Linux
- reword some questions in the Windows main index
- explicitly mention Windows in `requirements.md` to make it clear that
  this is for Windows only
- update `os.md` since Windows on Arm is no longer in preview
2025-04-16 11:56:46 +02:00
Darcy Wong
30dc85f484 chore(common): Update crowdin strings for Spanish Latin America 2025-04-09 07:44:32 +07:00
Darcy Wong
0d2c001e48
Merge pull request #13681 from keymanapp/chore/common/crowdin-km
chore(android,mac,windows): update Crowdin strings for Khmer
2025-04-07 15:57:35 +07:00
Darcy Wong
3ebea47ff3 chore(windows): Update crowdin strings for Khmer 2025-04-07 08:52:35 +07:00
Darcy Wong
005b74e0a4 chore(windows): Update crowdin strings for Czech 2025-04-07 08:41:26 +07:00
Darcy Wong
4d4508d4c7
Merge pull request #13595 from keymanapp/chore/crowdin/mon
chore(common): Update crowdin strings for Mon
2025-04-02 10:38:41 +07:00
Darcy Wong
14d4b62f2d
Merge pull request #13594 from keymanapp/chore/crowdin/it
chore(mac,windows): Update Crowdin strings for Italian
2025-04-01 10:05:41 +07:00
Darcy Wong
39eebaa257 chore(common): Update crowdin strings for Mon 2025-03-28 09:15:42 +07:00
Darcy Wong
4067c98f11 chore(windows): Update crowdin strings for Italian 2025-03-28 09:00:39 +07:00
rc-swag
b2463be19a fix(windows): review comments 2025-03-28 10:36:46 +10:00
rc-swag
79b15dfeb4 fix(windows): move thread check guard
Removed the redundant thread check guard on load modifer. Added guard
to reading the option. Also fixed some formating. and made the load
modifier private.
2025-03-27 16:05:28 +10:00
rc-swag
e3f2e85945 fix(windows): reload right modifier key option
Fixes: #13440

This refactors the cached of the right modifier key used in hotkeys
option. In the lowlevelhook you couldn't reset the cached value.
It is now part of the hotkeys class which is more logical encapsulation
the logic assocaited with the hotkeys.
2025-03-27 13:30:05 +10:00
rc-swag
4276aa83eb
Merge pull request #13565 from keymanapp/fix/windows/combine-install-pop-up-frms
fix(windows): combine install and install pop ups
2025-03-27 09:47:50 +10:00
rc-swag
228fcd193e
Merge pull request #13555 from keymanapp/fix/windows/13489/update-tab-improvements
fix(windows): configuration update tab text changes
2025-03-27 09:19:52 +10:00
rc-swag
365495b1d5 fix(windows): font charset to default charset 2025-03-27 09:18:29 +10:00
rc-swag
6e7971ddff chore(windows): Merge branch 'fix/windows/combine-install-pop-up-frms' into fix/windows/13489/update-tab-improvements 2025-03-26 10:11:43 +10:00
rc-swag
b97c4f1623 fix(windows): fix handling of more than 3 updates
The scroll bar was also not working correctly for display content.
Different options where explored but the best was to make the outer
update content block a "display: block" instead of using flex.
2025-03-25 17:09:03 +10:00
rc-swag
eb134999b2 fix(windows): move lbl remove full stop
Moved the label yet again. Also remove a full stop after the
question mark for a string.
2025-03-25 10:14:30 +10:00
rc-swag
5bf17c1fc9 fix(windows): update S_Update_Restart_Req
This was updated in first PR before combining just bringing
the change over.
2025-03-24 17:21:09 +10:00