In https://testbot.winehq.org/JobDetails.pl?Key=145554 I have added some debugging information to the SendInput tests.
The spurious layout change happen around the WM_IME_NOTIFY (0x282) message so it's likely that IME is involved.
Below is an excerpt from Win10 JP run (https://testbot.winehq.org/JobDetails.pl?Key=145554&f310=exe64.report#k3...) with some additional inline comments. Notice the spurious layout changes, both after creating the window and also when trying to reactivate the expected layout (0411):
``` ### I was thinking that perhaps the per window layout option is enabled and messing things up, but it doesn't ### seem to be the case. The following is the value of HCKU\Control Panel\Desktop\UserPreferencesMask: input.c:5873: mask=9e 1e 07 80 12 00 00 00 input.c:5876: per-window-layout=0 input.c:5878: hkl=0000000004110411 input.c:5880: hkl=0000000004110411 input.c:4983: hkl=0000000004110411 before create window input.c:5822: hwnd 0000000000010396 msg 0x0081 wp 0000000000000000 lp 0000000000FFECC0 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0083 wp 0000000000000000 lp 0000000000FFED40 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0001 wp 0000000000000000 lp 0000000000FFECC0 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0005 wp 0000000000000000 lp 0000000000640064 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0003 wp 0000000000000000 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0018 wp 0000000000000001 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0046 wp 0000000000000000 lp 0000000000FFED20 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x001c wp 0000000000000001 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0086 wp 0000000000000001 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0006 wp 0000000000000001 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0281 wp 0000000000000001 lp 00000000C000000F hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0282 wp 0000000000000002 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0007 wp 0000000000000000 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0085 wp 0000000000000001 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0014 wp FFFFFFFF910107E4 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0047 wp 0000000000000000 lp 0000000000FFED20 hkl 0000000004110411 input.c:4985: hkl=0000000004110411 after create window input.c:5822: hwnd 0000000000010396 msg 0x0084 wp 0000000000000000 lp 0000000000320032 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0020 wp 0000000000010396 lp 0000000002000001 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0200 wp 0000000000000000 lp 0000000000320032 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x000f wp 0000000000000000 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0282 wp 0000000000000001 lp 0000000000000000 hkl 0000000004110411 ### Layout change from 0411 (JP) -> 0412 (KO) during handling of initial window messages input.c:5822: hwnd 0000000000010396 msg 0x0282 wp 0000000000000002 lp 0000000000000000 hkl 0000000004120412 input.c:5822: hwnd 0000000000010396 msg 0x0051 wp 0000000000000081 lp 0000000004120412 hkl 0000000004120412 input.c:5830: hwnd 0000000000010396 got langchange hkl=04120412 input.c:5822: hwnd 0000000000010396 msg 0x0282 wp 0000000000000006 lp 0000000000000000 hkl 0000000004120412 input.c:5822: hwnd 0000000000010396 msg 0x0084 wp 0000000000000000 lp 0000000000320032 hkl 0000000004120412 input.c:5822: hwnd 0000000000010396 msg 0x0020 wp 0000000000010396 lp 0000000002000001 hkl 0000000004120412 input.c:5822: hwnd 0000000000010396 msg 0x0200 wp 0000000000000000 lp 0000000000320032 hkl 0000000004120412 input.c:4988: hkl=0000000004120412 after create window messages ### Here I have added code to reactivate the original layout manually input.c:4991: Activate layout 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0282 wp 0000000000000001 lp 0000000000000000 hkl 0000000004120412 ### Activation of the 0411 layout seems to work temporarily... input.c:5822: hwnd 0000000000010396 msg 0x0282 wp 0000000000000002 lp 0000000000000000 hkl 0000000004110411 input.c:5822: hwnd 0000000000010396 msg 0x0282 wp 0000000000000001 lp 0000000000000000 hkl 0000000004110411 ### But then we get another layout change, from 0411 -> 0416 this time input.c:5822: hwnd 0000000000010396 msg 0x0282 wp 0000000000000002 lp 0000000000000000 hkl 0000000004160416 input.c:5822: hwnd 0000000000010396 msg 0x0051 wp 0000000000000000 lp 0000000004160416 hkl 0000000004160416 input.c:5830: hwnd 0000000000010396 got langchange hkl=04160416 input.c:5822: hwnd 0000000000010396 msg 0x0282 wp 0000000000000006 lp 0000000000000000 hkl 0000000004160416 ### Although we get a langchange message for 0411... input.c:5822: hwnd 0000000000010396 msg 0x0051 wp 0000000000000080 lp 0000000004110411 hkl 0000000004160416 input.c:5830: hwnd 0000000000010396 got langchange hkl=04110411 ### ... the current layout is not really updated input.c:4999: hkl=0000000004160416 ```