Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(windows): If alternative TIPs are installed, Keyman may fail to activate on first use #4965

Closed
mcdurdin opened this issue Apr 23, 2021 · 1 comment · Fixed by #5000
Closed

Comments

@mcdurdin
Copy link
Member

Describe the bug

If alternative TIPs such as speech recognition are installed, Keyman may fail to start on first use in a newly started application. Switching the keyboard off and on again will normally work around this.

This issue was first noted in diagnostic investigation at https://community.software.sil.org/t/keyboard-shows-as-on-but-doesnt-work-until-it-is-turned-off-and-on-again/4336

The problem relates to function STDAPI CKMTipTextService::OnActivated(REFCLSID clsid, REFGUID guidProfile, BOOL fActivated) in tmgrsink.cpp:

STDAPI CKMTipTextService::OnActivated(REFCLSID clsid, REFGUID guidProfile, BOOL fActivated) // I3581
{
LogEnter();
guidActiveProfile = GUID_NULL; // I4274
if(IsEqualGUID(clsid, c_clsidKMTipTextService))
{
SendDebugMessageFormat(L"CKMTipTextService::OnActivated(c_clsidKMTipTextService, <GUID>, %d)", fActivated);
if(fActivated) {
guidActiveProfile = guidProfile;
TIPNotifyActivate((GUID *)&guidProfile);
}
else TIPNotifyActivate(NULL);
// --> go it!
}
else {
SendDebugMessageFormat(L"CKMTipTextService::OnActivated(<other-GUID>, <GUID>, %d)", fActivated);
TIPNotifyActivate(NULL);
}
return S_OK;
}

If a non-keyboard TIP is activated, then we should be detecting that on line 167 above and ignoring the activation. Only if a keyboard-type TIP is activated should we be deactivating Keyman.

To Reproduce

Installing speech recognition may trigger this behaviour but that may not be deterministic if the activation order differs.


Keyman for Windows/macOS/Linux:

  • OS: Windows 10
  • Keyman version: 14.0.271
  • Target Application: any
@mcdurdin
Copy link
Member Author

Note that despite the fActivated flag being passed, it seems that this function is only ever called on activation, not on deactivation -- the logs never show any fActivated == 0.

mcdurdin added a commit that referenced this issue Apr 29, 2021
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`.
@mcdurdin mcdurdin modified the milestones: A15S3, A15S4 May 2, 2021
mcdurdin added a commit that referenced this issue May 7, 2021
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

1 participant