Commit graph

276 commits

Author SHA1 Message Date
Marc Durdin
76f77857c5 fix(windows): crash installing package with a race
Fixes #3801.
Fixes #3802.
Fixes KEYMAN-WINDOWS-5M.
Fixes KEYMAN-WINDOWS-5N.

This is a two-part fix for Keyman Configuration where it appears there
was a race with creating a temporary file, and which caused a cascading
exception.

The first part resolves the race; the second part (in
UfrmInstallKeyboard.pas) adds a little extra robustness (probably not
totally necessary).
2020-10-30 16:52:17 +11:00
Marc Durdin
4b970fefbf
Merge pull request #3779 from keymanapp/fix/windows/3650-remove-msctf-dllmain-free
fix(windows): remove msctf free from DllMain
2020-10-29 06:43:49 +11:00
Marc Durdin
3178495e58
Merge pull request #3772 from keymanapp/fix/windows/3562-start-keyman-on-demand-keyman32
fix(windows): Start Keyman on Demand - keyman32
2020-10-29 06:43:42 +11:00
Marc Durdin
fc7b51c4ca fix(windows): remove msctf free from DllMain
Fixes #3650.

This removes the bad call to `FreeLibrary` that was still present in
a callee of `DllMain` in keyman32. The refactor moves responsibility for
loading TSF to the `SelectKeyboard` functions and gets rid of the
associated thread globals.

The `TSFINTERFACES` struct is of course a future candidate for a class.

In the process I removed a lot of cruft from keyman32.cpp which was
either obsolete, irrelevant or just plain wrong. None of which had
material impact on the running code.
2020-10-28 16:17:52 +11:00
Marc Durdin
3e9f397b27 chore(windows): small cleanups
1. Remove unused variables
2. Remove invalid build configurations
3. Move hotkey checks before touch keyboard panel check, so hotkeys
   still work when touch panel is active; the touch keyboard panel check
   is there to disable serialised input which conflicts with it.
2020-10-28 10:27:24 +11:00
Marc Durdin
c66eb49163 fix(windows): Start Keyman on Demand - keyman32
This is the first half of a two-part update to Keyman for Windows. There
are two significant changes here. These changes apply to
keyman32/keyman64, as well as kmtip/kmtip64, but will refer to the
32-bit equivalents for simplicity:

1. Instead of using `GetProcAddress` to connect to keyman32.dll, we
   now have an import library connection. This removes one particularly
   suspect piece of architecture for Keyman, as using `GetProcAddress`
   could lead to a race condition, where keyman32.dll is unloaded after
   that function is called but before we use the handle. This makes the
   kmtip.dll build dependent on keyman32.dll; loading kmtip.dll (by
   selecting a Keyman input method) also loads keyman32.dll.

2. It's not enough (yet) to load kmtip.dll. We also need to be running
   keyman.exe itself, due to global hooks that we still require (it may
   be possible, one day, to avoid these, but it doesn't look very
   hopeful). To that end, kmtip calls new function `TIPIsKeymanRunning`
   to check whether keyman32.dll is initialised (and hence keyman.exe
   has initialised it). Then, if keyman.exe is not running, it issues an
   event to the Windows Event Log, which we will pick up with a
   scheduled task in the next PR.

The first part of this is an architectural change which may lead to some
change in behaviours, as keyman32.dll now may not be unloaded from a
process when keyman.exe exits, due to the lock that kmtip.dll now has on
it. It will be important to test this (@MakaraSok) by running through
various startup and shutdown scenarios. In my initial testing, I found
that there were some situations after restarting keyman.exe where I
needed to switch in and out of the Keyman TIP, but those were not all
critical.

This change also lays groundwork for an eventual ability to run the
Keyman input method without keyman.exe running, which will be helpful
e.g. on login screen, even if missing certain additional functionality
such as the serialised input queue.
2020-10-28 06:10:22 +11:00
Marc Durdin
7a722639bb
Merge pull request #3753 from keymanapp/fix/windows/3518-config-auto-apply
fix(windows): Keyman Configuration changes apply instantly
2020-10-27 13:07:26 +11:00
Marc Durdin
79b41d0627
Merge pull request #3754 from keymanapp/fix/windows/remove-double-refresh
fix(windows): Remove double refresh
2020-10-27 10:38:25 +11:00
Marc Durdin
4269a4dbc4 fix(windows): Remove double refresh
Both the win32 and the win64 keyman engine libraries would receive a
refresh notification, and then they'd both broadcast the change. This
change limits the broadcast responsibility to the 32-bit engine.
2020-10-26 15:26:08 +11:00
Marc Durdin
11a2cf53c5 fix(windows): Keyman Configuration changes apply instantly
Fixes #3518.

