@wengxt Thank you for your investigation.
Seems my tentative patch fix the issue.
It works. Thanks.
@bbaa Thank you. I fixed it.
Thank you. I fixed it.
Chromium on Xwayland with GTK3 backend has same problem.
Can enter English characters correctly, but cannot switch to IME in GTK2
Can enter English characters correctly, but cannot switch to IME in GTK2
I made the tentative patch. !246
Could you please test it?
GTK2 applications with GTK_IM_MODULE=xim sets the serial number 0 to the XKeyEvent and the previous _XimFabricateSerial() logic did not work for the applications. Now the API marks to fabricate with the serial 0.
Closes: #205 Fixes: 024d229f ("ximcp: Unmark to fabricate key events with XKeyEvent serial")
I can confirm that the steam client doesn't work for input either, and all IM modules(GTK_IM_MODULE/QT_IM_MODULE/SDL_IM_MODULE) don't work.
The only way to restore input is to unset XMODIFIERS.
@fujiwarat Sorry for the confusion, but I mean IBus with Gtk xim, not ibus with gtk im module.
Also, for forwarding event API to create purely synthetic event in IMF, people also seems to be using serial = 0.
https://github.com/ibus/ibus/blob/707832954e1aaaae9a695d9771e84a21844be605/client/x11/main.c#L489 https://github.com/fcitx/fcitx5/blob/f45c693306dc554b7ecc6d3b91b35ea026fd9249/src/frontend/xim/xim.cpp#L414
Also worth noting that @DonKatsu claims it also affect proton, that I don't know if the reason is the same (serial 0) since from what I know about wine code, it doesn't do the same like gtk's xim.
I can't reproduce issue with wine (notepad) here and it seems to be suspicious if proton is from steam so it should use steam runtime instead of host libx11?...
The issue effects in case the serial == 0? I will try to modify libX11 to work with serial == 0.
I tried to do some test and I believe your change also break ibus with gtk2. @fujiwarat
OK, I can reproduce your issue with GTK2 applications and GTK_IM_MODULE=xim and it does not effect IBus with GTK2.
on non-gnome wayland system (GNOME has xsettings so it might be possible to have different value for x11/wayland though I'm not sure if it really works), if user prefer text-input in gtk3+, they may not have GTK_IM_MODULE set or GTK_IM_MODULE=wayland, thus it will fallback to xim for Gtk2, or Gtk3 app that only runs X11.
so gtk's xim im module though not preferred, may still be used in such setup.
Gtk2 is not using the libx11 the "regular" way. Instead, it's calling XFilterEvent on a fake X event with serial 0 set manually.
I tried to do some test and I believe your change also break ibus with gtk2. @fujiwarat
Another idea would be to add "#define XimFabricateSerial 0x0008" to libX11/rc/xlibi18n/XimProto.h and keep the old codes not to check the fabricated serial numbers for other input method flameworks.
Cc fcitx developers at https://github.com/fcitx/fcitx5/issues/1000
Probably I think it would be an fcitx issue.