summaryrefslogtreecommitdiff
path: root/src/Fl_cocoa.mm
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-01-24 15:19:33 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-01-24 15:19:33 +0100
commit9b272cfa4e664b0a90540256edf030c43e4bfbb0 (patch)
tree436776f7d4c74bb51cb298e81f4a38178df768a5 /src/Fl_cocoa.mm
parent4f8e07a0cdde00610d95e3fb25b11f9e0ebfaacb (diff)
Fix minor text input problem related to dead key previewing.
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.
Diffstat (limited to 'src/Fl_cocoa.mm')
-rw-r--r--src/Fl_cocoa.mm7
1 files changed, 7 insertions, 0 deletions
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;