hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
10.49k stars 641 forks source link

Allow disabling IME shortcuts #2918

Open divVerent opened 4 months ago

divVerent commented 4 months ago

Operating System

What feature would you like to be added?

See https://github.com/divVerent/aaaaxy/issues/341 - it'd be nice if games that contain no text input could globally disable all IME shortcuts.

Why is this needed?

Right now, in AAAAXY, if the player by accident hits the Kanji key in-game (in the concrete case together with Shift), further space keypresses (which is for the jump action) are silently ignored until the Kanji key is pressed again.

As a current workaround, the game also supports other key mappings, but it'd be really nice if I could just disable the handling of the key.

I think what I want is to call this Windows API function:

https://learn.microsoft.com/en-us/windows/win32/api/imm/nf-imm-immdisableime

However, it requires to be called before any window is created, and Ebitengine already creates a window during its init() functions, so I couldn't find a reliable way to inject my own init() handler before any of Ebitengine's.

hajimehoshi commented 4 months ago
  1. Do we have similar issues and solutions for other OSes?
  2. Doesn't this break compatibility for AppendInputChars?
divVerent commented 4 months ago
  1. No idea - I cannot reproduce this on any of my systems. I asked the reporter to try to reproduce it with ebitengine's keyboard example - let's see then.

  2. Disabling IME should not fully break AppendInputChars, but limit it to a "non-IME" keyboard mode. Right now the implementation of Ebitengine doesn't even call any IME functions. But of course, as some Ebitengine games have input fields, I cannot seriously propose for Ebitengine to just globally disable IME.

divVerent commented 1 month ago

Regarding 1. issue did reproduce with the keyboard example: https://github.com/divVerent/aaaaxy/issues/341#issuecomment-1972374829