Skip to content

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 adds a local flag in WindowSkiaLayerComponent and SwingSkiaLayerComponent, and applies it on every focus event.

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
@MatkovIvan MatkovIvan changed the title Fix initially disabling input methods. Fix initially disabling input methods Apr 29, 2025
@m-sasha m-sasha force-pushed the m-sasha/fix-initially-disabling-input-methods branch from 2aee7f8 to 1a1762d Compare May 7, 2025 13:27
@m-sasha m-sasha requested a review from igordmn May 7, 2025 13:29
@m-sasha m-sasha merged commit 0297ec1 into jb-main May 8, 2025
9 of 10 checks passed
@m-sasha m-sasha deleted the m-sasha/fix-initially-disabling-input-methods branch May 8, 2025 09:54
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