From 9b272cfa4e664b0a90540256edf030c43e4bfbb0 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 24 Jan 2019 15:19:33 +0100 Subject: [PATCH] Fix minor text input problem related to dead key previewing. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit macOS normally previews a dead key and then replaces the preview by the final text after the second key is typed. macOS ≥10.7 also opens an auxiliary window to help choosing among possible characters after some keys (e.g., n, c, o, a) are pressed and maintained for a while. The problem fixed here is that after an auxiliary window has been used, dead keys are no longer previewed. That problem emerged at some undetermined point before 10.14 and after 10.7. --- src/Fl_cocoa.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index c34099d74..5430db51a 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2646,6 +2646,13 @@ static FLTextInputContext* fltextinputcontext_instance = nil; received,strlen([received UTF8String]),Fl::compose_state,replacementRange.location,replacementRange.length);*/ fl_lock_function(); Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + if (fl_mac_os_version >= 101400 && replacementRange.length > 0) { + // occurs after a key was pressed and maintained and an auxiliary window appeared + // prevents marking dead key from deactivation + [[self inputContext] discardMarkedText]; + } +#endif while (replacementRange.length--) { // delete replacementRange.length characters before insertion point int saved_keysym = Fl::e_keysym; Fl::e_keysym = FL_BackSpace;