Windows: implement Window.set_ime_position() with IMM API.#1790
Windows: implement Window.set_ime_position() with IMM API.#1790kchibisov merged 4 commits intorust-windowing:masterfrom
Conversation
There was a problem hiding this comment.
Hi, thanks for the contribution 👋
I played a bit with the provided demo and works ok overall. I noticed a bit of flickering when moving around the mouse cursor, not sure if this is platform specific, also the candidate window doesn't seem to follow (how does unix handle this?) - overall not sure how important this is in a real application. I assume 'static' composition windows are more common on text input. It might make sense to adjust the demo a bit to only set the position on click?
Also, please add a changelog entry please for other users to know!
| } | ||
|
|
||
| pub(crate) fn set_ime_position_physical(&self, x: i32, y: i32) { | ||
| if unsafe { winuser::GetSystemMetrics(winuser::SM_DBCSENABLED) } != 0 { |
There was a problem hiding this comment.
I installed an east asian language pack for testing and it only worked when switching to SM_IMMENABLED here.
There was a problem hiding this comment.
Sorry, I made a mistake. Thanks,
|
I fixed that demo based on your review, and add to changelog. Thank a lot! |
|
I ran the demo in Windows 10 1809, Windows 8.1, and it worked. |






cargo fmthas been run on this branchcargo docbuilds successfullyCHANGELOG.mdif knowledge of this change could be valuable to usersI tested in Windows 10 18363.1198 with Microsoft Japanese IME. I am not tested without IME. I followed IMM documentation and implementation will not call IMM API if Windows has no IME.
IMM docs: https://docs.microsoft.com/ja-jp/windows/win32/intl/about-input-method-manager
ImmSetCompositionWindow docs: https://docs.microsoft.com/en-us/windows/win32/api/imm/nf-imm-immsetcompositionwindow
COMPOSITIONFORM docs: https://docs.microsoft.com/en-us/windows/win32/api/imm/ns-imm-compositionform
GetSystemMetrics and SM_IMMENABLED docs: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsystemmetrics