Commit graph

58 commits

Author SHA1 Message Date
Marc Durdin
3f507f974a chore(developer): remove font style/color from kvk
While .kvk includes a font color field, it is essentially unused. There
was also some sort of support provided for font style in the KeymanWeb
keyboard compiler, but this was never streamed into .kvk or .kvks files,
so was always a no-op.

Thus, this PR removes any semblance of support for font style and color
from the .kvk and .kvks readers and writers. When we write the font
color field which is present in .kvk, we always use the default
TColor.clWindowText which is what the legacy Delphi-based writer would
always have written.

Also sorted out the default font size and name in the .kvk transform
from .kvks, and in so doing cleaned up the basic.kvk and basic.js in
LDML keyboard compiler to match what we are doing in the .kmn compiler.
2023-06-21 10:53:45 +07:00
Marc Durdin
36b70758a9 chore(windows): remove unused OnlineConstants 2022-06-12 14:26:53 +10:00
Marc Durdin
a8a19b2a2e fix(windows): handle edge cases using default language
Fixes #5091.

If the user has a default language that is not a minimal BCP47 tag, such
as `zh-Hans-CN` vs `zh-CN`, or if the default language does not have a
mapping in our `TLanguageCodeUtils.TranslateWindowsLanguagesToBCP47`
function, then kmshell would crash on install of a keyboard that had no
language metadata specified (i.e. neither legacy metadata in .kmx nor
modern metadata in .kmp).

This crash arose because the elevated instance of kmshell would install
a local-machine reference to `zh-CN` (as it back-translated from a
LangID), but the current user install would look for `zh-Hans-CN`, read
from the Windows registry `HKCU\Control Panel\International\User Profile`.

To further complicate matters, it is possible for the current user to
have a different default language than the elevated user on the machine.
Keyman was assuming that the default language was the same in both
cases.

This fix passes in the current user's default BCP47 and LangID to the
elevated portion of the keyboard install, so we can guarantee that
keyboard install which needs to use the default language, actually
installs for the current user's actual language code, and not a
canonicalized version (or a totally different code in the case of
elevation to an alternate admin user account).
2021-09-17 06:37:23 +10:00
Marc Durdin
a00eb2c91a fix(windows): fallback to filename if &name not set
Fixes #5683.

If `store(&name)` is missing from a keyboard, then fallback to the
filename of the keyboard (sans extension). This fixes a regression in
14.0 keyboard registration.

I opted not to make this change in kmxfile but rather in places which
use it in the Keyman Engine COM API, because I wanted kmxfile to remain
truthful about all details of what it is reading from the file.

Given that the COM API will now never return an empty string for the
name of the keyboard, there are  mitigations for this in Keyman
Configuration which are unnecessary, but it is not harmful for them to
remain there.

Will cherry-pick to stable-14.0.
2021-09-14 08:24:17 +10:00
Marc Durdin
67bfdb970b fix(windows): Handle disabled profiles and invalid language ids
Fixes #4490.
Fixes #4435.

There are three parts to this:

1. Ensure that transient language profiles associated with a disabled
   keyboard are enumerated correctly
2. Stop trusting `LocaleNameToLCID` when it returns a transient language
   id, as it sometimes reports out-of-date values. We don't need to
   trust it in these cases anyway, because we have already collected the
   relevant transient language data from Win8Languages.
3. Finally, setting the profile GUID to `GUID_NULL` is simply tidyup,
   which does not have impact on the running code currently but makes
   state consistent.

I believe that part 2 fixes #4435 because the symptoms are identical.
But as I am unable to repro that particular issue on my machine thus
far, that is an assumption. Hopefully we can get a good test result from
@MakaraSok.
2021-03-10 10:34:55 +11:00
Marc Durdin
558c8013ee feat(developer): improve BCP 47 canonicalization
Ensures we get a canonical tag per langtags.json as far as we possibly
can. This is a breaking change for the compiler as tags which were
formerly regarded as canonical are no longer regarded that way. This
mostly relates to script subtag but a secondary bug meant that some
other tags would have lost data in the canonicalization process
(because we did a lookup based only on the language subtag previously,
which is a no-no).

See keymanapp/keyboards#1452 for related work.
2021-02-05 16:56:21 +11:00
Marc Durdin
fdcb8191a8 fix(windows): crash for Sinhala mitigation
Fixes #4337.

The Sinhala language installation mitigation needed the BCP 47 code as
well as the language code with the new language installation process.
2021-02-01 08:30:16 +11:00
Marc Durdin
f2fc0f0098 chore: address review comments 2020-12-23 09:56:39 +11:00
Marc Durdin
95a6e1b446 fix(windows): fixup mitigation for legacy keyboards
Fixes #4184.

