Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions winit-appkit/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,12 @@ define_class!(

let is_control = string.chars().next().is_some_and(|c| c.is_control());

// Commit only if we have marked text.
if self.hasMarkedText() && self.is_ime_enabled() && !is_control {
self.queue_event(WindowEvent::Ime(Ime::Preedit(String::new(), None)));
if self.is_ime_enabled() && !string.is_empty() && !is_control {
// Some IMEs (e.g. Sogou/WeChat) skip marked text and commit directly.
if self.hasMarkedText() {
self.queue_event(WindowEvent::Ime(Ime::Preedit(String::new(), None)));
}

self.queue_event(WindowEvent::Ime(Ime::Commit(string)));
self.ivars().ime_state.set(ImeState::Committed);
}
Expand Down
5 changes: 5 additions & 0 deletions winit/src/changelog/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ changelog entry.
The `WindowEvent::DragMoved` event is entirely new, and is emitted whenever the pointer moves
whilst files are being dragged over the window. It doesn't contain any file paths, just the
pointer position.
- On macOS, NSTextInputClient protocol implementation now accepts commits even though the marked text is empty.

Most Sogou-style pinyin IME were designed to not use marked text feature when directly committing
punctuations. That's why this patch is necessary, allowing them to input punctuations correctly
without committing the character hardcoded in the base ukelele keylayout used by the input method.
- Updated `objc2` to `v0.6`.
- Updated `windows-sys` to `v0.59`.
- To match the corresponding changes in `windows-sys`, the `HWND`, `HMONITOR`, and `HMENU` types
Expand Down