Skip to content

Experimental IBus support for X11 backend built on top of the IME API#10

Draft
ashie wants to merge 2 commits into
im-supportfrom
im-support-ibus
Draft

Experimental IBus support for X11 backend built on top of the IME API#10
ashie wants to merge 2 commits into
im-supportfrom
im-support-ibus

Conversation

@ashie

@ashie ashie commented Jun 20, 2026

Copy link
Copy Markdown
Member

This PR is an experiment built on top of the IME API introduced by PR #2130: Add IME support for each platform.

One motivation for this work is that the traditional X11 XIM protocol is relatively limited compared to modern IME frameworks and can make it difficult to provide functionality comparable to IME implementations available on other platforms.

While XIM remains useful as a baseline solution, as GLFW's IME support evolves, it may be desirable to investigate alternatives that can expose richer IME functionality on X11.

The goal of this experiment is therefore not to propose IBus support for GLFW itself, but to evaluate whether the abstractions introduced by PR glfw#2130 are flexible enough to support an alternative X11 IME backend without modifying the GLFW event loop.

The prototype uses:

  • a dynamically loaded IME module
  • a dedicated D-Bus worker thread
  • IBus input contexts

and currently supports:

  • preedit
  • commit
  • candidate window positioning

on X11.

This implementation should be viewed as a research prototype rather than an upstream proposal.

See docs/ime-ibus-prototype.md for architecture details, design rationale, limitations and future work.

Additional prerequisites

  • Dev package of DBus
  • IBus or Fcitx5 via its IBus compatibility frontend (untested)

Build:

$ cmake -B build
$ cmake --build build --target glfw glfw-ibus

Run demo:

$ GLFW_IM_MODULE=$PWD/build/src/glfw-ibus.so ./build/tests/input_text

@ashie ashie changed the title Im support ibus Experimental IBus support for X11 backend built on top of the IME API Jun 20, 2026
ashie added 2 commits June 20, 2026 17:00
This adds a dynamically loaded X11 IME module ABI and an experimental
glfw-ibus.so backend for feasibility testing only. The module owns
D-Bus and worker-thread communication, while GLFW drains queued IME
events on the main thread without modifying the event loop architecture.

The prototype includes preedit and commit handling, cursor location
updates for IBus SetCursorLocation, the first-candidate-window positioning
workaround, GLFW_IME_DEBUG instrumentation, and documentation of the
architecture and known timeout risks.
Keep XFilterEvent as the suppressor for the XIM path, but do not
call it before the experimental IME module sees KeyPress events.

When the module reports a key as handled, return before normal GLFW
key and character processing. This gives the IME module path the same
kind of duplicate-input suppression that XFilterEvent provides for the
XIM path, while keeping the XIM behavior unchanged.

This effectively extends the duplicate-input suppression addressed by
PR glfw#1972 to the experimental IME module path.
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.

1 participant