< prev index next >

src/windows/native/sun/windows/awt_InputMethod.cpp

Print this page
rev 1566 : 6680988: KeyEvent is still missing VK values for many keyboards
Summary: 2 new methods and some fields added to KeyEvent, plus hash of constants introduced
Reviewed-by: art
   1 /*
   2  * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 159     (env)->DeleteLocalRef(bdata);
 160     BOOL isConsumed =
 161       (BOOL)(env)->GetBooleanField(event, AwtAWTEvent::consumedID);
 162     int id = (env)->GetIntField(event, AwtAWTEvent::idID);
 163     DASSERT(!safe_ExceptionOccurred(env));
 164 
 165     if (isConsumed || p==NULL)  return;
 166 
 167     if (id >= java_awt_event_InputMethodEvent_INPUT_METHOD_FIRST &&
 168         id <= java_awt_event_InputMethodEvent_INPUT_METHOD_LAST)
 169     {
 170         long modifiers = p->GetJavaModifiers();
 171         if (msg.message==WM_CHAR || msg.message==WM_SYSCHAR) {
 172             WCHAR unicodeChar = L'\0';
 173             unicodeChar = (WCHAR)msg.wParam;
 174             p->SendKeyEvent(java_awt_event_KeyEvent_KEY_TYPED,
 175                             0, //to be fixed nowMillis(),
 176                             java_awt_event_KeyEvent_CHAR_UNDEFINED,
 177                             unicodeChar,
 178                             modifiers,
 179                             java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN,
 180                             &msg);
 181         } else {
 182             MSG* pCopiedMsg = new MSG;
 183             *pCopiedMsg = msg;
 184             p->SendMessage(WM_AWT_HANDLE_EVENT, (WPARAM) FALSE,
 185                         (LPARAM) pCopiedMsg);
 186         }
 187         (env)->SetBooleanField(event, AwtAWTEvent::consumedID, JNI_TRUE);
 188     }
 189 
 190     CATCH_BAD_ALLOC;
 191 }
 192 
 193 /*
 194  * Class:     sun_awt_windows_WInputMethod
 195  * Method:    notifyNativeIME
 196  * Signature: (Lsun/awt/windows/WComponentPeer;I)V
 197  */
 198 JNIEXPORT void JNICALL
 199 Java_sun_awt_windows_WInputMethod_endCompositionNative(JNIEnv *env, jobject self,


   1 /*
   2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 159     (env)->DeleteLocalRef(bdata);
 160     BOOL isConsumed =
 161       (BOOL)(env)->GetBooleanField(event, AwtAWTEvent::consumedID);
 162     int id = (env)->GetIntField(event, AwtAWTEvent::idID);
 163     DASSERT(!safe_ExceptionOccurred(env));
 164 
 165     if (isConsumed || p==NULL)  return;
 166 
 167     if (id >= java_awt_event_InputMethodEvent_INPUT_METHOD_FIRST &&
 168         id <= java_awt_event_InputMethodEvent_INPUT_METHOD_LAST)
 169     {
 170         long modifiers = p->GetJavaModifiers();
 171         if (msg.message==WM_CHAR || msg.message==WM_SYSCHAR) {
 172             WCHAR unicodeChar = L'\0';
 173             unicodeChar = (WCHAR)msg.wParam;
 174             p->SendKeyEvent(java_awt_event_KeyEvent_KEY_TYPED,
 175                             0, //to be fixed nowMillis(),
 176                             java_awt_event_KeyEvent_CHAR_UNDEFINED,
 177                             unicodeChar,
 178                             modifiers,
 179                             java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN, (jlong)0,
 180                             &msg);
 181         } else {
 182             MSG* pCopiedMsg = new MSG;
 183             *pCopiedMsg = msg;
 184             p->SendMessage(WM_AWT_HANDLE_EVENT, (WPARAM) FALSE,
 185                         (LPARAM) pCopiedMsg);
 186         }
 187         (env)->SetBooleanField(event, AwtAWTEvent::consumedID, JNI_TRUE);
 188     }
 189 
 190     CATCH_BAD_ALLOC;
 191 }
 192 
 193 /*
 194  * Class:     sun_awt_windows_WInputMethod
 195  * Method:    notifyNativeIME
 196  * Signature: (Lsun/awt/windows/WComponentPeer;I)V
 197  */
 198 JNIEXPORT void JNICALL
 199 Java_sun_awt_windows_WInputMethod_endCompositionNative(JNIEnv *env, jobject self,


< prev index next >