libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
8.77k stars 1.66k forks source link

macOS: IME Escape key is not working properly #6505

Open vkedwardli opened 1 year ago

vkedwardli commented 1 year ago

This is reproducible on macOS 10.15.6 not reproducible on macOS 10.13.6 nor macOS 11.2.1

When using SDL2, I need to double press (or even more times) the Escape key to dismiss the macOS IME Composite text + Candidate Window (SDL_TEXTEDITING/Composite string is not shown in the screencap)

Current behaviour: Nov-06-2022 05-07-31

Expected behaviour: Nov-06-2022 05-07-43

SDLTranslatorResponder's NSTextInputContext has handled the escape key and returned "true"

I can reproduce this issue with Lite XL (cc @Guldoman) : Nov-10-2022 04-10-22

Only SDL2 application is affected, there are no problem with system apps like TextEdit.app or a simple imgui app without SDL2

I'm a bit lost, hope any IME expert could shed some light, thanks in advance!

Incorrect attempt to fix this issue: https://github.com/libsdl-org/SDL/pull/6486

Guldoman commented 1 year ago

Does it still happen if you disable "Live Conversion" in the IME settings?

For ease of testing, to make Lite XL show the actual characters:

  1. Download NotoSansJP-Regular and put it in .config/lite-xl/fonts
  2. Add this to your user module (click on the cog icon):
    local code_font = renderer.font.load(DATADIR .. "/fonts/JetBrainsMono-Regular.ttf", 15 * SCALE)
    local jp_font = renderer.font.load(USERDIR .. "/fonts/NotoSansJP-Regular.otf", 15 * SCALE)
    style.code_font = renderer.font.group({code_font, jp_font})
vkedwardli commented 1 year ago

Thanks for the info, I can show the composite character correctly now

Does it still happen if you disable "Live Conversion" in the IME settings?

Yes, disabling "Live Conversion" only disable the second level to escape, but the problem "multiple escape key press to escape each level" still exists Nov-10-2022 12-07-49