From ceb167bfb40b5726009eb2f31a22c920a6790ce1 Mon Sep 17 00:00:00 2001 From: Josh Petrie Date: Fri, 9 Oct 2015 20:46:54 -0700 Subject: [PATCH] Fix warnings related to NSInputManager. --- src/MacVim/MMTextViewHelper.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/MacVim/MMTextViewHelper.m b/src/MacVim/MMTextViewHelper.m index 4de1dd1df7..0db953aee7 100644 --- a/src/MacVim/MMTextViewHelper.m +++ b/src/MacVim/MMTextViewHelper.m @@ -340,7 +340,11 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) // marked text moves outside the view as a result of scrolling. [self sendMarkedText:nil position:0]; [self unmarkText]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 + [[NSTextInputContext currentInputContext] discardMarkedText]; +#else [[NSInputManager currentInputManager] markedTextAbandoned:self]; +#endif } float dx = [event deltaX]; @@ -1117,9 +1121,13 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) // the Kotoeri manager "commits" the text on left clicks). if (event) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 + return [[NSTextInputContext currentInputContext] handleEvent:event]; +#else NSInputManager *imgr = [NSInputManager currentInputManager]; if ([imgr wantsToHandleMouseEvents]) return [imgr handleMouseEvent:event]; +#endif } return NO; @@ -1152,7 +1160,11 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) // that the marked text should be abandoned. (If pos is set to 0 Vim will // send backspace sequences to delete the old marked text.) [self sendMarkedText:nil position:-1]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 + [[NSTextInputContext currentInputContext] discardMarkedText]; +#else [[NSInputManager currentInputManager] markedTextAbandoned:self]; +#endif } #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)