Commit graph

386 commits

Author SHA1 Message Date
Marc Durdin
06a92a986f chore(windows): Keyman_PostControllers returns void 2021-06-10 12:28:20 +10:00
Marc Durdin
16ac56f786 chore(windows): def declaration order 2021-06-10 11:21:22 +10:00
Marc Durdin
cda2272ccb fix(windows): restore endpoints for interface stability
Fixes #5245.

Interfaces should remain stable between versions of Keyman, so that an
upgraded kmcomapi.dll or keyman32.dll will not crash older clients, even
if they may not behave entirely as expected.
2021-06-10 11:19:29 +10:00
Marc Durdin
8ca0fc7928 fix(windows): fix common include paths 2021-06-02 13:52:14 +10:00
Marc Durdin
1dbad94d78 fix(windows): makefile paths 2021-06-02 13:52:12 +10:00
Marc Durdin
4a09dd3b48 feat(windows): add common core libraries and includes 2021-06-02 13:52:11 +10:00
Marc Durdin
1b340077b5
Merge pull request #5202 from keymanapp/fix/windows/5196-keymanx64-start-with-shellexecute
fix(windows): start keymanx64 with ShellExecute
2021-06-01 12:13:47 +10:00
Marc Durdin
f29c71d988
Merge pull request #5187 from keymanapp/fix/windows/5166-sentry-dll-handling
fix(windows): sentry.dll version handling
2021-06-01 05:59:26 +10:00
Eberhard Beilharz
b0358509c0
Merge pull request #5169 from keymanapp/fix/linux/issue-5072
fix(common/core/desktop): Fix failing tests on armhf
2021-05-31 14:58:29 +02:00
Marc Durdin
c4d7a6d58c fix(windows): start keymanx64 with ShellExecute
Fixes #5196.

It is complicated to start a `UIAccess=true` process with
`CreateProcess`, so instead we'll use `ShellExecute`. This means passing
a PID instead of a process handle to keymanx64.

I took the opportunity to refactor slightly the main function in
keymanx64, as the failure modes were pretty WET.
2021-05-31 19:26:36 +10:00
Marc Durdin
c9897bb38f fix(windows): cleanup edge cases in k32_load
Matches work completed in #5169 for Keyman Core, kmx_file.cpp.

While this code will hopefully disappear in 15.0, it's good to make sure
we aren't diverging beforehand.

Also tidies up a couple of other cases in `CopyKeyboard` in Keyman Core.
2021-05-31 10:58:23 +10:00
Marc Durdin
733d112d05 fix(windows): swap default for flag 2021-05-29 16:16:14 +10:00
Marc Durdin
9fbcc3fd7b fix(windows): avoid cached hotkey state 2021-05-29 15:41:35 +10:00
Marc Durdin
7235bf2057 fix(windows): sentry.dll version handling
Fixes #5166.

This introduces versioned management of sentry.dll for Keyman for
Windows, Keyman Engine and Keyman Developer. As sentry.dll's ABI is not
backwardly compatible, we have to maintain independent copies of each
DLL for each app.

sentry.dll (or sentry.x64.dll for x64 apps) will be found in the
sentry-0.4.9 folder relative to the running process, except when running
from within the keyman repo tree (based on presence of KEYMAN_ROOT env
var). In those cases, the windows/src/ext/sentry sentry.dll will be
used, allowing us to test new debug time sentry DLLs easily.

A little bit of cleanup and consolidation was also done in the
KeymanPaths.pas unit.
2021-05-28 15:55:06 +10:00
Marc Durdin
e46a3ee46c
Merge pull request #5143 from keymanapp/chore/windows/vs2019
chore(windows): move to vc++ 2019
2021-05-25 19:38:32 +10:00
Marc Durdin
17518ca2ee chore(windows): update headers for mcompile 2021-05-25 18:33:46 +10:00
rc-swag
0fd5f01187
Merge pull request #5119 from keymanapp/docs/windows/5118-windows-keyman-engine-readme
docs(windows): Initial commit - README.md
2021-05-25 16:45:50 +10:00
Marc Durdin
f3ba9445dd chore(windows): update vcxproj for vc++2019 2021-05-25 15:58:48 +10:00
rc-swag
98d802f769
docs(windows): Apply suggestions from code review
Co-authored-by: Marc Durdin <marc@durdin.net>
2021-05-25 08:08:13 +10:00
Ross Cruickshank
4bbd242161 docs(windows): adding README.md to windows/src
Fixes #5118
2021-05-24 10:32:06 +10:00
Marc Durdin
8e435f67d1 chore(windows): cleanup old .dof, .bdsproj and .cfg files
Fixes #519.

I have removed these .cfg, .dof, and .bdsproj files from the primary
projects in the Windows source. There is some ambiguity as to whether
.cfg files are used by the command line compiler (I checked with procmon
and they *are* read by dcc32.exe), so we will need to make sure that
no adverse changes have been made by this. In theory at least, the
.dproj data trumps .cfg data -- and all the projects in question have
a .dproj file -- so this should be a safe cleanup.

I have opted not to touch the /buildutils, /ext, /support and
/test folders at this point.
2021-05-24 10:22:28 +10:00
Ross Cruickshank
f98cef1573 docs(windows): Update windows/engine/readme 2021-05-20 15:37:20 +10:00
Ross Cruickshank
5be6825721 docs(windows): Initial commit - README.md 2021-05-20 13:43:44 +10:00
Marc Durdin
c078661a0f chore(windows): remove unused keymanx64 parameter
With the recent refactor in #5060, we no longer need the main form
window handle parameter in keymanx64.
2021-05-11 16:03:19 +10:00
Marc Durdin
9c01777ece chore: add missing file 2021-05-11 15:51:20 +10:00
Marc Durdin
d26b01ad99 chore(windows): remove KMC_CHANGEUISTATE
The `KMC_CHANGEUISTATE` flag for `wm_keyman_control` is no longer
processed anywhere. Removes it and the `UpdateKeymanUI` function which
called it.

The `#define` for the flag has been left, commented out, to clarify what
would otherwise be a gap in identifiers (use `git blame` to learn more).
2021-05-11 15:19:01 +10:00
Marc Durdin
fbcfd62678 fix(windows): refactor controller windows
Fixes #5004.

This cleans up the use of controller windows. A single window is now
given the responsibility of being the master controller, which receives
messages from Keyman32 and other components around UI activation, active
keyboard, etc.

The master controller is keyman.exe's `TApplication` window, which does
not get destroyed and recreated, unlike the main form window.

Any thread which has responsibility for Keyman UI (keyman.exe main
thread, keymanx64.exe main thread) is also registered as a controller
thread. A controller thread has special handling for interactions with
keyman32 around focus tracking.

Caveats:

* While keymanx64 does not have a visible window and thus probably does
  not need to be registered as a controller thread, it doesn't really
  hurt.
* Note that keymanx64 registers the 32-bit controller thread as well,
  which again is probably unnecessary as the 64-bit process cannot
  interact with the 32-bit thread.
* Keyman's main form still handles wm_keyman_control messages, as there
  are a number of other components which post to that window (e.g. text
  editor, com library visual keyboard interactions). Unlike the original
  problem trigger, the reference handle is not stored long-term and so
  there is unlikely to be a problem with main form window re-creation
  causing an issue in these contexts.

There are several TODO items in this which I will address in follow-ups,
to reduce the scope of these changes.

I hope to cherry-pick this to stable-14.0, but will run for a while in
15.0 before doing so.
2021-05-11 14:47:17 +10:00
Marc Durdin
cfea41382c chore(windows): remove unused utilrun unit 2021-05-11 08:38:07 +10:00
Marc Durdin
a6a658e8bc
Merge pull request #5002 from keymanapp/fix/windows/4976-redesign-keymanx64-lifecycle
fix(windows): make keymanx64 responsible for its own lifecycle
2021-05-10 19:46:12 +10:00
Marc Durdin
23505d8e7b chore: remove extra file 2021-05-07 17:19:43 +10:00
Marc Durdin
a23266a6b9 chore: address review comments 2021-05-07 17:17:48 +10:00
Marc Durdin
492394c4f6 chore: address review comment 2021-05-07 17:08:11 +10:00
Marc Durdin
ee6f8590a6 fix(windows): make keymanx64 responsible for its own lifecycle
Fixes #4976.
Fixes KEYMAN-WINDOWS-2K.
Fixes KEYMAN-WINDOWS-3F.
Fixes KEYMAN-WINDOWS-5A.
Fixes KEYMAN-WINDOWS-3E.

This fix reworks keymanx64's lifecycle, moving responsibility for
process shutdown from keyman.exe to keymanx64.exe.

This eliminates the need for interprocess communication, and simplifies
the startup and shutdown of keymanx64.exe. Removing this means that we
can more safely handle situations where two instances of keymanx64 may
be started, as one of them will rapidly terminate when it discovers that
its parent process has disappeared.
2021-04-30 15:02:18 +10:00
Marc Durdin
097ce9ac9a fix(windows): avoid disabling Keyman when speech recognition starts
Fixes #4965.

When speech recognition is enabled, it sometimes activates after a
Keyman keyboard is selected. This would cause Keyman to think it is
being deactivated. We needed to check in
`CKMTipTextService::OnActivated` that it was a keyboard-type TIP that
was being activated, and only deactivate the Keyman hooks in that
situation.

This commit also adds a little logging helper function, and removes an
unused variable `guidActiveProfile`.
2021-04-30 09:04:12 +10:00
Marc Durdin
a1066f13a1
chore(windows): review comments
Co-authored-by: rc-swag <58423624+rc-swag@users.noreply.github.com>
2021-04-28 11:06:22 +10:00
Marc Durdin
94b6e1a00f fix(windows): handle errors starting keymanx64
Fixes #4988.
Fixes KEYMAN-WINDOWS-3F.

This relates to #4976 and is a stop-gap until we implement that. It will
reduce the number of reported errors (both to us and the end user) but
does not address the core issue, which requires a more significant
refactor.
2021-04-28 10:37:47 +10:00
Marc Durdin
3a59175465 fix(windows): avoid error if keyman32.dll renamed
Fixes #4939.
Fixes KEYMAN-WINDOWS-70.
Fixes KEYMAN-WINDOWS-71.
Fixes KEYMAN-WINDOWS-BR.
Fixes KEYMAN-WINDOWS-6J.

I am speculating a little here, because the root cause is not visible in
the crash report, but it appears that if keyman32.dll is renamed, that
the UnregisterControllerWindows function attempts to reload keyman32.dll
which means that (a) it no longer has a list of registered controllers,
and (b) it may fail to reload.

Instead of throwing an exception, we now only log this error in
development mode. The error is not likely to cause significant trouble
for end users as they are shutting down Keyman anyway at this point.

The resolution if there is any uncertainty during an upgrade is to
restart Windows. This is less than ideal but avoids file locks and
problems with in-memory DLLs. (Future versions of Keyman will schedule
upgrades to happen automatically after a restart before Keyman has been
started, in an effort to avoid this kind of trauma.)
2021-04-21 14:21:17 +10:00
Marc Durdin
568e4b2e7e fix(windows): help contents broken from tray menu
Fixes #4874.

Opening product help from the tray menu would end up at a broken page.

Given the title of the link is "Help Contents", I have opted to open at
the help contents... (rather than the alternative of context/tray-menu).
2021-04-20 12:54:10 +10:00
Marc Durdin
2563189bfa fix(windows): Change TLangSwitchRefreshWatcher ownership
Fixes #4751.
Fixes KEYMAN-WINDOWS-76.
Fixes KEYMAN-WINDOWS-79.
Fixes KEYMAN-WINDOWS-7B.
Fixes KEYMAN-WINDOWS-7E.
Fixes KEYMAN-WINDOWS-7F.
Fixes KEYMAN-WINDOWS-7K.
Fixes KEYMAN-WINDOWS-7N.
Fixes KEYMAN-WINDOWS-80.

This resolves an issue where the TLangSwitchRefreshWatcher thread would
terminate early on Win7 (as it had no work to do), and free itself, but
then the main form would reference it post-free. Responsibility for free
has been moved to the main form.

This would result in various exceptions as state is corrupted at this
point.
2021-03-23 08:57:24 +11:00
Marc Durdin
aebfdecf7a chore(windows): breadcrumbs
Some of our Sentry reports are difficult to track down. Adding user
interaction breadcrumbs to Keyman Configuration (to start with) may
simplify this. I may add more breadcrumbs to other projects now that
this is available.
2021-03-16 06:57:57 +11:00
Marc Durdin
49f4514b1a
Merge pull request #4663 from keymanapp/fix/windows/4447-trigger-language-sync
fix(windows): Trigger language sync after changes
2021-03-16 05:20:29 +11:00
Marc Durdin
53df62f0b7 chore(windows): 17763 sdk version for kmrefresh 2021-03-15 10:42:21 +11:00
Marc Durdin
1c4e956a20 chore(windows): fixup engine makefile 2021-03-15 10:18:05 +11:00
Marc Durdin
6155b544ea fix(windows): Trigger language sync after changes
Fixes #4447.
Fixes #4222.

The symptoms for these two issues are related: the language associations
change and keyboards stop functioning correctly. The issue is described
in detail in #4447.

Although this fix should be considered 'experimental', we should
probably include it in the release of 14.0, because it fixes a
longstanding issue with Keyman and Windows languages.
2021-03-15 09:43:07 +11:00
Marc Durdin
aae0cb19c4 chore(windows): fully disable auto start task
If the registry setting `HKCU\Software\Keyman
Engine\Debug:Flag_UseAutoStartTask[REG_WORD]` is not `0`, then the this
will enable the restart task. Otherwise, all aspects of it are disabled.

For Keyman 14.0 initial release, we will have this flag disabled. If we
can improve stability of it, we'll consider turning it on.
2021-03-12 16:45:30 +11:00
Marc Durdin
1311d100e6
Merge pull request #4635 from keymanapp/fix/windows/4490-4435-transient-profiles-and-invalid-language-codes
fix(windows): Handle disabled profiles and invalid language ids
2021-03-11 09:11:44 +11:00
Marc Durdin
7436643726
Merge pull request #4628 from keymanapp/fix/windows/4619-hotkeys-correctly-ignore-right-modifiers
fix(windows): hotkeys correctly ignore right modifier keys
2021-03-11 09:11:32 +11: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
24ba51ad70
Merge pull request #4627 from keymanapp/fix/windows/4437-ensure-valid-base-layout-on-install
fix(windows): ensure valid base layout on install
2021-03-09 16:56:36 +11:00
Marc Durdin
5c8d21b204 fix(windows): hotkeys correctly ignore right modifier keys
Fixes #4619.

The hotkey check in keyman32 would ignore right modifier keys, but the
behaviour was not quite right: it actually needs to take the modifier
into account, but just not treat it as a valid modifier.

While fixing this, I noticed that some of the tests in the
`KeyLanguageSwitchPress` function were using the wrong modifier flags. I
wish I had fewer different modifier flag sets but that ship has probably
sailed.
2021-03-09 16:02:14 +11:00