Skip to content

obs-browser: Add native IME event bridge - #549

Closed
sakuya-aki-dev wants to merge 2 commits into
obsproject:masterfrom
sakuya-aki-dev:work/issue-227-native-ime
Closed

sakuya-aki-dev wants to merge 2 commits into
obsproject:masterfrom
sakuya-aki-dev:work/issue-227-native-ime

Conversation

@sakuya-aki-dev

@sakuya-aki-dev sakuya-aki-dev commented Oct 9, 2026 •

Copy link
Copy Markdown

Description

Add the browser side of a native IME bridge for browser-source interaction:

  • Forward composition, commit, and cancellation events to CEF, copying event data before asynchronous dispatch and validating UTF-16 ranges.
  • Track session generations to reject stale input after navigation, browser replacement, or destruction; cancel composition on focus loss.
  • Return composition caret geometry from CEF for candidate-window positioning.

This change includes five browser implementation files and the required companion Studio patch. It requires coordinated OBS Studio frontend/libobs IME API changes and does not build against unmodified libobs. The companion Studio changes are submitted in obsproject/obs-studio#14016. Both PRs are required. The patch at docs/patches/obs-studio-native-ime.patch is an alternative way to apply the same Studio changes; do not apply it again on top of the Studio PR. Documentation, the event fixture, and investigation records remain local and are not included in this diff.

Motivation and Context

Many Japanese VTubers interact with browser sources and enter Japanese text during their streams. When IME input is unavailable, they cannot complete the text input they need, which disrupts their streams.

Related to #227. This remains a coordinated Studio/browser candidate, rather than a standalone resolution of the issue.

How Has This Been Tested?

Current browser commit: 9bd401610755487e9d5e4a9afa8067ee8ca132e8.

The five implementation files are byte-identical to the previously validated candidate. The earlier cleanup removed supporting files and passed git diff --check. The companion Studio patch has now been restored unchanged and successfully applied to the saved Studio source. Builds and native tests were not rerun for the cleanup or restoration; applicability to the latest Studio master was not checked during restoration.

Contributor-reported hands-on testing:

  • Windows: a general functional walkthrough across 15 languages.
  • Mac: English, Japanese, Traditional Chinese, and Simplified Chinese.
  • Tab navigation, six hours of continuous input, differing DPI settings, and multiple monitors confirmed.
  • Korean IME is the only language test not performed within the contributor's intended scope.

The detailed Windows language list, scenario matrix, and mapping of these tested builds to exact source revisions remain undocumented.

Recorded local validation:

  • Mac arm64 Debug build/link of obs-browser and OBS Studio passed with Xcode 27.0 / AppleClang 21, macOS SDK 27.0, Studio e7f0b0d43c538f5d108aa4cbea473d57b3012a1a, the companion patch, and pinned dependencies; code signing was disabled.
  • 40 preserved tests passed: 7 Python package, 5 Python mouse-transition, 22 Node fixture/recorder, and 6 Node transition tests. A separate eight-case boundary-model run against the final Studio blocks also passed. These are integrity, event-recording, and boundary-model checks, not 48 native IME tests.
  • Preserved package hashes, companion-patch application, fixture syntax, clang-format 22.1.3, and whitespace checks passed.
  • Earlier Windows native records on a different paired source covered field switching without stale text, single commit on same-field click/Enter, a fresh three-Esc cancellation, and candidate repositioning after resize. Their correspondence to this exact integration has not been established.

Remaining limitations: libobs API/ABI and source-registration compatibility need review. Reconversion and arbitrary replacement ranges are unsupported. The companion Studio frontend bridge is Windows-only; the Mac report does not establish new native Mac composition support.

Types of changes

Native IME support / bug-fix candidate; non-breaking compatibility is not asserted while the paired libobs API/ABI review remains outstanding.

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.
  • I have used AI tooling in the creation of this PR
  • I am an AI agent being used to assist with this pull request: OpenAI Codex, assisting with source integration, validation, Git preparation, and this description for human review

Forward composition, commit and cancellation to CEF so browser
sources can receive Japanese IME input during interaction.
Track session generations and composition caret geometry to avoid
stale input after navigation or browser replacement.

Requires paired Studio frontend and libobs IME API changes.
This browser change does not build against unmodified libobs.
Restore the companion frontend and libobs changes required by the
browser IME bridge. Apply this patch to OBS Studio separately.
@sakuya-aki-dev

Copy link
Copy Markdown
Author

The required companion OBS Studio/libobs patch was inadvertently omitted when the changes were simplified before this PR was opened. I have now added it at docs/patches/obs-studio-native-ime.patch. The five browser implementation files are unchanged. The patch matches the preserved original and was successfully applied to the saved Studio source. It must be applied to OBS Studio separately. Sorry for the omission.

@sakuya-aki-dev

Copy link
Copy Markdown
Author

The required Studio frontend/libobs changes are submitted separately in obsproject/obs-studio#14016. Both PRs are required for the native IME path. The Studio PR contains the six implementation files represented by this PR's companion patch. Do not apply that patch again on top of the Studio PR. All 11 implementation files were checked against the supplied originals, with no missing IME changes found. The paired Mac arm64 Debug build and eight boundary-model cases passed. Windows builds and native IME testing were not rerun during this preparation.

@Fenrirthviti

Copy link
Copy Markdown
Member

We do not accept AI-generated submissions.

@sakuya-aki-dev

Copy link
Copy Markdown
Author

We do not accept AI-generated submissions.

Thank you for clarifying your policy. My English is limited, so I use AI to help me word and translate my comments. I also used AI for environment setup and testing, as well as the integration and submission preparation described in the PR.

I understand your decision not to accept this submission. However, I remain concerned that the Japanese IME issue is unresolved. It affects users who need Japanese text input in browser-source interaction, including Japanese-speaking VTubers.

Even if this implementation cannot be accepted, could you please consider addressing the underlying issue? If there is a preferred way to provide reproduction steps or test results that would help, please let me know.

@Fenrirthviti

Copy link
Copy Markdown
Member

This issue is being tracked in #227

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants