keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
390 stars 108 forks source link

bug(windows): cs_pinyin keyboards not inputting text to app in Windows 11 #8697

Closed rc-swag closed 1 month ago

rc-swag commented 1 year ago

Describe the bug

In Windows 11 when using either the simplified Chinese keyboard or the IMsample keyboard nothing is input into the applications at the cursor after selecting the input from the IMC window for the second application opened. This was discovered when testing #8593 Two things have been observed by the testers

  1. The first application opened whether TSF or not does work correctly. However...
  2. When switching apps between apps it does not track focus correctly and no text is input at the cursor point of application when text options are selected from the IMC input window.

Related #6588

Reproduce the bug

Taken from the Windows Acceptance test cases.

Related issues

6588

Keyman apps

Keyman version

16

Operating system

Windows 11

Device

No response

Target application

No response

Browser

No response

Keyboard name

simplified chinese

Keyboard version

No response

Language name

No response

Additional context

No response

rc-swag commented 5 months ago

Looking at a debug log it was observed that the response from the FindGlyph call back to KeymnIMX.64.dll caused characters to be added to the action queue in the first instance when the keyboard was working. In the second instance, the callback action was instead to emit the keystroke. This means F3 for example (if the third option from the IMC window is chosen) is emitted to the app. This why no keystrokes appear in the application.

Working Log

\aiTIP.cpp  130 TIPProcessKey: Enter VirtualKey=['F3' 0x72] lParam=0   IsUp=0 Extended=0 Updateable=0 Preserved=1
\aiTIP.cpp  187 TIPProcessKey: TSFShiftToShift start with 400, include 0
ess.cpp 155 Key pressed: ['F3' 0x72] Context '|| (len: 0) [ ]'
pp  47  kmtip: KeymanGetContext: Exit: Context does not support manipulation.  Using legacy interaction
\aiTIP.cpp  287 AITIP::ReadContext: transitory context, so use buffered context [Updateable=0]
ess.cpp 96  ProcessEvent: vkey[114] ShiftState[0] isDown[1]
l.cpp   270 IM_CallBackCore: td TIPFUpdatable about to call function [FindGlyph]
l.cpp   164 Core Context: || (len: 0) [ ]
l.cpp   164 Intermediate Context: || (len: 0) [ ]
ess.cpp 109 Process_Event_Core: context app before:   || (len: 0) [ ]
ess.cpp 110 Process_Event_Core: context app after:    |蚶子| (len: 2) [ U+86b6 U+5b50 ]
ess.cpp 111 Process_Event_Core: context cache before: || (len: 0) [ ]
ess.cpp 112 Process_Event_Core: context cache after:  |蚶子| (len: 2) [ U+86b6 U+5b50 ]
\aiTIP.cpp  214 TIPProcessKey: Success, res=1
\aiTIP.cpp  225 TIPProcessKey: restoring shift state from 400 to 400
pp  47  kmtip: _KeymanProcessKeystroke (72 0 update preserved ex=4b4d0000)
\aiTIP.cpp  130 TIPProcessKey: Enter VirtualKey=['F3' 0x72] lParam=0   IsUp=0 Extended=0 Updateable=1 Preserved=1
\aiTIP.cpp  187 TIPProcessKey: TSFShiftToShift start with 400, include 0
ess.cpp 155 
\appint.cpp 62  App::QueueAction: QIT_CHAR 86b6
\appint.cpp 62  App::QueueAction: QIT_CHAR 5b50

Error Log

\globals.cpp    47  kmtip: _KeymanProcessKeystroke (72 0  preserved ex=4b4d0000)
n32\appint\aiTIP.cpp    130 TIPProcessKey: Enter VirtualKey=['F3' 0x72] lParam=0   IsUp=0 Extended=0 Updateable=0 Preserved=1
n32\appint\aiTIP.cpp    134 TIPProcessKey: Scan code was zero so using cached scan code 0
n32\appint\aiTIP.cpp    187 TIPProcessKey: TSFShiftToShift start with 400, include 0
n32\kmprocess.cpp   155 Key pressed: ['F3' 0x72] Context '|| (len: 0) [ ]'
\globals.cpp    47  kmtip: GetLeftOfSelection: Exit -- no text in edit control, treating as transitory
n32\appint\aiTIP.cpp    287 AITIP::ReadContext: transitory context, so use buffered context [Updateable=0]
n32\kmprocess.cpp   96  ProcessEvent: vkey[114] ShiftState[0] isDown[1]
n32\calldll.cpp 270 IM_CallBackCore: td TIPFUpdatable about to call function [FindGlyph]
n32\calldll.cpp 164 Core Context: || (len: 0) [ ]
n32\calldll.cpp 164 Intermediate Context: || (len: 0) [ ]
n32\calldll.cpp 129 kmnToCoreActionItem: Emit Action:[QIT_VKEYDOWN] Key:[72] 
n32\calldll.cpp 129 kmnToCoreActionItem: Emit Action:[QIT_VKEYUP] Key:[72] 
rc-swag commented 5 months ago

I have pushed commit here Which fixes this issue,that is the second application not working with the cs_pinyin keyboard. That PR https://github.com/keymanapp/keyboards/pull/64 I believe needs a bit more work before it is ready to merge.

rc-swag commented 5 months ago

In the end this is a duplicate of #6588

rc-swag commented 1 month ago

https://github.com/keymanapp/keyboards/pull/64 is now merged which fixes this issue