If a package had a keyboard with language metadata, it would not
load that language data correctly, which then meant it would not
apply the mitigation correctly either, leading to a double elevation
dialog as Keyman tried to fallback to primary language.
2020-12-21 11:23:53 +11:00
Marc Durdin
227e023cdd fix(windows): disable mitigation for Windows 10 build 19597 and later
Fixes #1285.

If running Windows 10 19597 or later, the underlying issue has
been addressed, so disable the mitigation for new installs of
the keyboard. Does not attempt to change the language code if
the keyboard is already installed.
2020-12-21 08:56:34 +11:00
Marc Durdin
e9723251fb fix(windows/engine): Build 19597 update
Build 19597 of Windows 10 no longer causes the issue with Amharic,
Tigrinya and Sinhala keyboards failing to register and activate
correctly.
2020-12-21 08:23:51 +11:00
Marc Durdin
e83061ef80 fix(windows): ensure mitigation works with new registration strategy
The keyboard profile and registration strategy was not taking into
account the mitigation for Win10 1803 (#1285) and this meant that the
Amharic, Tigrigna and Sinhala keyboards would not install correctly.
2020-12-21 08:20:28 +11:00
Marc Durdin
246cb70840 fix(windows): Warn if we reach maximum transient languages
Fixes #3749.
Fixes #3759.

Adds a warning dialog when user attempts to add a transient language to
a keyboard but the maximum number of transient languages is already
installed.

If this issue arises when a user is installing a keyboard for the first
time, Keyman instead installs the keyboard for the user's default
language. This may be a little confusing, but the error condition is
difficult to explain and non-technical users will probably be stuck
and need to install under their default language in any case. Happy to
receive any pushback on this decision.
2020-12-16 09:09:19 +11:00
Marc Durdin
bbfe5adcc8 fix(windows): crash with package online update
Fixes #4005.

The wrong object was being freed which caused an access violation
internally.
2020-12-01 10:15:05 +11:00
Marc Durdin
5a4287a68d fix(windows): disabling/enabling a profile could have wrong association
Transient language profiles would get the wrong language association
when they were disabled and re-enabled.

Fixes #3798.
2020-10-30 14:20:00 +11:00
Marc Durdin
82e15bead0 fix(windows): remove obsolete Reboot flag
The Reboot flag was never set by any Keyman code any longer. Thus,
removing to simplify code pathways for applying config changes.
2020-10-26 09:10:02 +11:00
Marc Durdin
827ea6c386 fix(windows): upgrading disabled keyboards
Fixes #3561.

Resolves issues with upgrading disabled keyboards, and fixes a secondary
issue where Windows was giving us invalid LANGIDs for locales, which was
causing trouble with transient LANGIDs.
2020-09-29 20:25:10 +10:00
Marc Durdin
301a76c88a fix(windows): upgrading transitional profiles
Relates to #3561.

If a keyboard is installed for a transitional profile but another
keyboard is already installed for that profile, then Keyman would
crash, expecting the transitional profile to be missing.
2020-09-29 09:08:47 +10:00
Marc Durdin
ffc0b21a46 chore(windows): cleanup comments 2020-09-23 17:47:08 +10:00
Marc Durdin
8fc7421391 fix(windows): add back support for disabling keyboards
Fixes #3560. This reworks the functionality for disabling
keyboards to work with the new TIP registration pattern. Much
of the code is the same as in Keyman 13, but there are some
significant differences, so it all needs to be reviewed.
2020-09-23 17:37:08 +10:00
Marc Durdin
9f2d99b5c7
Merge pull request #3552 from keymanapp/fix/windows/upgrade-profile-scenarios
fix(windows): upgrade of profiles from 13.0
2020-09-04 11:33:23 +10:00
Marc Durdin
2df50c07ba
Merge pull request #3545 from keymanapp/fix/windows/3485-canonicalization
fix(windows): BCP 47 tag canonicalization
2020-09-04 11:33:09 +10:00
Marc Durdin
3d65466cff
Merge pull request #3543 from keymanapp/fix/windows/simplify-profile-uninstall
fix(windows): simplify profile uninstall
2020-09-02 16:53:19 +10:00
Marc Durdin
edfabc5447
Merge pull request #3542 from keymanapp/feat/windows/map-installed-bcp47
feat(windows): map installed bcp47
2020-09-02 16:53:09 +10:00
Marc Durdin
69227beb2a fix(windows): upgrade of profiles from 13.0
This upgrades a 11.0-13.0 install to the 14.0 model for registered TIPs.
It does not yet deal with transient TIPs or disabled keyboards (these
will come in a separate PR). There is also more tidy up coming in a
future PR for language names.
2020-09-02 16:46:58 +10:00
Marc Durdin
6d5ccbd719 fix(windows): add tests and improve canonical options 2020-09-01 09:41:33 +10:00
Marc Durdin
84f0219541 fix(windows): canonicalization
Reworks the BCP 47 tag canonicalization algorithm.
2020-09-01 08:42:56 +10:00
Marc Durdin
b3f5f586cb fix(windows): simplify profile uninstall 2020-08-31 16:32:53 +10:00
Marc Durdin
b1b3f62b18 feat(windows): map installed bcp47
This PR handles the case where Windows installs a BCP 47 tag that may not
match our tag 100% precisely. In this case, Keyman maps the Windows BCP 47
tag to the in-memory data for consistency. It also allows for install of
more complex tags.
2020-08-31 14:11:25 +10:00
Marc Durdin
6c1d93e399 chore: address review comments 2020-08-28 15:37:44 +10:00
Keyman Server
97a16e8535 feat(windows): profile installation - engine 2020-08-26 11:06:10 +10:00
Marc Durdin
d030602e3d fix(windows): more localedtd cleanup 2020-07-29 08:04:32 +10:00
Marc Durdin
a0c0141092 feat: more work towards bootstrap 2020-07-03 13:42:12 +10:00
Marc Durdin
9779792059 fix(windows): remove errlogpath and cleanup 2020-03-27 11:23:51 +11:00
Marc Durdin
17c08d53f6 [Windows] Fixes #1336. Fixes #1270. Package info was not being read from JSON even when available which meant we lost Unicode values 2018-12-11 11:23:17 +11:00
Marc Durdin
a2596b49d9 [Windows] Fixes #1285. Adds a mitigation for issues with installation under certain languages in Windows 10 1803 and later 2018-11-02 09:43:38 +11:00
Marc Durdin
c5e553782e Fixes #975. Fixes #996. Installation of keyboards in Windows avoids some side effects with refresh and additional system keyboards. 2018-06-18 16:08:35 +07:00
Marc Durdin
ae22b52ec5
Merge pull request #964 from keymanapp/windows-strip-script-subtag-on-windows-7-keyboard-install-919
[Windows] Strip script subtag on Windows 7 before installing keyboard as script subtag not supported.
2018-06-08 10:34:02 +07:00
Marc Durdin
55aa150d20 Fixes #919 (again). Strip script subtag on Windows 7 before installing keyboard as script subtag not supported. 2018-06-08 10:16:33 +07:00
Marc Durdin
112c517823 Fix merge conflict 2018-06-06 15:53:47 +07:00
Marc Durdin
dc76e53067 Fixes #888. Untitled keyboards will now show the filename of the keyboard in Keyman UI 2018-06-06 10:45:58 +07:00
Marc Durdin
67333c95f6 Fixes #919. Keyboards with custom BCP 47 language tags will now install on Windows 7 with a fallback language. 2018-06-05 16:30:40 +07:00
Marc Durdin
16669e7415
Merge pull request #915 from keymanapp/windows-dont-crash-if-kvk-doesnt-install-5611
[Windows] Avoid crashing if a kvk file is invalid in a package.
2018-05-29 13:06:10 +07:00
Marc Durdin
b79a2596a1 Fixes #5611. Avoid crashing if a kvk file is invalid in a package. 2018-05-29 08:49:41 +07:00
Marc Durdin
1b9f64f811 Avoid issues when invalid tags are given 2018-05-25 08:15:03 +07:00
Marc Durdin
f6b2977aac Fixes #886. Fixes #887. BCP 47 tags will now be canonicalized and scripts applied where possible and needed, automatically, during keyboard installation 2018-05-24 16:04:33 +07:00
Marc Durdin
eb8a52dbf8 Fixes #515, IKeymanKeyboardFile.DefaultHotkey not implemented 2018-05-08 13:27:13 +07:00
Marc Durdin
ac2b6ed87e Add test cases and complete code paths for keyboard language info in COM API 2018-02-21 23:28:58 +07:00
Marc Durdin
26980fd5c3 Refactor kpinstallkeyboard slightly for language information passing 2018-02-21 14:30:08 +07:00
Marc Durdin
da3056c25f Basic support for reading language information from package data 2018-02-21 14:14:14 +07:00