From b208daa271c8840a8c767601656944df57cfb520 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Mon, 9 Mar 2020 23:57:04 +0300 Subject: [PATCH] =?UTF-8?q?Revert=20"on=20MacOS,=20Fix=20not=20sending=20R?= =?UTF-8?q?eceivedCharacter=20event=20for=20s=E2=80=A6=20(#1501)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9daa0738a9aeb60768d9b7d19f4e3deddd55958b. This commit introduced other bug #1453 with likely much more common bindings, so reverting it for now. Fixes #1453. Co-authored-by: Osspial --- CHANGELOG.md | 3 ++- src/platform_impl/macos/view.rs | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fd2b3b2..412c11c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ - On Windows, add `IconExtWindows` trait which exposes creating an `Icon` from an external file or embedded resource - Add `BadIcon::OsError` variant for when OS icon functionality fails - On Windows, fix crash at startup on systems that do not properly support Windows' Dark Mode +- Revert On macOS, fix not sending ReceivedCharacter event for specific keys combinations. +- on macOS, fix incorrect ReceivedCharacter events for some key combinations. - **Breaking:** Use `i32` instead of `u32` for position type in `WindowEvent::Moved`. # 0.21.0 (2020-02-04) @@ -37,7 +39,6 @@ # 0.20.0 (2020-01-05) - On X11, fix `ModifiersChanged` emitting incorrect modifier change events - - **Breaking**: Overhaul how Winit handles DPI: + Window functions and events now return `PhysicalSize` instead of `LogicalSize`. + Functions that take `Size` or `Position` types can now take either `Logical` or `Physical` types. diff --git a/src/platform_impl/macos/view.rs b/src/platform_impl/macos/view.rs index 2307d3e8..839a2bc0 100644 --- a/src/platform_impl/macos/view.rs +++ b/src/platform_impl/macos/view.rs @@ -383,8 +383,13 @@ extern "C" fn reset_cursor_rects(this: &Object, _sel: Sel) { } } -extern "C" fn has_marked_text(_this: &Object, _sel: Sel) -> BOOL { - YES +extern "C" fn has_marked_text(this: &Object, _sel: Sel) -> BOOL { + unsafe { + trace!("Triggered `hasMarkedText`"); + let marked_text: id = *this.get_ivar("markedText"); + trace!("Completed `hasMarkedText`"); + (marked_text.length() > 0) as i8 + } } extern "C" fn marked_range(this: &Object, _sel: Sel) -> NSRange {