Commit graph

28 commits

Author SHA1 Message Date
Ross
0f4e3d1768 feat(windows): core saving context null pointer check 2021-08-17 14:10:44 +10:00
Ross
09611b600d feat(windows): address review comments 2021-08-02 13:23:48 +10:00
Ross
7d5187ae64 feat(windows): add correct memory free calls for core 2021-08-02 13:17:22 +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
3850087109 fix(windows): rename RefreshTag_Process variable
`RefreshTag_Process` should be named `RefreshTag_Thread`.
2021-02-02 14:58:59 +11:00
Marc Durdin
ca7ab8a7d8 fix(windows): improve cross-process refresh
Two changes here:

1. Only post the refresh message to the master controller, so that we
   get a single refresh regardless of how many controllers are
   registered.

2. When Keyman is restarted, the global RefreshTag is reset to 0, so we
   need to do a `!=` comparison rather than a `<` comparison to ensure
   that apps with an existing keyman32.dll/keyman64.dll in memory get
   refresh notifications (as their local `RefreshTag_Process` will
   likely already be greater than `0`).

Also a small additional debug statement.
2021-02-02 14:55:02 +11:00
Marc Durdin
07e9402f0c fix(windows): Refresh setings on 64-bit apps
Fixes #4289.

Some settings changes would not apply immediately for 64-bit apps, as
the refresh was not being processed until keymanx64 received focus (i.e.
never, as keymanx64 does not have a visible window!)
2021-02-01 07:42:20 +11:00
Marc Durdin
15d2182255 fix(windows): maintain use of refreshtag 2020-12-17 11:19:13 +11:00
Marc Durdin
cea564a072 fix(windows): Improve refresh performance
When a keyboard is installed, Keyman will now only refresh its internal
state on a given thread when that thread receives focus and/or input,
rather than immediately. This will dramatically reduce the chatter
caused by Keyman Engine when a keyboard is installed or settings are
changed.
2020-12-17 11:13:18 +11:00
Marc Durdin
9e46b555d9 fix(windows): Rename to Keyman
Fixes #4003.

This addresses the majority of locations where we use the name "Keyman
Desktop" in code. There will be some filenames and paths that do not
change at this point -- particularly at a source level. For now, the
focus is on the user interface changes.

While making these changes, I also made the VERSION and MANIFEST
resources more consistent.
2020-12-02 09:56:14 +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
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
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
0406cb1381 fix(windows): coverity reports for keyman32 2020-10-02 14:54:43 +10:00
Marc Durdin
603e3aa04f fix(windows): add transient profile support to keyman32
Keyman32/keyman64 were not reading the new 'Transient Language Profiles'
key which is needed with Keyman 14. Minor tweak to ensure we don't scan
through more profiles than necessary when activating tip in aiTIP.cpp also.
2020-08-31 11:17:48 +10:00
Marc Durdin
fc330e621a fix(windows): tweak preprocessor conditional 2019-11-07 17:24:56 +11:00
Marc Durdin
ccc6498739 fix(windows): Keyman was crashing sporadically
Fixes #2147.

This potentially addresses the issues reported in #2147 where Keyman
would crash due to a race condition as a critical section was not
deleted before attempting to recreate it.

Some logging has been added for debugging these issues.

Also fixes memory leaks and another race on startup relating to loading
the taskbar icon.

