From c9bb57e58ed6d44bc67c00ca54f5d4b45a9359eb Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Wed, 23 Jan 2019 18:55:35 +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 468db64b4..0ed90ac09 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2781,6 +2781,13 @@ static CGContextRef prepare_bitmap_for_layer(int w, int h ) { 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;