Skip to content

macOS set_ime_position fixes - #2180

Merged
madsmtm merged 2 commits into
rust-windowing:masterfrom
madsmtm:macos-set-ime-position-fixes
Mar 18, 2022
Merged

madsmtm merged 2 commits into
rust-windowing:masterfrom
madsmtm:macos-set-ime-position-fixes

Conversation

@madsmtm

@madsmtm madsmtm commented Feb 4, 2022

Copy link
Copy Markdown
Member

Found while reviewing at #2147.

Previously, you were required to call set_ime_position every time the window is moved. I don't know how the other platforms fare in this regard though?

Additionally, we were creating an extra NSTextInputContext and called invalidateCharacterCoordinates on that instead of on the NSView's actual input context. I should note, in my testing I couldn't verify whether invalidateCharacterCoordinates actually made a difference, but that may very well just be a bug in my macOS version (10.14.6).

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

@madsmtm madsmtm added B - bug Dang, that shouldn't have happened DS - appkit Affects the AppKit/macOS backend C - waiting on maintainer A maintainer must review this code labels Feb 4, 2022
@kchibisov

kchibisov commented Feb 4, 2022 •

Copy link
Copy Markdown
Member

Previously, you were required to call set_ime_position every time the window is moved. I don't know how the other platforms fare in this regard though?

On Wayland the spot is relative to the window and not an absolute position on screen, and since you don't know when your window is being moved it's up to compositor to handle that.

On X11 I think most apps don't do anything here? So IME spot just stays outside of the window. I think the most logical thing to do is to hide ime popup somehow if we know that the window is being moved.

@madsmtm

madsmtm commented Feb 5, 2022

Copy link
Copy Markdown
Member Author

On Wayland the spot is relative to the window and not an absolute position on screen

On macOS, the spot is an absolute position on the screen, but this PR makes it closer to Wayland's behaviour (the spot is stored as relative to the window, and only converted to an absolute position on the screen when the OS asks for it).

@madsmtm
madsmtm force-pushed the macos-set-ime-position-fixes branch from 863d416 to e4a2107 Compare February 5, 2022 02:04
madsmtm added 2 commits March 18, 2022 14:25
This means that `set_ime_position` now properly invalidates the character coordinates.
@madsmtm
madsmtm force-pushed the macos-set-ime-position-fixes branch from e4a2107 to fe5549f Compare March 18, 2022 13:26
@madsmtm

madsmtm commented Mar 18, 2022

Copy link
Copy Markdown
Member Author

I'm fairly certain this behaviour is more correct, so I'll merge this now.

@madsmtm
madsmtm merged commit e22c76b into rust-windowing:master Mar 18, 2022
@madsmtm
madsmtm deleted the macos-set-ime-position-fixes branch March 18, 2022 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B - bug Dang, that shouldn't have happened C - waiting on maintainer A maintainer must review this code DS - appkit Affects the AppKit/macOS backend

Development

Successfully merging this pull request may close these issues.

2 participants