Skip to content

[GTK4] Enable input methods in Canvas based controls - #3756

Merged
akurtakov merged 1 commit into
eclipse-platform:masterfrom
akurtakov:gtk4-ime-focus
Oct 21, 2026
Merged

akurtakov merged 1 commit into
eclipse-platform:masterfrom
akurtakov:gtk4-ime-focus

Conversation

@akurtakov

Copy link
Copy Markdown
Member

The input method context of a Composite had no client widget and was never focused when the control got the keyboard focus, so IBus and the Wayland text-input protocol were never enabled and a StyledText got the raw keys instead of the composed text.

Set the control as the client widget, focus the context from the GTK4 focus controller like the GTK3 focus signals do, and clear the client widget on release. Skip the preedit window, it uses GTK3 only API and threw an UnsatisfiedLinkError once an input method was active.

Assisted-by: Anthropic Claude Code (claude-opus-5-5)

The input method context of a Composite had no client widget and was
never focused when the control got the keyboard focus, so IBus and the
Wayland text-input protocol were never enabled and a StyledText got the
raw keys instead of the composed text.

Set the control as the client widget, focus the context from the GTK4
focus controller like the GTK3 focus signals do, and clear the client
widget on release. Skip the preedit window, it uses GTK3 only API and
threw an UnsatisfiedLinkError once an input method was active.

Assisted-by: Anthropic Claude Code (claude-opus-5-5)
@github-actions

Copy link
Copy Markdown
Contributor

Test Results (linux)

   523 files  ±0     523 suites  ±0   37m 26s ⏱️ - 1m 2s
 4 816 tests ±0   4 474 ✅ ±0    342 💤 ±0  0 ❌ ±0 
14 745 runs  ±0  13 359 ✅ ±0  1 386 💤 ±0  0 ❌ ±0 

Results for commit 519f7d8. ± Comparison against base commit 824198d.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Parent–child keyboard-focus transitions leave input-context focus unsynchronized.

1 open issue
What changed in this PR

Enables GTK4 input methods for Canvas-based controls, including StyledText.

Changes:

  • Associates input contexts with client widgets and clears them on release.
  • Adds input-context focus handling.
  • Skips the GTK3-only preedit popup on GTK4.
File Description
bundles/​org.eclipse.swt/​Eclipse SWT/​gtk/​org/​eclipse/​swt/​widgets/​Display.java Skips the preedit popup on GTK4.
bundles/​org.eclipse.swt/​Eclipse SWT/​gtk/​org/​eclipse/​swt/​widgets/​Control.java Shares IM focus handling and clears client associations.
bundles/​org.eclipse.swt/​Eclipse SWT/​gtk/​org/​eclipse/​swt/​widgets/​Composite.java Sets the input context’s client widget.
bundles/​org.eclipse.swt/​Eclipse SWT PI/​gtk/​org/​eclipse/​swt/​internal/​gtk4/​GTK4.java Declares the client-widget native binding.
bundles/​org.eclipse.swt/​Eclipse SWT PI/​gtk/​library/​gtk4.c Adds the generated native wrapper.
bundles/​org.eclipse.swt/​Eclipse SWT PI/​gtk/​library/​gtk4_stats.h Registers the new native function identifier.

Review effort: Balanced

@akurtakov
akurtakov merged commit c422c9c into eclipse-platform:master Oct 21, 2026
12 checks passed
@akurtakov
akurtakov deleted the gtk4-ime-focus branch October 23, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants