Skip to content

Fix initially disabling input methods. #2047

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

Open
wants to merge 1 commit into
base: jb-main
Choose a base branch
from

Conversation

m-sasha
Copy link
Member

@m-sasha m-sasha commented Apr 22, 2025

We currently try to disable input methods in ComposeSceneMediator.init, but this doesn't work because it's too early. The call enableInputMethods is ignored unless the component actually has focus.

This PR moves the call enableInputMethods(false) into a focus-gained listener after focus is requested for the content component.

Note that it doesn't seem to be possible to fix this for SwingSkiaLayerComponent (i.e. when using ComposePanel) because the focus there is not requested explicitly by us (but by the system, when the window becomes active).

Fixes https://youtrack.jetbrains.com/issue/CMP-3839

Note that this only fixes the issue for JBR (JetBrains Runtime). For some reason Corretto keeps showing the input method toolbar even when enableInputMethods is called correctly. It behaves the same in pure Swing. For example, this code correctly disables the toolbar on JBR, but not on Corretto:

    JFrame().apply {
        size = Dimension(800, 600)
        defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE
        isVisible = true
        SwingUtilities.invokeLater {
            focusOwner?.enableInputMethods(false)
        }
    }

Testing

Tested manually on

    singleWindowApplication { }

using Pinyin - Simplified input method on macOS.

This should be tested by QA

Release Notes

Fixes - Desktop

  • [macOS] Fix showing the input method toolbar before any text field becomes focused (on JBR only; other runtimes continue to be buggy).

@m-sasha m-sasha requested a review from igordmn April 22, 2025 14:41
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