There are still some known memory leaks because DLL_THREAD_DETACH is
not called for all threads before keyman32.dll is unloaded, so those
threads don't get the opportunity to clean themsselves up. However, the
key danger with the csGlobals critical section has been addressed.
2019-11-06 17:44:32 +11:00
Marc Durdin
d1f9389825 [Windows] Close down serial key event server after unhooking hooks, as low level keyboard hook relies on it. 2019-10-01 19:41:15 +10:00
Marc Durdin
e6d614af15 [Windows] Keyman32/keyman64 should detach without cleanup on process termination (relates to #1723) 2019-06-03 09:34:08 +10:00
Marc Durdin
e67519b0d8 [Windows] Remove legacy API endpoints 2019-01-07 12:43:43 +11:00
Marc Durdin
0f706d94f3
Merge branch 'master' into windows-engine-metro-support-rebased 2018-10-29 16:34:53 +11:00
Marc Durdin
455c2458a4 [Windows] Change the vk_prefix (zap) code from 0x07 to 0x0E to avoid Game Bar conflict and make it customisable via registry 2018-10-23 09:04:24 +11:00
Marc Durdin
b395f7b122 [Windows] Remove USE_SERIALEVENTSERVER define 2018-10-19 05:34:48 +11:00
Marc Durdin
738e1946a6 [Windows] Debug logging and proof of concept tests for keyboarding support within metro-style apps
[Windows] More tidyup and robustness for metro app support - debug cleanup and serialization of input (not quite finished)

[windows] Refactor serialized input code when used with key event thread model

[windows] Add consistent precompiled headers for other projects

[windows] Merge console window test into metro support

[Windows] Tidy up work and identify additional TODOs for metro-style app support

[Windows] Ensure error case falls through to default hook processing for console windows

[Windows] Refactor shared memory into memory mapped file so we can cross 32-64 bit boundary

[Windows] Tweaks to C++ security calls and parameters

[Windows] Start refactor of SerialKeyEvent* classes

[Windows] Rename to SerialKeyEventServer (refactoring)

[Windows] Complete refactoring of SerialKeyEventClient class

[Windows] Further encapsulation and cleanup with 'interfaces' to reduce header pollution

[Windows] Complete serialization fix with move of modifier state management from client thread to server thread to guarantee consistency

[Windows] Replace atom-based keyboard switching with memory mapped file indexed to avoid security constraints

[Windows] Fixup Left Alt+Shift interaction with serializer

[Windows] Use Windows 8.1 SDK for test
2018-10-18 20:00:49 +11:00
Marc Durdin
7e2c21b8a7 [Windows] Refactor serialized input to use a low level keyboard hook to avoid conflicts 2018-10-03 15:22:38 +10:00
Marc Durdin
d2331680b2 [Windows] Address review comments, document, and tidy up constants 2018-10-03 07:01:34 +10:00
Marc Durdin
eff9f834de [Windows] Serialize the processing of true key events and simulated key events generated by Keyman 2018-10-02 10:38:33 +10:00
Marc Durdin
b65b982584 Keyman Desktop and Keyman Developer open source 10.0 alpha seed (#121)
* Keyman for Windows 10.0 Open Source

* Squashed 'windows/src/ext/jedi/jedi/' content from commit f444ad2

git-subtree-dir: windows/src/ext/jedi/jedi
git-subtree-split: f444ad2da4693851e523f1ea6bd541f701904c24

* Squashed 'windows/src/ext/jedi/jcl/' content from commit d63d3c9fd

git-subtree-dir: windows/src/ext/jedi/jcl
git-subtree-split: d63d3c9fd9ff84efdd8159084ec6a60313644243

* Squashed 'windows/src/ext/jedi/jvcl/' content from commit bee19f3b4

git-subtree-dir: windows/src/ext/jedi/jvcl
git-subtree-split: bee19f3b46909fde2fa92c06cd2706f41d99f6c3

* Add required .res files

* Add required .res files

* Add docbook files (forced)

* Add required libxslt

* Add required jedi files

* Add installation files

* Tweak .gitignore for open

* CI

* Remove KMW from Developer source (#122)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Fixup release build and copy license, readme from kmw during build

* Remove obsolete build help documentation

* Keyman Engine 10 on Windows regression for shift states (#129)

* Improve #128 -- cleaner debug messages

* Fixes #127, shift state now resets correctly; and more work for #128

* Fixes #130 (#131)
2017-07-25 10:53:06 +07:00