Changes in Keyman Configuration will now apply immediately. This removes
the OK and Cancel buttons from the dialog and means that all actions
are consistent in when they are applied, unlike previously. This also
matches the Windows 10 Settings metaphor and metaphors for most modern
apps and devices.

For now, I have placed a message where the OK and Buttons were
previously, to help existing users understand the change. In time, I
expect us to be able to remove that message entirely.
2020-10-26 15:18:04 +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
0ab49191d8 fix(windows): buffer overrun in debug function 2020-10-24 14:46:19 +11:00
Marc Durdin
2da01e2210
Merge pull request #3727 from keymanapp/fix/windows/tsysinfo-clearer-upload-failure
fix(windows): improve tsysinfo upload messages
2020-10-22 14:49:24 +11:00
Marc Durdin
3d324b20aa
Merge pull request #3719 from keymanapp/fix/windows/3694-tweak-scrolling-in-keyboard-menu
fix(windows): tweak scrolling in keyboard menu
2020-10-20 18:31:21 +11:00
Marc Durdin
9ab40d9b48 fix(windows): improve tsysinfo upload messages
If tsysinfo fails to upload a diagnostic report, give more detail on
what happened.
2020-10-20 18:18:57 +11:00
Marc Durdin
929e32601c chore(windows): remove debug code 2020-10-19 16:33:59 +11:00
Marc Durdin
3935699262 fix(windows): tweak scrolling in keyboard menu
Fixes #3694.

The keyboard menu would sometimes scroll too far, which could be
confusing for the end user. This fix stops the scroll once the last
item is in view; it also tweaks the down arrow key handler to ensure
that the current item is correctly scrolled into view.
2020-10-19 16:31:08 +11:00
Marc Durdin
bc7b667f4d fix(windows): RefreshKeyboards loses some profiles
When loading transient language profiles, RefreshKeyboards would reset
the list of profiles (and in so doing, also leak memory). Instead, the
list should be cleared before the initial language profile list load.
2020-10-19 08:38:25 +11:00
Marc Durdin
3edec559ec fix(windows): disabled keyboards listed in hotkeys
Fixes #2942.
2020-10-09 11:13:11 +11:00
Marc Durdin
3c32267a50 chore: don't add tag to version in filenames
While it might be nice to add the tag to versions in filenames, this
creates a lot of work on the website where we make some filename
assumptions. So, this PR winds that detail of filename changes back,
and renames copydev.in to download.in to make it consistent with the
other download.in files.
2020-10-08 14:59:59 +11:00
Marc Durdin
facf94df26 chore: address review comments 2020-10-08 13:59:16 +11:00
Marc Durdin
c655c4eaf5 fix(windows): improve version numbers
Release build executables should have 3 component version numbers with
the version tag appended, e.g. keymandesktop-14.0.155-alpha-local.exe.

Coming later, rename keymandesktop-version.exe to keyman-version.exe.
2020-10-08 09:13:48 +11:00
Marc Durdin
f3d5fcbb28
Merge pull request #3668 from keymanapp/fix/windows/cherry-pick/3665-metro-apps-compat
fix(windows): Some registry keys could have incorrect permissions 🍒
2020-10-08 06:20:59 +11:00
Marc Durdin
258e4b4eff fix(windows): Some registry keys could have incorrect permissions
Fixes #3665.

On some systems, subkeys of HKCU\Software\Keyman could have incorrect
permissions and these would not be corrected with earlier fixes such as
in #2316. This fix resolves the problem by recursively correcting
permissions on all subkeys, rather than just the top two levels.

