Skip to content

Conversation

m-sasha
Copy link
Member

@m-sasha m-sasha commented May 15, 2025

The main purpose of this PR is to pass functions, rather than snapshot flows, in PlatformTextInputMethodRequest. This is needed to fix https://youtrack.jetbrains.com/issue/CMP-8177/IME-popup-appears-at-wrong-horizontal-position which is caused by the collection of the snapshot flow happening too late (after the system has requested the "focused rect").

Additionally, I've removed the PlatformTextInputService2 interface, as it doesn't appear to be needed. Its implementation, DesktopTextInputService2 is never passed outside of platform-specific code.

I've also removed PlatformTextInputMethodRequest.outputValue, per discussion with @mazunin-v-jb, as it seems value can be used instead.

Fixes https://youtrack.jetbrains.com/issue/CMP-8177/IME-popup-appears-at-wrong-horizontal-position

Testing

Tested manually to make sure the IME popup appears at the same position as with Swing text fields.

Release Notes

Fixes - Desktop

  • Fixed the position of the IME popup, which was below the previous, rather than the current, cursor position.

Comment on lines +387 to +397
coroutineScope {
// Currently TextInputService is used for keyboard show/hide actions and for
// backward compatibility by the LocalTextInputService.
// startInput and stopInput calls are required to properly configure the service
// and allow it to pass keyboard show/hide calls to the PlatformTextInputService.
launch(start = CoroutineStart.UNDISPATCHED) {
suspendCancellableCoroutine<Nothing> {
textInputService.startInput()
it.invokeOnCancellation {
textInputService.stopInput()
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@ASalavei Please note the changes here. Hopefully I didn't break anything. The changes are because IDEA was complaining about the implicit Nothing and ambiguous coroutine context.

@m-sasha m-sasha force-pushed the m-sasha/PlatformTextInputMethodRequest-functions branch 6 times, most recently from 0349ba5 to 4d4df5f Compare May 15, 2025 20:30
Base automatically changed from m-sasha/improve-focusedRectInRoot to jb-main May 19, 2025 15:05
@m-sasha m-sasha force-pushed the m-sasha/PlatformTextInputMethodRequest-functions branch from 4d4df5f to 746fba1 Compare May 19, 2025 15:07
@m-sasha m-sasha merged commit a476deb into jb-main May 22, 2025
10 checks passed
@m-sasha m-sasha deleted the m-sasha/PlatformTextInputMethodRequest-functions branch May 22, 2025 11:23
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.

3 participants