1 /*
2 * Copyright (c) 2002, 2015, 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
1076 }
1077 dumpKeysymArray(ev);
1078 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
1079 keyEventLog.fine("XXXXXXXXXXXXXX javakeycode will be most probably:0x"+ Integer.toHexString(XKeysym.getJavaKeycodeOnly(ev)));
1080 }
1081 }
1082 public void handleKeyPress(XEvent xev) {
1083 super.handleKeyPress(xev);
1084 XKeyEvent ev = xev.get_xkey();
1085 if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
1086 eventLog.fine(ev.toString());
1087 }
1088 if (isEventDisabled(xev)) {
1089 return;
1090 }
1091 handleKeyPress(ev);
1092 }
1093 // called directly from this package, unlike handleKeyRelease.
1094 // un-final it if you need to override it in a subclass.
1095 final void handleKeyPress(XKeyEvent ev) {
1096 long keysym[] = new long[2];
1097 int unicodeKey = 0;
1098 keysym[0] = XConstants.NoSymbol;
1099
1100 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
1101 logIncomingKeyEvent( ev );
1102 }
1103 if ( //TODO check if there's an active input method instance
1104 // without calling a native method. Is it necessary though?
1105 haveCurrentX11InputMethodInstance()) {
1106 if (x11inputMethodLookupString(ev.pData, keysym)) {
1107 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
1108 keyEventLog.fine("--XWindow.java XIM did process event; return; dec keysym processed:"+(keysym[0])+
1109 "; hex keysym processed:"+Long.toHexString(keysym[0])
1110 );
1111 }
1112 return;
1113 }else {
1114 unicodeKey = keysymToUnicode( keysym[0], ev.get_state() );
1115 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
1116 keyEventLog.fine("--XWindow.java XIM did NOT process event, hex keysym:"+Long.toHexString(keysym[0])+"\n"+
|
1 /*
2 * Copyright (c) 2002, 2018, 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
1076 }
1077 dumpKeysymArray(ev);
1078 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
1079 keyEventLog.fine("XXXXXXXXXXXXXX javakeycode will be most probably:0x"+ Integer.toHexString(XKeysym.getJavaKeycodeOnly(ev)));
1080 }
1081 }
1082 public void handleKeyPress(XEvent xev) {
1083 super.handleKeyPress(xev);
1084 XKeyEvent ev = xev.get_xkey();
1085 if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
1086 eventLog.fine(ev.toString());
1087 }
1088 if (isEventDisabled(xev)) {
1089 return;
1090 }
1091 handleKeyPress(ev);
1092 }
1093 // called directly from this package, unlike handleKeyRelease.
1094 // un-final it if you need to override it in a subclass.
1095 final void handleKeyPress(XKeyEvent ev) {
1096 long[] keysym = new long[2];
1097 int unicodeKey = 0;
1098 keysym[0] = XConstants.NoSymbol;
1099
1100 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
1101 logIncomingKeyEvent( ev );
1102 }
1103 if ( //TODO check if there's an active input method instance
1104 // without calling a native method. Is it necessary though?
1105 haveCurrentX11InputMethodInstance()) {
1106 if (x11inputMethodLookupString(ev.pData, keysym)) {
1107 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
1108 keyEventLog.fine("--XWindow.java XIM did process event; return; dec keysym processed:"+(keysym[0])+
1109 "; hex keysym processed:"+Long.toHexString(keysym[0])
1110 );
1111 }
1112 return;
1113 }else {
1114 unicodeKey = keysymToUnicode( keysym[0], ev.get_state() );
1115 if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
1116 keyEventLog.fine("--XWindow.java XIM did NOT process event, hex keysym:"+Long.toHexString(keysym[0])+"\n"+
|