Litematica (Forge)

Litematica (Forge)

336k Downloads

All hotkeys were disabled after switching input methods

SpiritedAwayCN opened this issue · 7 comments

commented

All the hotkeys, including M & M+C, which evokes main menu, were disabled after switching input methods, even if I didn't type anything, but all other functions could run normally.

And hotkeys enabled again when I switched to another window and then switched back.

OS: Windows 10.
Some Chinese input methods are installed on my system.

commented

确实是这样,我也遇到了,1.16和1.18都有这个问题,只要把游戏窗口化然后点一下别的窗口,再点回游戏就可以正常了。

commented

Trun keybindDebugging true, press M key, it shows RELEASE M (77). held keys: LEFT_SUPER(343) after i switch my input method, and change input method hotkey is super + space (windows).

commented

Add super to ignoredkeys will be fine.
image

commented

Can confirm for me. I also have a chinese keyboard installed. And I can confirm, that MiniHUD and Tweakeroo have this issue as well. Maybe a bug in fabric keybinding itself i think.

commented

I'm not using Fabric's keybindings (or vanilla), I have custom keybinding system in malilib, which provides the highly configurable keybindings with multi-key support.

Could you check what malilib's keybind debug option sees when this happens? So enable the keybind debug option first, and then change the input method and then while the keybinds are broken, see what, if anything, the debug output spits out. You can get to the malilib configs either via Mod Menu's settings button for malilib (if you have Mod Menu installed), or using A + C.

commented

Yeah I turned on the debug mode, and after I switch the input method, 'pressing keys C (67), held keys SUPER + H + C' show in action bar while pressing H+C. Is 'SUPER' is regarded as pressed, from that debug text?
@maruohon

commented

It would seem so, yes. Can you get the SUPER key to release by just pressing it manually once? (I assume SUPER here means the windows key?)

How does one change input methods even, does it involve a key combination with the super key? Then it's likely it's getting stuck because of that. I think it's also possible to get Alt stuck by using Alt + Tab to switch windows. The problem then is, I believe, that the LWJGL library misses the key release event, so when the game and the mod query the state of the key, LWJGL still reports it as being pressed. In such a case there isn't anything I could do in the mod to fix this, if the input handling library still reports the key as being pressed.

However a part of the problem is that most of my "toggle type" keybinds in the mods are by default set to be "strict", meaning that they won't allow any extra keys to be pressed. This option can be changed by the user for affected keybinds, if needed, using the Advanced Keybind Options widget next to the hotkey button. But in general it would be better/easier to just get the keys that get stuck to be un-stuck.

In this case if it's just the super key getting stuck, then just manually pressing it once after switching the input method should be easy enough to do? Alternatively, if you are not using the super key for any hotkeys in the mods, then you can also add it to the ignoredKeys "hotkey" in malilib configs. That way malilib will completely ignore that key. I've had to do that for my MOUSE4 (forward) key, since for some odd reason when I sneak (= hold shift) and use the MOUSE3 (back) key (which is my Discord Toggle Mute), then somehow the MOUSE4 key would get pressed and get stuck on according to LWJGL and thus also malilib.