Delegate handling of IME interruptions to integrations to fix virtual keyboard flickering on web#8078
Merged
emilk merged 5 commits intoemilk:mainfrom Apr 8, 2026
Merged
Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/8078-let-integration-interrupt-ime-v2 View snapshot changes at kitdiff |
1 task
In the first version of this PR, I moved `owns_ime_events` and `interrupt_ime` from `Memory` to `Context`. This change casued `Memory::request_focus` to lose the access to `interrupt_ime`, so I introduced an alernative way to detect interactions that interrupt IME composition. Upon further consideration, I found that this refactor was unnecesscarily large. I reworked the approach without moving those methods, which let to the current version of this PR. During the rework, I overlooked that `request_focus` now calls `interrupt_ime` again, therefore the additional interaction checks became redundant. This commit removes those checks.
|
This solves the flickering on my end. And seems like a good solution |
emilk
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
owns_ime_eventsonMemory#7983TextAgentineframe/web#8045Details
In #7983, I modified
Memory::request_focusto interrupt any ongoing IME composition. This fixed a bug where clicking inside an already focusedTextEditfailed to cancel the active composition, resulting in duplicated text:#8045 (comment)
To avoid introducing API changes in that PR, I ensured the IME state was reset by forcing
PlatformOutput::imetoNonefor at least one frame.While this works well on desktop platforms, it causes virtual keyboard flickering on the web:
#8045 (comment)
In this PR, I delegate the responsibility for handling IME composition interruptions to integrations, allowing each integration to decide how to interrupt compositions in a flexible manner.
The new field
should_interrupt_compositiononIMEOutput.Instead of introducing a new
OutputCommandvariant, this PR adds a new fieldshould_interrupt_compositiontoIMEOutput.Interrupting an active composition is only meaningful when IME remains allowed. If IME should be disabled altogether,
PlatformOutput::imecan simply be set toNone.Given this, IMO, it is more appropriate to attach the interrupt signal to
IMEOutput(i.e., the type ofPlatformOutput::ime).