-
Notifications
You must be signed in to change notification settings - Fork 174
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
(Regression) TrackMania Nations Forever under Wine does not always register key releases under IBus 1.5.28 #2480
Comments
Thank you for the test case. |
ibus-x11 now also uses the hybrid process key events with IBUS_ENABLE_SYNC_MODE=2 and it waits for the async API with GSource and g_main_context_iteration() in xim_forward_event(). But g_main_context_iteration() calls gdk_event_source_dispatch() and it can call another xim_forward_event() and the callbacks of ibus_input_context_process_key_event_async() can be nested. So if the forwarding API is called out of the callbacks of ibus_input_context_process_key_event_async(), the key events order is swapped due to the delayed return of g_main_context_iteration(). To resolve this issue, the forwarding API should be called in the callbacks of ibus_input_context_process_key_event_async(). BUG=ibus#2480
I created the tentative patch above. Could you try it? |
@fujiwarat I tried your patch and it appears to fix the problem, I was not able to reproduce the problem in 1h of gameplay of TrackMania Nations Forever (whereas without the patch I reproduced it thrice in 20 minutes). |
Thanks for getting that fixed, any timeline for when this will get merged in? |
Sorry for the late response. Seems #2484 still happens with this patch and I have investigated it. I added an additional patch. |
Hmmmm FWIW some notes from my testing those days:
|
Thank you for the tests. |
ibus-x11 now also uses the hybrid process key events with IBUS_ENABLE_SYNC_MODE=2 and it waits for the async API with GSource and g_main_context_iteration() in xim_forward_event(). But g_main_context_iteration() calls gdk_event_source_dispatch() and it can call another xim_forward_event() and the callbacks of ibus_input_context_process_key_event_async() can be nested. So if the forwarding API is called out of the callbacks of ibus_input_context_process_key_event_async(), the key events order is swapped due to the delayed return of g_main_context_iteration(). To resolve this issue, the forwarding API should be called in the callbacks of ibus_input_context_process_key_event_async(). Fixes: 506ac99 BUG=#2480
@fujiwarat Thanks for this! Is it OK to apply only commit 497f0c7 on top of standard ibus 1.15.28 or is there anything else that is required? |
Any plans to cut a new release with this fix? |
It will be in 1.5.29 (barring some major breakage with the fix is discovered). It's already in 1.5.29-rc1. |
I still have this issue with ibus-1.5.29~rc2-6.fc39.x86_64 (if it is the same issue). When I put this in my ~/.bashrc the issue is also fixed:
I also tested to set this environment variable to 1 but this has no effect - in this case the issue is still there. |
Manjaro Gnome, ibus 1.5.30-1, keys sticking in multiple games (Subnautica, Raft, among others) when running on Proton (GE 9.5, Proton Experimental) through Steam. Seems like maybe this issue? Keys stick and won't release, then suddenly releases after a while on its own. This started happening somewhat recently. I tried using two different keyboards to rule out hardware issues. Adding the following to the command line args in Steam did NOT work:
EDIT: Installing "fcitx5" and adding the following in steam game command line args has helped so far (I'll edit this post if it did not work):
For those coming here for a Manjaro (possibly Arch) solution. |
Have you tried just adding this to the command line args for games? Did not work for me, but I'd be curious to see if this is because of my setup or not. |
Which distribution and version?: Arch Linux (updated as of 2023-02-25)
Which desktop environment and version?: Sway 1.8.1
Which session type?: Wayland
Which application and version?: Wine 8.2, Trackmania Nations Forever
IBus version?: IBus 1.5.28
Issue description:
While playing TrackMania Nations Forever under Wine, I noticed that sometimes (once in a few minutes) the car continued steering after fully releasing the corresponding input key on my keyboard. Pressing and re-releasing the corresponding input fixed the problem. So, it appears that the game failed to register the key release event.
After some troubleshooting it appears the problem appeared with IBus 1.5.28. Killing IBus or downgrading to IBus 1.5.27 fixes the problem.
The problem seems related to commit 506ac99. Setting
IBUS_ENABLE_SYNC_MODE=1
when launching the IBus 1.5.28 daemon fixes the problem as well.Steps to reproduce:
Can you reproduce your problem when you restart ibus-daemon?: Yes
Do you see any errors when you run ibus-daemon with the verbose option?: No
Can you reproduce your problem with a new user account instead of the current your account? Yes
Additional information & test program
Since reproducing the bug in Wine is quite hard and uninformative I tried writing a standalone test program (see below) to try to reproduce and debug the issue.
I observe the following problems under
IBUS_ENABLE_SYNC_MODE=2
but not underIBUS_ENABLE_SYNC_MODE=1
:When randomly pressing keys the errors "ERROR: PRESSING ALREADY PRESSED KEY?" and "RELEASING ALREADY RELEASED KEY?" are printed quite often.
Often both the key release and key press events are delived out-of-order (release then press). Most likely this is what causes TMNF to still think the key is pressed.
This reproduces on both my Arch Linux install and also on a clean Fedora Rawhide 2023-02-25 i3 Spin live session.
Standalone test program
Sample bad output
The text was updated successfully, but these errors were encountered: