Hi Anton, Could you please look at the following SR from JetBrains: SR #3-10041822951: Java on Mac: Unexpected InputMethodEvent is created https://support.oracle.com/epmos/faces/SrDetail?srNumber=3-10041822951
It contains the patch that is more correct than in the JDK-8068283. Now we are testing it with locally built JDK. Thanks, SAM On Thu, Dec 25, 2014 at 10:34 PM, Anton Nashatyrev <anton.nashaty...@oracle.com> wrote: > Hi Sergey, > > here is corresponding JBS issue for your problem: > https://bugs.openjdk.java.net/browse/JDK-8068283 > I've made some initial evaluation there. > > Regards, > Anton. > > > On 10.12.2014 20:56, Sergey Malenkov wrote: >> >> Hi all, >> >> In Oracle JDK the input method handling is slightly different from >> Apple JDK. And this is a reason of some issues in IntelliJ IDEA. I >> found out that the insertText method in the following file uses >> lengthOfBytesUsingEncoding instead of length in characters: >> >> >> http://hg.openjdk.java.net/jdk9/dev/jdk/file/e5b66323ae45/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m >> >> This means that almost every Alt+Key combination generates >> InputMethodEvent instead of pair of KeyEvent for PRESSED and TYPED. It >> makes impossible to support custom shortcuts for all Alt+Key and >> Shift+Alt+Key combinations on Mac, what is one of the reasons why >> users do not want to migrate from Apple JDK to Oracle JDK on Mac. >> >> I suggest to apply the following patch to the AWTView.m file: >> >> --- a/src/macosx/native/sun/awt/AWTView.m Wed Dec 10 17:20:48 2014 +0400 >> +++ b/src/macosx/native/sun/awt/AWTView.m Wed Dec 10 19:51:56 2014 +0300 >> @@ -889,7 +889,7 @@ >> // text, or 'text in progress'. We also need to send the event >> if we get an insert text out of the blue! >> // (i.e., when the user uses the Character palette or Inkwell), >> or when the string to insert is a complex >> // Unicode value. >> - NSUInteger utf8Length = [aString >> lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; >> + NSUInteger utf8Length = [aString length]; >> >> if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > >> 1)) { >> JNIEnv *env = [ThreadUtilities getJNIEnv]; >> >> It makes the input method handling more compatible with Apple JDK and >> allows us to provide users the same behavior with Oracle JDK. >> >> Do you have any objections? >> Are there some hidden pitfalls? >> > -- Best regards, Sergey A. Malenkov