This issue caused Metro-style applications (Windows Store apps) to fail
to accept Keyman keyboard input.
2020-10-07 11:50:37 +11:00
Marc Durdin
53a197fba5 chore(windows): Move to Windows SDK 10.0.17763.0
This removes the requirement for the Windows 8.1 SDK.
2020-10-05 14:11:34 +11:00
Marc Durdin
0275f13e6c
Merge pull request #3649 from keymanapp/fix/engine/coverity-keyman32
fix(windows): coverity reports for keyman32
2020-10-05 13:47:08 +11:00
Marc Durdin
1d4307b2e9
Merge pull request #3642 from keymanapp/fix/engine/coverity-kmtip
fix(windows): coverity reports for kmtip
2020-10-05 13:46:59 +11:00
Marc Durdin
c83eb6f727
Merge pull request #3641 from keymanapp/fix/engine/coverity-mcompile
fix(windows): coverity reports for mcompile
2020-10-05 13:46:49 +11:00
Marc Durdin
7f70c14b2a fix(windows): Cast HANDLE types using PtrToInt 2020-10-05 09:30:55 +11:00
Marc Durdin
0406cb1381 fix(windows): coverity reports for keyman32 2020-10-02 14:54:43 +10:00
Marc Durdin
f691946f1c fix(windows): coverity reports for kmtip 2020-09-30 17:20:36 +10:00
Marc Durdin
146dd0acc5 fix: coverity reports for mcompile 2020-09-30 14:53:47 +10:00
Marc Durdin
1df49317c9 fix(windows): coverity reports for mcompile 2020-09-30 14:50:22 +10: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
5f59ee08ec chore(windows): make disabled arrows lighter 2020-09-28 15:05:58 +10:00
Marc Durdin
e34478c173 feat(windows): scrollable keyboard menu
Fixes #1843.

If there are so many keyboards installed that the menu would grow larger
than 3/4 of the screen height, then the menu will become scrollable.
2020-09-28 12:17:00 +10:00
Marc Durdin
d56567735e feat(windows): overflow menu for osk toolbar
Fixes #1659.

If there are too many keyboards to fit in the OSK toolbar, the toolbar
will now show a dropdown menu button and excess keyboards will be
visible there.
2020-09-27 13:07:45 +10:00
Marc Durdin
4fe1b16b1d fix(windows): cleanup hardcoded urls in tsysinfo
Relates to #3394.

Cleans up remaining hardcoded URLs in TSysInfo. Note that UfrmAbout.dfm
is removed because it is not used.
2020-09-25 11:11:14 +10:00
Marc Durdin
d5790ca9b6 fix(windows): cleanup pointer to int typecasts
Fixes #3084.

This does two things:

1. Cleans up a bunch of places where we used to use `(int)` typecasts
   for pointer math, which was problematic. We now use `(INT_PTR)` per
   MSDN https://docs.microsoft.com/en-us/windows/win32/winprog64/rules-for-using-pointers
   and then cast that down to `(int)` where necessary, e.g. when storing
   string lengths which are never going to be more than a few hundred
   characters! Doing this explicitly helps to clarify that we are aware
   of the typecast and believe it to be safe.

2. Adds in some build infrastructure for future use of Coverity Scan
   https://scan.coverity.com/ which we plan to use for further code
   quality updates. I have submitted the project to Coverity and are
   now waiting for approval so we can check results. Once we have
   approval, I do plan to add this to the nightly build (we need to
   keep submissions under 3 builds/day).

   Note: I have not yet added Keyman Core (Windows) to this project,
   nor are we currently building Keyman Core (macOS) or Keyman for
   Linux, but we should consider adding those in future.
2020-09-24 14:39:59 +10:00
Marc Durdin
ffc0b21a46 chore(windows): cleanup comments 2020-09-23 17:47:08 +10:00
Marc Durdin
ded5ed94ad fix(windows): cleanup 2020-09-23 17:44:26 +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
f08fd6090d fix(windows): hint dialog was blank when elevated
Fixes #3110. The hint dialog must be launched unelevated. Refactors
the UCreateProcessAsShellUser unit into the TUtilExecute class.
2020-09-22 20:04:44 +10:00
Marc Durdin
f1b63cc95b
Merge pull request #3558 from keymanapp/fix/windows/language-name
fix(windows): lookup language name on create
2020-09-21 15:32:34 +10:00
Marc Durdin
5f3987b988 fix(windows): lookup language name on create
Lookup a language name from various sources rather than using the
BCP 47 code, where possible.
2020-09-04 13:17:10 +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