Skip to content
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

SDL3: IME regressions #28261

Closed
bdach opened this issue May 20, 2024 Discussed in #28162 · 4 comments
Closed

SDL3: IME regressions #28261

bdach opened this issue May 20, 2024 Discussed in #28162 · 4 comments
Labels
priority:1 Very important. Feels bad without fix. Affects the majority of users. sdl issue type:input

Comments

@bdach
Copy link
Collaborator

bdach commented May 20, 2024

Should arguably only do the IME part.

Discussed in #28162

Originally posted by cdwcgt May 12, 2024
image

also for beatmap search

@bdach
Copy link
Collaborator Author

bdach commented May 20, 2024

Seems like before ppy/osu-framework#6234 we were able to suppress IME events from emitting SDL key down events and now we're not.

@Susko3 any bright ideas? other than scheduling (please god no)?

@Susko3
Copy link
Member

Susko3 commented May 20, 2024

This is a timing bug related to windows raw keyboard. Since the events are very low latency, the keydown event is handled before TextBox has a chance to block it because of an ongoing composition.

Disabling SDL_HINT_WINDOWS_RAW_KEYBOARD works around the issue, but that increases keyboard latency by a tiny bit.

Best hack I can think of is to add back keyProducesCharacter() and unconditionally handle those keys.

With ppy/osu-framework#5790 / ppy/osu-framework@6fb7adc we could do it in a smarter way -- check whether the character produced by the key is handled by the textbox.

diff --git a/osu.Framework/Graphics/UserInterface/TextBox.cs b/osu.Framework/Graphics/UserInterface/TextBox.cs
index 472272b2d..899ca32f7 100644
--- a/osu.Framework/Graphics/UserInterface/TextBox.cs
+++ b/osu.Framework/Graphics/UserInterface/TextBox.cs
@@ -1143,7 +1143,7 @@ protected override bool OnKeyDown(KeyDownEvent e)
             textInputScheduler.Update();
 
             // block on recent text input *after* handling the above keys so those keys can be used during text input.
-            return base.OnKeyDown(e) || textInputBlocking;
+            return base.OnKeyDown(e) || textInputBlocking || CanAddCharacter(e.Character);
         }
 
         /// <summary>

@bdach
Copy link
Collaborator Author

bdach commented May 20, 2024

With ppy/osu-framework#5790 / ppy/osu-framework@6fb7adc we could do it in a smarter way

I'm all for this but ppy/osu-framework#6229 is a prerequisite for that pull is it not? That has unresolved reviews still.

@bdach bdach changed the title Single keypress can sometimes both begin IME and trigger a keybinding IME regressions with sdl3 May 21, 2024
@smoogipoo smoogipoo changed the title IME regressions with sdl3 SDL3: IME regressions May 29, 2024
@bdach bdach added the priority:1 Very important. Feels bad without fix. Affects the majority of users. label Nov 15, 2024
@Susko3
Copy link
Member

Susko3 commented Nov 15, 2024

Disabling SDL_HINT_WINDOWS_RAW_KEYBOARD works around the issue, but that increases keyboard latency by a tiny bit.

The hint is now disabled by default. There were other issues with raw keyboard, so the SDL3 folks decided to disable it.

Also, I'm unable to reproduce the original issue, even with envvar SDL_WINDOWS_RAW_KEYBOARD set to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:1 Very important. Feels bad without fix. Affects the majority of users. sdl issue type:input
Projects
None yet
Development

No branches or pull requests

2 participants