Bug Summary

File:jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c
Warning:line 871, column 12
Value stored to 'originalKeysym' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name XWindow.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mthread-model posix -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib/llvm-10/lib/clang/10.0.0 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base/linux -I /home/daniel/Projects/java/jdk/src/java.base/share/native/libjava -I /home/daniel/Projects/java/jdk/src/java.base/unix/native/libjava -I /home/daniel/Projects/java/jdk/src/hotspot/share/include -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix/include -D LIBC=gnu -D _GNU_SOURCE -D _REENTRANT -D _LARGEFILE64_SOURCE -D LINUX -D DEBUG -D _LITTLE_ENDIAN -D ARCH="amd64" -D amd64 -D _LP64=1 -D XAWT -D XAWT_HACK -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/common/awt -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/common/awt -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/common/java2d -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/common/java2d -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/common/font -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/common/font -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/headers/java.desktop -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/libawt/awt/image -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt/java2d -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/libawt/java2d -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/libawt/java2d/loops -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/libawt/java2d/pipe -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/awt -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/include -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/include -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/common/awt/debug -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/common/awt/systemscale -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/common/font -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/common/font -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/common/java2d/opengl -I /home/daniel/Projects/java/jdk/src/java.desktop/share/native/common/java2d/opengl -I /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/common/java2d/x11 -D _FORTIFY_SOURCE=2 -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-10/lib/clang/10.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-unused -Wno-type-limits -Wno-pointer-to-int-cast -Wno-unused-result -Wno-maybe-uninitialized -Wno-format -Wno-format-security -Wno-int-to-pointer-cast -Wno-parentheses -Wno-implicit-fallthrough -Wno-undef -Wno-unused-function -std=c99 -fdebug-compilation-dir /home/daniel/Projects/java/jdk/make -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -stack-protector 1 -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -o /home/daniel/Projects/java/scan/2021-12-21-193737-8510-1 -x c /home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c
1/*
2 * Copyright (c) 2002, 2020, 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
23 * questions.
24 */
25
26/* Note that the contents of this file were taken from canvas.c
27 * in the old motif-based AWT.
28 */
29
30#ifdef HEADLESS
31 #error This file should not be included in headless library
32#endif
33
34#include <X11/Xlib.h>
35#include <X11/Xutil.h>
36#include <X11/Xos.h>
37#include <X11/Xatom.h>
38#include <ctype.h>
39
40#include <jvm.h>
41#include <jni.h>
42#include <jlong.h>
43#include <jni_util.h>
44
45#include "sun_awt_X11_XWindow.h"
46
47#include "awt_p.h"
48#include "awt_GraphicsEnv.h"
49
50#define XK_KATAKANA
51#include <X11/keysym.h> /* standard X keysyms */
52#include <X11/DECkeysym.h> /* DEC vendor-specific */
53#include <X11/Sunkeysym.h> /* Sun vendor-specific */
54#include <X11/ap_keysym.h> /* Apollo (HP) vendor-specific */
55/*
56 * HPKeysym.h is used not only for the hp keysyms, but also to
57 * give us the osf keysyms that are also defined in HPkeysym.h.
58 * However, HPkeysym.h is missing a couple of osf keysyms,
59 * so I have #defined them below.
60 */
61#include <X11/HPkeysym.h> /* HP vendor-specific */
62
63#include "java_awt_event_KeyEvent.h"
64#include "java_awt_event_InputEvent.h"
65#include "java_awt_event_MouseEvent.h"
66#include "java_awt_event_MouseWheelEvent.h"
67#include "java_awt_AWTEvent.h"
68
69/*
70 * Two osf keys are not defined in standard keysym.h,
71 * /Xm/VirtKeys.h, or HPkeysym.h, so I added them below.
72 * I found them in /usr/openwin/lib/X11/XKeysymDB
73 */
74#ifndef osfXK_Prior0x1004FF55
75#define osfXK_Prior0x1004FF55 0x1004FF55
76#endif
77#ifndef osfXK_Next0x1004FF56
78#define osfXK_Next0x1004FF56 0x1004FF56
79#endif
80
81jfieldID windowID;
82jfieldID drawStateID;
83jfieldID targetID;
84jfieldID graphicsConfigID;
85
86extern jobject currentX11InputMethodInstance;
87extern Boolean awt_x11inputmethod_lookupString(XKeyPressedEvent *, KeySym *);
88Boolean awt_UseType4Patch = False0;
89Boolean awt_ServerDetected = False0;
90Boolean awt_XKBDetected = False0;
91Boolean awt_IsXsun = False0;
92Boolean awt_UseXKB = False0;
93
94typedef struct KEYMAP_ENTRY {
95 jint awtKey;
96 KeySym x11Key;
97 Boolean mapsToUnicodeChar;
98 jint keyLocation;
99} KeymapEntry;
100
101/* NB: XK_R? keysyms are for Type 4 keyboards.
102 * The corresponding XK_F? keysyms are for Type 5
103 *
104 * Note: this table must be kept in sorted order, since it is traversed
105 * according to both Java keycode and X keysym. There are a number of
106 * keycodes that map to more than one corresponding keysym, and we need
107 * to choose the right one. Unfortunately, there are some keysyms that
108 * can map to more than one keycode, depending on what kind of keyboard
109 * is in use (e.g. F11 and F12).
110 */
111
112KeymapEntry keymapTable[] =
113{
114 {java_awt_event_KeyEvent_VK_A65L, XK_a0x0061, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
115 {java_awt_event_KeyEvent_VK_B66L, XK_b0x0062, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
116 {java_awt_event_KeyEvent_VK_C67L, XK_c0x0063, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
117 {java_awt_event_KeyEvent_VK_D68L, XK_d0x0064, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
118 {java_awt_event_KeyEvent_VK_E69L, XK_e0x0065, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
119 {java_awt_event_KeyEvent_VK_F70L, XK_f0x0066, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
120 {java_awt_event_KeyEvent_VK_G71L, XK_g0x0067, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
121 {java_awt_event_KeyEvent_VK_H72L, XK_h0x0068, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
122 {java_awt_event_KeyEvent_VK_I73L, XK_i0x0069, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
123 {java_awt_event_KeyEvent_VK_J74L, XK_j0x006a, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
124 {java_awt_event_KeyEvent_VK_K75L, XK_k0x006b, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
125 {java_awt_event_KeyEvent_VK_L76L, XK_l0x006c, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
126 {java_awt_event_KeyEvent_VK_M77L, XK_m0x006d, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
127 {java_awt_event_KeyEvent_VK_N78L, XK_n0x006e, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
128 {java_awt_event_KeyEvent_VK_O79L, XK_o0x006f, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
129 {java_awt_event_KeyEvent_VK_P80L, XK_p0x0070, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
130 {java_awt_event_KeyEvent_VK_Q81L, XK_q0x0071, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
131 {java_awt_event_KeyEvent_VK_R82L, XK_r0x0072, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
132 {java_awt_event_KeyEvent_VK_S83L, XK_s0x0073, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
133 {java_awt_event_KeyEvent_VK_T84L, XK_t0x0074, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
134 {java_awt_event_KeyEvent_VK_U85L, XK_u0x0075, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
135 {java_awt_event_KeyEvent_VK_V86L, XK_v0x0076, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
136 {java_awt_event_KeyEvent_VK_W87L, XK_w0x0077, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
137 {java_awt_event_KeyEvent_VK_X88L, XK_x0x0078, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
138 {java_awt_event_KeyEvent_VK_Y89L, XK_y0x0079, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
139 {java_awt_event_KeyEvent_VK_Z90L, XK_z0x007a, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
140
141 /* TTY Function keys */
142 {java_awt_event_KeyEvent_VK_BACK_SPACE8L, XK_BackSpace0xff08, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
143 {java_awt_event_KeyEvent_VK_TAB9L, XK_Tab0xff09, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
144 {java_awt_event_KeyEvent_VK_TAB9L, XK_ISO_Left_Tab0xfe20, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
145 {java_awt_event_KeyEvent_VK_CLEAR12L, XK_Clear0xff0b, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
146 {java_awt_event_KeyEvent_VK_ENTER10L, XK_Return0xff0d, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
147 {java_awt_event_KeyEvent_VK_ENTER10L, XK_Linefeed0xff0a, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
148 {java_awt_event_KeyEvent_VK_PAUSE19L, XK_Pause0xff13, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
149 {java_awt_event_KeyEvent_VK_PAUSE19L, XK_F210xffd2, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
150 {java_awt_event_KeyEvent_VK_PAUSE19L, XK_R10xffd2, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
151 {java_awt_event_KeyEvent_VK_SCROLL_LOCK145L, XK_Scroll_Lock0xff14, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
152 {java_awt_event_KeyEvent_VK_SCROLL_LOCK145L, XK_F230xffd4, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
153 {java_awt_event_KeyEvent_VK_SCROLL_LOCK145L, XK_R30xffd4, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
154 {java_awt_event_KeyEvent_VK_ESCAPE27L, XK_Escape0xff1b, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
155
156 /* Other vendor-specific versions of TTY Function keys */
157 {java_awt_event_KeyEvent_VK_BACK_SPACE8L, osfXK_BackSpace0x1004FF08, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
158 {java_awt_event_KeyEvent_VK_CLEAR12L, osfXK_Clear0x1004FF0B, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
159 {java_awt_event_KeyEvent_VK_ESCAPE27L, osfXK_Escape0x1004FF1B, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
160
161 /* Modifier keys */
162 {java_awt_event_KeyEvent_VK_SHIFT16L, XK_Shift_L0xffe1, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_LEFT2L},
163 {java_awt_event_KeyEvent_VK_SHIFT16L, XK_Shift_R0xffe2, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_RIGHT3L},
164 {java_awt_event_KeyEvent_VK_CONTROL17L, XK_Control_L0xffe3, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_LEFT2L},
165 {java_awt_event_KeyEvent_VK_CONTROL17L, XK_Control_R0xffe4, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_RIGHT3L},
166 {java_awt_event_KeyEvent_VK_ALT18L, XK_Alt_L0xffe9, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_LEFT2L},
167 {java_awt_event_KeyEvent_VK_ALT18L, XK_Alt_R0xffea, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_RIGHT3L},
168 {java_awt_event_KeyEvent_VK_META157L, XK_Meta_L0xffe7, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_LEFT2L},
169 {java_awt_event_KeyEvent_VK_META157L, XK_Meta_R0xffe8, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_RIGHT3L},
170 {java_awt_event_KeyEvent_VK_CAPS_LOCK20L, XK_Caps_Lock0xffe5, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
171 {java_awt_event_KeyEvent_VK_CAPS_LOCK20L, XK_Shift_Lock0xffe6, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
172
173 /* Misc Functions */
174 {java_awt_event_KeyEvent_VK_PRINTSCREEN154L, XK_Print0xff61, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
175 {java_awt_event_KeyEvent_VK_PRINTSCREEN154L, XK_F220xffd3, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
176 {java_awt_event_KeyEvent_VK_PRINTSCREEN154L, XK_R20xffd3, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
177 {java_awt_event_KeyEvent_VK_CANCEL3L, XK_Cancel0xff69, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
178 {java_awt_event_KeyEvent_VK_HELP156L, XK_Help0xff6a, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
179 {java_awt_event_KeyEvent_VK_NUM_LOCK144L, XK_Num_Lock0xff7f, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
180
181 /* Other vendor-specific versions of Misc Functions */
182 {java_awt_event_KeyEvent_VK_CANCEL3L, osfXK_Cancel0x1004FF69, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
183 {java_awt_event_KeyEvent_VK_HELP156L, osfXK_Help0x1004FF6A, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
184
185 /* Rectangular Navigation Block */
186 {java_awt_event_KeyEvent_VK_HOME36L, XK_Home0xff50, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
187 {java_awt_event_KeyEvent_VK_HOME36L, XK_R70xffd8, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
188 {java_awt_event_KeyEvent_VK_PAGE_UP33L, XK_Page_Up0xff55, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
189 {java_awt_event_KeyEvent_VK_PAGE_UP33L, XK_Prior0xff55, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
190 {java_awt_event_KeyEvent_VK_PAGE_UP33L, XK_R90xffda, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
191 {java_awt_event_KeyEvent_VK_PAGE_DOWN34L, XK_Page_Down0xff56, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
192 {java_awt_event_KeyEvent_VK_PAGE_DOWN34L, XK_Next0xff56, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
193 {java_awt_event_KeyEvent_VK_PAGE_DOWN34L, XK_R150xffe0, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
194 {java_awt_event_KeyEvent_VK_END35L, XK_End0xff57, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
195 {java_awt_event_KeyEvent_VK_END35L, XK_R130xffde, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
196 {java_awt_event_KeyEvent_VK_INSERT155L, XK_Insert0xff63, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
197 {java_awt_event_KeyEvent_VK_DELETE127L, XK_Delete0xffff, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
198
199 /* Keypad equivalents of Rectangular Navigation Block */
200 {java_awt_event_KeyEvent_VK_HOME36L, XK_KP_Home0xff95, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
201 {java_awt_event_KeyEvent_VK_PAGE_UP33L, XK_KP_Page_Up0xff9a, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
202 {java_awt_event_KeyEvent_VK_PAGE_UP33L, XK_KP_Prior0xff9a, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
203 {java_awt_event_KeyEvent_VK_PAGE_DOWN34L, XK_KP_Page_Down0xff9b, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
204 {java_awt_event_KeyEvent_VK_PAGE_DOWN34L, XK_KP_Next0xff9b, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
205 {java_awt_event_KeyEvent_VK_END35L, XK_KP_End0xff9c, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
206 {java_awt_event_KeyEvent_VK_INSERT155L, XK_KP_Insert0xff9e, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
207 {java_awt_event_KeyEvent_VK_DELETE127L, XK_KP_Delete0xff9f, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
208
209 /* Other vendor-specific Rectangular Navigation Block */
210 {java_awt_event_KeyEvent_VK_PAGE_UP33L, osfXK_PageUp0x1004FF41, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
211 {java_awt_event_KeyEvent_VK_PAGE_UP33L, osfXK_Prior0x1004FF55, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
212 {java_awt_event_KeyEvent_VK_PAGE_DOWN34L, osfXK_PageDown0x1004FF42, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
213 {java_awt_event_KeyEvent_VK_PAGE_DOWN34L, osfXK_Next0x1004FF56, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
214 {java_awt_event_KeyEvent_VK_END35L, osfXK_EndLine0x1004FF57, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
215 {java_awt_event_KeyEvent_VK_INSERT155L, osfXK_Insert0x1004FF63, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
216 {java_awt_event_KeyEvent_VK_DELETE127L, osfXK_Delete0x1004FFFF, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
217
218 /* Triangular Navigation Block */
219 {java_awt_event_KeyEvent_VK_LEFT37L, XK_Left0xff51, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
220 {java_awt_event_KeyEvent_VK_UP38L, XK_Up0xff52, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
221 {java_awt_event_KeyEvent_VK_RIGHT39L, XK_Right0xff53, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
222 {java_awt_event_KeyEvent_VK_DOWN40L, XK_Down0xff54, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
223
224 /* Keypad equivalents of Triangular Navigation Block */
225 {java_awt_event_KeyEvent_VK_KP_LEFT226L, XK_KP_Left0xff96, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
226 {java_awt_event_KeyEvent_VK_KP_UP224L, XK_KP_Up0xff97, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
227 {java_awt_event_KeyEvent_VK_KP_RIGHT227L, XK_KP_Right0xff98, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
228 {java_awt_event_KeyEvent_VK_KP_DOWN225L, XK_KP_Down0xff99, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
229
230 /* Other vendor-specific Triangular Navigation Block */
231 {java_awt_event_KeyEvent_VK_LEFT37L, osfXK_Left0x1004FF51, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
232 {java_awt_event_KeyEvent_VK_UP38L, osfXK_Up0x1004FF52, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
233 {java_awt_event_KeyEvent_VK_RIGHT39L, osfXK_Right0x1004FF53, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
234 {java_awt_event_KeyEvent_VK_DOWN40L, osfXK_Down0x1004FF54, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
235
236 /* Remaining Cursor control & motion */
237 {java_awt_event_KeyEvent_VK_BEGIN65368L, XK_Begin0xff58, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
238 {java_awt_event_KeyEvent_VK_BEGIN65368L, XK_KP_Begin0xff9d, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
239
240 {java_awt_event_KeyEvent_VK_048L, XK_00x0030, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
241 {java_awt_event_KeyEvent_VK_149L, XK_10x0031, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
242 {java_awt_event_KeyEvent_VK_250L, XK_20x0032, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
243 {java_awt_event_KeyEvent_VK_351L, XK_30x0033, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
244 {java_awt_event_KeyEvent_VK_452L, XK_40x0034, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
245 {java_awt_event_KeyEvent_VK_553L, XK_50x0035, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
246 {java_awt_event_KeyEvent_VK_654L, XK_60x0036, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
247 {java_awt_event_KeyEvent_VK_755L, XK_70x0037, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
248 {java_awt_event_KeyEvent_VK_856L, XK_80x0038, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
249 {java_awt_event_KeyEvent_VK_957L, XK_90x0039, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
250
251 {java_awt_event_KeyEvent_VK_SPACE32L, XK_space0x0020, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
252 {java_awt_event_KeyEvent_VK_EXCLAMATION_MARK517L, XK_exclam0x0021, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
253 {java_awt_event_KeyEvent_VK_QUOTEDBL152L, XK_quotedbl0x0022, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
254 {java_awt_event_KeyEvent_VK_NUMBER_SIGN520L, XK_numbersign0x0023, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
255 {java_awt_event_KeyEvent_VK_DOLLAR515L, XK_dollar0x0024, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
256 {java_awt_event_KeyEvent_VK_AMPERSAND150L, XK_ampersand0x0026, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
257 {java_awt_event_KeyEvent_VK_QUOTE222L, XK_apostrophe0x0027, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
258 {java_awt_event_KeyEvent_VK_LEFT_PARENTHESIS519L, XK_parenleft0x0028, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
259 {java_awt_event_KeyEvent_VK_RIGHT_PARENTHESIS522L, XK_parenright0x0029, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
260 {java_awt_event_KeyEvent_VK_ASTERISK151L, XK_asterisk0x002a, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
261 {java_awt_event_KeyEvent_VK_PLUS521L, XK_plus0x002b, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
262 {java_awt_event_KeyEvent_VK_COMMA44L, XK_comma0x002c, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
263 {java_awt_event_KeyEvent_VK_MINUS45L, XK_minus0x002d, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
264 {java_awt_event_KeyEvent_VK_PERIOD46L, XK_period0x002e, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
265 {java_awt_event_KeyEvent_VK_SLASH47L, XK_slash0x002f, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
266
267 {java_awt_event_KeyEvent_VK_COLON513L, XK_colon0x003a, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
268 {java_awt_event_KeyEvent_VK_SEMICOLON59L, XK_semicolon0x003b, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
269 {java_awt_event_KeyEvent_VK_LESS153L, XK_less0x003c, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
270 {java_awt_event_KeyEvent_VK_EQUALS61L, XK_equal0x003d, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
271 {java_awt_event_KeyEvent_VK_GREATER160L, XK_greater0x003e, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
272
273 {java_awt_event_KeyEvent_VK_AT512L, XK_at0x0040, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
274
275 {java_awt_event_KeyEvent_VK_OPEN_BRACKET91L, XK_bracketleft0x005b, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
276 {java_awt_event_KeyEvent_VK_BACK_SLASH92L, XK_backslash0x005c, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
277 {java_awt_event_KeyEvent_VK_CLOSE_BRACKET93L, XK_bracketright0x005d, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
278 {java_awt_event_KeyEvent_VK_CIRCUMFLEX514L, XK_asciicircum0x005e, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
279 {java_awt_event_KeyEvent_VK_UNDERSCORE523L, XK_underscore0x005f, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
280 {java_awt_event_KeyEvent_VK_BACK_QUOTE192L, XK_grave0x0060, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
281
282 {java_awt_event_KeyEvent_VK_BRACELEFT161L, XK_braceleft0x007b, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
283 {java_awt_event_KeyEvent_VK_BRACERIGHT162L, XK_braceright0x007d, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
284
285 {java_awt_event_KeyEvent_VK_INVERTED_EXCLAMATION_MARK518L, XK_exclamdown0x00a1, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
286
287 /* Remaining Numeric Keypad Keys */
288 {java_awt_event_KeyEvent_VK_NUMPAD096L, XK_KP_00xffb0, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
289 {java_awt_event_KeyEvent_VK_NUMPAD197L, XK_KP_10xffb1, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
290 {java_awt_event_KeyEvent_VK_NUMPAD298L, XK_KP_20xffb2, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
291 {java_awt_event_KeyEvent_VK_NUMPAD399L, XK_KP_30xffb3, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
292 {java_awt_event_KeyEvent_VK_NUMPAD4100L, XK_KP_40xffb4, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
293 {java_awt_event_KeyEvent_VK_NUMPAD5101L, XK_KP_50xffb5, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
294 {java_awt_event_KeyEvent_VK_NUMPAD6102L, XK_KP_60xffb6, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
295 {java_awt_event_KeyEvent_VK_NUMPAD7103L, XK_KP_70xffb7, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
296 {java_awt_event_KeyEvent_VK_NUMPAD8104L, XK_KP_80xffb8, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
297 {java_awt_event_KeyEvent_VK_NUMPAD9105L, XK_KP_90xffb9, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
298 {java_awt_event_KeyEvent_VK_SPACE32L, XK_KP_Space0xff80, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
299 {java_awt_event_KeyEvent_VK_TAB9L, XK_KP_Tab0xff89, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
300 {java_awt_event_KeyEvent_VK_ENTER10L, XK_KP_Enter0xff8d, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
301 {java_awt_event_KeyEvent_VK_EQUALS61L, XK_KP_Equal0xffbd, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
302 {java_awt_event_KeyEvent_VK_EQUALS61L, XK_R40xffd5, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
303 {java_awt_event_KeyEvent_VK_MULTIPLY106L, XK_KP_Multiply0xffaa, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
304 {java_awt_event_KeyEvent_VK_MULTIPLY106L, XK_F260xffd7, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
305 {java_awt_event_KeyEvent_VK_MULTIPLY106L, XK_R60xffd7, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
306 {java_awt_event_KeyEvent_VK_ADD107L, XK_KP_Add0xffab, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
307 {java_awt_event_KeyEvent_VK_SEPARATOR108L, XK_KP_Separator0xffac, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
308 {java_awt_event_KeyEvent_VK_SUBTRACT109L, XK_KP_Subtract0xffad, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
309 {java_awt_event_KeyEvent_VK_SUBTRACT109L, XK_F240xffd5, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
310 {java_awt_event_KeyEvent_VK_DECIMAL110L, XK_KP_Decimal0xffae, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
311 {java_awt_event_KeyEvent_VK_DIVIDE111L, XK_KP_Divide0xffaf, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
312 {java_awt_event_KeyEvent_VK_DIVIDE111L, XK_F250xffd6, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
313 {java_awt_event_KeyEvent_VK_DIVIDE111L, XK_R50xffd6, TRUE1, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD4L},
314
315 /* Function Keys */
316 {java_awt_event_KeyEvent_VK_F1112L, XK_F10xffbe, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
317 {java_awt_event_KeyEvent_VK_F2113L, XK_F20xffbf, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
318 {java_awt_event_KeyEvent_VK_F3114L, XK_F30xffc0, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
319 {java_awt_event_KeyEvent_VK_F4115L, XK_F40xffc1, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
320 {java_awt_event_KeyEvent_VK_F5116L, XK_F50xffc2, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
321 {java_awt_event_KeyEvent_VK_F6117L, XK_F60xffc3, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
322 {java_awt_event_KeyEvent_VK_F7118L, XK_F70xffc4, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
323 {java_awt_event_KeyEvent_VK_F8119L, XK_F80xffc5, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
324 {java_awt_event_KeyEvent_VK_F9120L, XK_F90xffc6, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
325 {java_awt_event_KeyEvent_VK_F10121L, XK_F100xffc7, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
326 {java_awt_event_KeyEvent_VK_F11122L, XK_F110xffc8, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
327 {java_awt_event_KeyEvent_VK_F12123L, XK_F120xffc9, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
328
329 /* Sun vendor-specific version of F11 and F12 */
330 {java_awt_event_KeyEvent_VK_F11122L, SunXK_F360x1005FF10, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
331 {java_awt_event_KeyEvent_VK_F12123L, SunXK_F370x1005FF11, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
332
333 /* X11 keysym names for input method related keys don't always
334 * match keytop engravings or Java virtual key names, so here we
335 * only map constants that we've found on real keyboards.
336 */
337 /* Type 5c Japanese keyboard: kakutei */
338 {java_awt_event_KeyEvent_VK_ACCEPT30L, XK_Execute0xff62, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
339 /* Type 5c Japanese keyboard: henkan */
340 {java_awt_event_KeyEvent_VK_CONVERT28L, XK_Kanji0xff21, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
341 /* Type 5c Japanese keyboard: nihongo */
342 {java_awt_event_KeyEvent_VK_INPUT_METHOD_ON_OFF263L, XK_Henkan_Mode0xff23, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
343 /* VK_KANA_LOCK is handled separately because it generates the
344 * same keysym as ALT_GRAPH in spite of its different behavior.
345 */
346
347 {java_awt_event_KeyEvent_VK_ALL_CANDIDATES256L, XK_Zen_Koho0xff3d, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
348 {java_awt_event_KeyEvent_VK_ALPHANUMERIC240L, XK_Eisu_Shift0xff2f, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
349 {java_awt_event_KeyEvent_VK_ALPHANUMERIC240L, XK_Eisu_toggle0xff30, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
350 {java_awt_event_KeyEvent_VK_CODE_INPUT258L, XK_Kanji_Bangou0xff37, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
351 {java_awt_event_KeyEvent_VK_FULL_WIDTH243L, XK_Zenkaku0xff28, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
352 {java_awt_event_KeyEvent_VK_HALF_WIDTH244L, XK_Hankaku0xff29, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
353 {java_awt_event_KeyEvent_VK_HIRAGANA242L, XK_Hiragana0xff25, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
354 {java_awt_event_KeyEvent_VK_JAPANESE_HIRAGANA260L, XK_Hiragana0xff25, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
355 {java_awt_event_KeyEvent_VK_KATAKANA241L, XK_Katakana0xff26, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
356 {java_awt_event_KeyEvent_VK_JAPANESE_KATAKANA259L, XK_Katakana0xff26, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
357 {java_awt_event_KeyEvent_VK_JAPANESE_ROMAN261L, XK_Romaji0xff24, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
358 {java_awt_event_KeyEvent_VK_KANA21L, XK_Kana_Shift0xff2e, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
359 {java_awt_event_KeyEvent_VK_KANA_LOCK262L, XK_Kana_Lock0xff2d, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
360 {java_awt_event_KeyEvent_VK_KANJI25L, XK_Kanji0xff21, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
361 {java_awt_event_KeyEvent_VK_NONCONVERT29L, XK_Muhenkan0xff22, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
362 {java_awt_event_KeyEvent_VK_PREVIOUS_CANDIDATE257L, XK_Mae_Koho0xff3e, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
363 {java_awt_event_KeyEvent_VK_ROMAN_CHARACTERS245L, XK_Romaji0xff24, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
364
365 {java_awt_event_KeyEvent_VK_COMPOSE65312L, XK_Multi_key0xff20, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
366 {java_awt_event_KeyEvent_VK_ALT_GRAPH65406L, XK_ISO_Level3_Shift0xfe03, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
367
368 /* Editing block */
369 {java_awt_event_KeyEvent_VK_AGAIN65481L, XK_Redo0xff66, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
370 {java_awt_event_KeyEvent_VK_AGAIN65481L, XK_L20xffc9, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
371 {java_awt_event_KeyEvent_VK_UNDO65483L, XK_Undo0xff65, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
372 {java_awt_event_KeyEvent_VK_UNDO65483L, XK_L40xffcb, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
373 {java_awt_event_KeyEvent_VK_COPY65485L, XK_L60xffcd, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
374 {java_awt_event_KeyEvent_VK_PASTE65487L, XK_L80xffcf, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
375 {java_awt_event_KeyEvent_VK_CUT65489L, XK_L100xffd1, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
376 {java_awt_event_KeyEvent_VK_FIND65488L, XK_Find0xff68, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
377 {java_awt_event_KeyEvent_VK_FIND65488L, XK_L90xffd0, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
378 {java_awt_event_KeyEvent_VK_PROPS65482L, XK_L30xffca, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
379 {java_awt_event_KeyEvent_VK_STOP65480L, XK_L10xffc8, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
380
381 /* Sun vendor-specific versions for editing block */
382 {java_awt_event_KeyEvent_VK_AGAIN65481L, SunXK_Again0x0000FF66, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
383 {java_awt_event_KeyEvent_VK_UNDO65483L, SunXK_Undo0x0000FF65, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
384 {java_awt_event_KeyEvent_VK_COPY65485L, SunXK_Copy0x1005FF72, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
385 {java_awt_event_KeyEvent_VK_PASTE65487L, SunXK_Paste0x1005FF74, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
386 {java_awt_event_KeyEvent_VK_CUT65489L, SunXK_Cut0x1005FF75, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
387 {java_awt_event_KeyEvent_VK_FIND65488L, SunXK_Find0x0000FF68, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
388 {java_awt_event_KeyEvent_VK_PROPS65482L, SunXK_Props0x1005FF70, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
389 {java_awt_event_KeyEvent_VK_STOP65480L, SunXK_Stop0x0000FF69, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
390
391 /* Apollo (HP) vendor-specific versions for editing block */
392 {java_awt_event_KeyEvent_VK_COPY65485L, apXK_Copy0x1000FF02, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
393 {java_awt_event_KeyEvent_VK_CUT65489L, apXK_Cut0x1000FF03, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
394 {java_awt_event_KeyEvent_VK_PASTE65487L, apXK_Paste0x1000FF04, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
395
396 /* Other vendor-specific versions for editing block */
397 {java_awt_event_KeyEvent_VK_COPY65485L, osfXK_Copy0x1004FF02, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
398 {java_awt_event_KeyEvent_VK_CUT65489L, osfXK_Cut0x1004FF03, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
399 {java_awt_event_KeyEvent_VK_PASTE65487L, osfXK_Paste0x1004FF04, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
400 {java_awt_event_KeyEvent_VK_UNDO65483L, osfXK_Undo0x1004FF65, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
401
402 /* Dead key mappings (for European keyboards) */
403 {java_awt_event_KeyEvent_VK_DEAD_GRAVE128L, XK_dead_grave0xfe50, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
404 {java_awt_event_KeyEvent_VK_DEAD_ACUTE129L, XK_dead_acute0xfe51, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
405 {java_awt_event_KeyEvent_VK_DEAD_CIRCUMFLEX130L, XK_dead_circumflex0xfe52, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
406 {java_awt_event_KeyEvent_VK_DEAD_TILDE131L, XK_dead_tilde0xfe53, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
407 {java_awt_event_KeyEvent_VK_DEAD_MACRON132L, XK_dead_macron0xfe54, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
408 {java_awt_event_KeyEvent_VK_DEAD_BREVE133L, XK_dead_breve0xfe55, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
409 {java_awt_event_KeyEvent_VK_DEAD_ABOVEDOT134L, XK_dead_abovedot0xfe56, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
410 {java_awt_event_KeyEvent_VK_DEAD_DIAERESIS135L, XK_dead_diaeresis0xfe57, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
411 {java_awt_event_KeyEvent_VK_DEAD_ABOVERING136L, XK_dead_abovering0xfe58, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
412 {java_awt_event_KeyEvent_VK_DEAD_DOUBLEACUTE137L, XK_dead_doubleacute0xfe59, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
413 {java_awt_event_KeyEvent_VK_DEAD_CARON138L, XK_dead_caron0xfe5a, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
414 {java_awt_event_KeyEvent_VK_DEAD_CEDILLA139L, XK_dead_cedilla0xfe5b, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
415 {java_awt_event_KeyEvent_VK_DEAD_OGONEK140L, XK_dead_ogonek0xfe5c, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
416 {java_awt_event_KeyEvent_VK_DEAD_IOTA141L, XK_dead_iota0xfe5d, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
417 {java_awt_event_KeyEvent_VK_DEAD_VOICED_SOUND142L, XK_dead_voiced_sound0xfe5e, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
418 {java_awt_event_KeyEvent_VK_DEAD_SEMIVOICED_SOUND143L, XK_dead_semivoiced_sound0xfe5f, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
419
420 /* Sun vendor-specific dead key mappings (for European keyboards) */
421 {java_awt_event_KeyEvent_VK_DEAD_GRAVE128L, SunXK_FA_Grave0x1005FF00, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
422 {java_awt_event_KeyEvent_VK_DEAD_CIRCUMFLEX130L, SunXK_FA_Circum0x1005FF01, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
423 {java_awt_event_KeyEvent_VK_DEAD_TILDE131L, SunXK_FA_Tilde0x1005FF02, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
424 {java_awt_event_KeyEvent_VK_DEAD_ACUTE129L, SunXK_FA_Acute0x1005FF03, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
425 {java_awt_event_KeyEvent_VK_DEAD_DIAERESIS135L, SunXK_FA_Diaeresis0x1005FF04, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
426 {java_awt_event_KeyEvent_VK_DEAD_CEDILLA139L, SunXK_FA_Cedilla0x1005FF05, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
427
428 /* DEC vendor-specific dead key mappings (for European keyboards) */
429 {java_awt_event_KeyEvent_VK_DEAD_ABOVERING136L, DXK_ring_accent0x1000FEB0, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
430 {java_awt_event_KeyEvent_VK_DEAD_CIRCUMFLEX130L, DXK_circumflex_accent0x1000FE5E, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
431 {java_awt_event_KeyEvent_VK_DEAD_CEDILLA139L, DXK_cedilla_accent0x1000FE2C, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
432 {java_awt_event_KeyEvent_VK_DEAD_ACUTE129L, DXK_acute_accent0x1000FE27, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
433 {java_awt_event_KeyEvent_VK_DEAD_GRAVE128L, DXK_grave_accent0x1000FE60, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
434 {java_awt_event_KeyEvent_VK_DEAD_TILDE131L, DXK_tilde0x1000FE7E, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
435 {java_awt_event_KeyEvent_VK_DEAD_DIAERESIS135L, DXK_diaeresis0x1000FE22, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
436
437 /* Other vendor-specific dead key mappings (for European keyboards) */
438 {java_awt_event_KeyEvent_VK_DEAD_ACUTE129L, hpXK_mute_acute0x100000A8, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
439 {java_awt_event_KeyEvent_VK_DEAD_GRAVE128L, hpXK_mute_grave0x100000A9, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
440 {java_awt_event_KeyEvent_VK_DEAD_CIRCUMFLEX130L, hpXK_mute_asciicircum0x100000AA, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
441 {java_awt_event_KeyEvent_VK_DEAD_DIAERESIS135L, hpXK_mute_diaeresis0x100000AB, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
442 {java_awt_event_KeyEvent_VK_DEAD_TILDE131L, hpXK_mute_asciitilde0x100000AC, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD1L},
443
444 {java_awt_event_KeyEvent_VK_UNDEFINED0L, NoSymbol0L, FALSE0, java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN0L}
445};
446
447static Boolean
448keyboardHasKanaLockKey()
449{
450 static Boolean haveResult = FALSE0;
451 static Boolean result = FALSE0;
452
453 int32_t minKeyCode, maxKeyCode, keySymsPerKeyCode;
454 KeySym *keySyms, *keySymsStart, keySym;
455 int32_t i;
456 int32_t kanaCount = 0;
457
458 // Solaris doesn't let you swap keyboards without rebooting,
459 // so there's no need to check for the kana lock key more than once.
460 if (haveResult) {
461 return result;
462 }
463
464 // There's no direct way to determine whether the keyboard has
465 // a kana lock key. From available keyboard mapping tables, it looks
466 // like only keyboards with the kana lock key can produce keysyms
467 // for kana characters. So, as an indirect test, we check for those.
468 XDisplayKeycodes(awt_display, &minKeyCode, &maxKeyCode);
469 keySyms = XGetKeyboardMapping(awt_display, minKeyCode, maxKeyCode - minKeyCode + 1, &keySymsPerKeyCode);
470 keySymsStart = keySyms;
471 for (i = 0; i < (maxKeyCode - minKeyCode + 1) * keySymsPerKeyCode; i++) {
472 keySym = *keySyms++;
473 if ((keySym & 0xff00) == 0x0400) {
474 kanaCount++;
475 }
476 }
477 XFree(keySymsStart);
478
479 // use a (somewhat arbitrary) minimum so we don't get confused by a stray function key
480 result = kanaCount > 10;
481 haveResult = TRUE1;
482 return result;
483}
484
485static void
486keysymToAWTKeyCode(KeySym x11Key, jint *keycode, Boolean *mapsToUnicodeChar,
487 jint *keyLocation)
488{
489 int32_t i;
490
491 // Solaris uses XK_Mode_switch for both the non-locking AltGraph
492 // and the locking Kana key, but we want to keep them separate for
493 // KeyEvent.
494 if (x11Key == XK_Mode_switch0xff7e && keyboardHasKanaLockKey()) {
495 *keycode = java_awt_event_KeyEvent_VK_KANA_LOCK262L;
496 *mapsToUnicodeChar = FALSE0;
497 *keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN0L;
498 return;
499 }
500
501 for (i = 0;
502 keymapTable[i].awtKey != java_awt_event_KeyEvent_VK_UNDEFINED0L;
503 i++)
504 {
505 if (keymapTable[i].x11Key == x11Key) {
506 *keycode = keymapTable[i].awtKey;
507 *mapsToUnicodeChar = keymapTable[i].mapsToUnicodeChar;
508 *keyLocation = keymapTable[i].keyLocation;
509 return;
510 }
511 }
512
513 *keycode = java_awt_event_KeyEvent_VK_UNDEFINED0L;
514 *mapsToUnicodeChar = FALSE0;
515 *keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN0L;
516
517 DTRACE_PRINTLN1("keysymToAWTKeyCode: no key mapping found: keysym = 0x%x", x11Key){ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 517, (1), (("keysymToAWTKeyCode: no key mapping found: keysym = 0x%x"
)), ((x11Key)), (0), (0), (0), (0), (0), (0), (0) ); }
;
518}
519
520KeySym
521awt_getX11KeySym(jint awtKey)
522{
523 int32_t i;
524
525 if (awtKey == java_awt_event_KeyEvent_VK_KANA_LOCK262L && keyboardHasKanaLockKey()) {
526 return XK_Mode_switch0xff7e;
527 }
528
529 for (i = 0; keymapTable[i].awtKey != 0; i++) {
530 if (keymapTable[i].awtKey == awtKey) {
531 return keymapTable[i].x11Key;
532 }
533 }
534
535 DTRACE_PRINTLN1("awt_getX11KeySym: no key mapping found: awtKey = 0x%x", awtKey){ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 535, (1), (("awt_getX11KeySym: no key mapping found: awtKey = 0x%x"
)), ((awtKey)), (0), (0), (0), (0), (0), (0), (0) ); }
;
536 return NoSymbol0L;
537}
538
539/* Called from handleKeyEvent. The purpose of this function is
540 * to check for a list of vendor-specific keysyms, most of which
541 * have values greater than 0xFFFF. Most of these keys don't map
542 * to unicode characters, but some do.
543 *
544 * For keys that don't map to unicode characters, the keysym
545 * is irrelevant at this point. We set the keysym to zero
546 * to ensure that the switch statement immediately below
547 * this function call (in adjustKeySym) won't incorrectly act
548 * on them after the high bits are stripped off.
549 *
550 * For keys that do map to unicode characters, we change the keysym
551 * to the equivalent that is < 0xFFFF
552 */
553static void
554handleVendorKeySyms(XEvent *event, KeySym *keysym)
555{
556 KeySym originalKeysym = *keysym;
557
558 switch (*keysym) {
559 /* Apollo (HP) vendor-specific from <X11/ap_keysym.h> */
560 case apXK_Copy0x1000FF02:
561 case apXK_Cut0x1000FF03:
562 case apXK_Paste0x1000FF04:
563 /* DEC vendor-specific from <X11/DECkeysym.h> */
564 case DXK_ring_accent0x1000FEB0: /* syn usldead_ring */
565 case DXK_circumflex_accent0x1000FE5E:
566 case DXK_cedilla_accent0x1000FE2C: /* syn usldead_cedilla */
567 case DXK_acute_accent0x1000FE27:
568 case DXK_grave_accent0x1000FE60:
569 case DXK_tilde0x1000FE7E:
570 case DXK_diaeresis0x1000FE22:
571 /* Sun vendor-specific from <X11/Sunkeysym.h> */
572 case SunXK_FA_Grave0x1005FF00:
573 case SunXK_FA_Circum0x1005FF01:
574 case SunXK_FA_Tilde0x1005FF02:
575 case SunXK_FA_Acute0x1005FF03:
576 case SunXK_FA_Diaeresis0x1005FF04:
577 case SunXK_FA_Cedilla0x1005FF05:
578 case SunXK_F360x1005FF10: /* Labeled F11 */
579 case SunXK_F370x1005FF11: /* Labeled F12 */
580 case SunXK_Props0x1005FF70:
581 case SunXK_Copy0x1005FF72:
582 case SunXK_Open0x1005FF73:
583 case SunXK_Paste0x1005FF74:
584 case SunXK_Cut0x1005FF75:
585 /* Other vendor-specific from HPkeysym.h */
586 case hpXK_mute_acute0x100000A8: /* syn usldead_acute */
587 case hpXK_mute_grave0x100000A9: /* syn usldead_grave */
588 case hpXK_mute_asciicircum0x100000AA: /* syn usldead_asciicircum */
589 case hpXK_mute_diaeresis0x100000AB: /* syn usldead_diaeresis */
590 case hpXK_mute_asciitilde0x100000AC: /* syn usldead_asciitilde */
591 case osfXK_Copy0x1004FF02:
592 case osfXK_Cut0x1004FF03:
593 case osfXK_Paste0x1004FF04:
594 case osfXK_PageUp0x1004FF41:
595 case osfXK_PageDown0x1004FF42:
596 case osfXK_EndLine0x1004FF57:
597 case osfXK_Clear0x1004FF0B:
598 case osfXK_Left0x1004FF51:
599 case osfXK_Up0x1004FF52:
600 case osfXK_Right0x1004FF53:
601 case osfXK_Down0x1004FF54:
602 case osfXK_Prior0x1004FF55:
603 case osfXK_Next0x1004FF56:
604 case osfXK_Insert0x1004FF63:
605 case osfXK_Undo0x1004FF65:
606 case osfXK_Help0x1004FF6A:
607 *keysym = 0;
608 break;
609 /*
610 * The rest DO map to unicode characters, so translate them
611 */
612 case osfXK_BackSpace0x1004FF08:
613 *keysym = XK_BackSpace0xff08;
614 break;
615 case osfXK_Escape0x1004FF1B:
616 *keysym = XK_Escape0xff1b;
617 break;
618 case osfXK_Cancel0x1004FF69:
619 *keysym = XK_Cancel0xff69;
620 break;
621 case osfXK_Delete0x1004FFFF:
622 *keysym = XK_Delete0xffff;
623 break;
624 default:
625 break;
626 }
627
628 if (originalKeysym != *keysym) {
629 DTRACE_PRINTLN3("%s originalKeysym=0x%x, keysym=0x%x",{ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 630, (3), (("%s originalKeysym=0x%x, keysym=0x%x")), (("In handleVendorKeySyms:"
)), ((originalKeysym)), ((*keysym)), (0), (0), (0), (0), (0) )
; }
630 "In handleVendorKeySyms:", originalKeysym, *keysym){ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 630, (3), (("%s originalKeysym=0x%x, keysym=0x%x")), (("In handleVendorKeySyms:"
)), ((originalKeysym)), ((*keysym)), (0), (0), (0), (0), (0) )
; }
;
631 }
632}
633
634/* Called from handleKeyEvent.
635 * The purpose of this function is to adjust the keysym and XEvent
636 * keycode for a key event. This is basically a conglomeration of
637 * bugfixes that require these adjustments.
638 * Note that none of the keysyms in this function are less than 256.
639 */
640static void
641adjustKeySym(XEvent *event, KeySym *keysym)
642{
643 KeySym originalKeysym = *keysym;
644 KeyCode originalKeycode = event->xkey.keycode;
645
646 /* We have seen bits set in the high two bytes on Linux,
647 * which prevents this switch statement from executing
648 * correctly. Strip off the high order bits.
649 */
650 *keysym &= 0x0000FFFF;
651
652 switch (*keysym) {
653 case XK_ISO_Left_Tab0xfe20: /* shift-tab on Linux */
654 *keysym = XK_Tab0xff09;
655 break;
656 case XK_KP_Decimal0xffae:
657 *keysym = '.';
658 break;
659 case XK_KP_Add0xffab:
660 *keysym = '+';
661 break;
662 case XK_F240xffd5: /* NumLock off */
663 case XK_KP_Subtract0xffad: /* NumLock on */
664 *keysym = '-';
665 break;
666 case XK_F250xffd6: /* NumLock off */
667 case XK_KP_Divide0xffaf: /* NumLock on */
668 *keysym = '/';
669 break;
670 case XK_F260xffd7: /* NumLock off */
671 case XK_KP_Multiply0xffaa: /* NumLock on */
672 *keysym = '*';
673 break;
674 case XK_KP_Equal0xffbd:
675 *keysym = '=';
676 break;
677 case XK_KP_00xffb0:
678 *keysym = '0';
679 break;
680 case XK_KP_10xffb1:
681 *keysym = '1';
682 break;
683 case XK_KP_20xffb2:
684 *keysym = '2';
685 break;
686 case XK_KP_30xffb3:
687 *keysym = '3';
688 break;
689 case XK_KP_40xffb4:
690 *keysym = '4';
691 break;
692 case XK_KP_50xffb5:
693 *keysym = '5';
694 break;
695 case XK_KP_60xffb6:
696 *keysym = '6';
697 break;
698 case XK_KP_70xffb7:
699 *keysym = '7';
700 break;
701 case XK_KP_80xffb8:
702 *keysym = '8';
703 break;
704 case XK_KP_90xffb9:
705 *keysym = '9';
706 break;
707 case XK_KP_Left0xff96: /* Bug 4350175 */
708 *keysym = XK_Left0xff51;
709 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
710 break;
711 case XK_KP_Up0xff97:
712 *keysym = XK_Up0xff52;
713 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
714 break;
715 case XK_KP_Right0xff98:
716 *keysym = XK_Right0xff53;
717 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
718 break;
719 case XK_KP_Down0xff99:
720 *keysym = XK_Down0xff54;
721 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
722 break;
723 case XK_KP_Home0xff95:
724 *keysym = XK_Home0xff50;
725 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
726 break;
727 case XK_KP_End0xff9c:
728 *keysym = XK_End0xff57;
729 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
730 break;
731 case XK_KP_Page_Up0xff9a:
732 *keysym = XK_Page_Up0xff55;
733 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
734 break;
735 case XK_KP_Page_Down0xff9b:
736 *keysym = XK_Page_Down0xff56;
737 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
738 break;
739 case XK_KP_Begin0xff9d:
740 *keysym = XK_Begin0xff58;
741 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
742 break;
743 case XK_KP_Insert0xff9e:
744 *keysym = XK_Insert0xff63;
745 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
746 break;
747 case XK_KP_Delete0xff9f:
748 *keysym = XK_Delete0xffff;
749 event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
750 break;
751 case XK_KP_Enter0xff8d:
752 *keysym = XK_Linefeed0xff0a;
753 event->xkey.keycode = XKeysymToKeycode(awt_display, XK_Return0xff0d);
754 break;
755 default:
756 break;
757 }
758
759 if (originalKeysym != *keysym) {
760 DTRACE_PRINTLN2("In adjustKeySym: originalKeysym=0x%x, keysym=0x%x",{ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 761, (2), (("In adjustKeySym: originalKeysym=0x%x, keysym=0x%x"
)), ((originalKeysym)), ((*keysym)), (0), (0), (0), (0), (0),
(0) ); }
761 originalKeysym, *keysym){ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 761, (2), (("In adjustKeySym: originalKeysym=0x%x, keysym=0x%x"
)), ((originalKeysym)), ((*keysym)), (0), (0), (0), (0), (0),
(0) ); }
;
762 }
763 if (originalKeycode != event->xkey.keycode) {
764 DTRACE_PRINTLN2("In adjustKeySym: originalKeycode=0x%x, keycode=0x%x",{ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 765, (2), (("In adjustKeySym: originalKeycode=0x%x, keycode=0x%x"
)), ((originalKeycode)), ((event->xkey.keycode)), (0), (0)
, (0), (0), (0), (0) ); }
765 originalKeycode, event->xkey.keycode){ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 765, (2), (("In adjustKeySym: originalKeycode=0x%x, keycode=0x%x"
)), ((originalKeycode)), ((event->xkey.keycode)), (0), (0)
, (0), (0), (0), (0) ); }
;
766 }
767}
768
769/*
770 * What a sniffer sez?
771 * Xsun and Xorg if NumLock is on do two thing different:
772 * keep Keypad key in different places of keysyms array and
773 * ignore/obey "ModLock is ShiftLock", so we should choose.
774 * People say, it's right to use behavior and not Vendor tags to decide.
775 * Maybe. But why these tags were invented, then?
776 * TODO: use behavior, not tags. Maybe.
777 */
778static Boolean
779isXsunServer(XEvent *event) {
780 if( awt_ServerDetected ) return awt_IsXsun;
781 if( (strncmp( ServerVendor( event->xkey.display )(((_XPrivDisplay)(event->xkey.display))->vendor), "Sun Microsystems, Inc.", 22) != 0) &&
782 (strncmp( ServerVendor( event->xkey.display )(((_XPrivDisplay)(event->xkey.display))->vendor), "Oracle Corporation", 18) != 0) )
783 {
784 awt_ServerDetected = True1;
785 awt_IsXsun = False0;
786 return False0;
787 }
788 // Now, it's Sun. It still may be Xorg though, eg on Solaris 10, x86.
789 // Today (2005), VendorRelease of Xorg is a Big Number unlike Xsun.
790 if( VendorRelease( event->xkey.display )(((_XPrivDisplay)(event->xkey.display))->release) > 10000 ) {
791 awt_ServerDetected = True1;
792 awt_IsXsun = False0;
793 return False0;
794 }
795 awt_ServerDetected = True1;
796 awt_IsXsun = True1;
797 return True1;
798}
799/*
800 * +kb or -kb ?
801 */
802static Boolean
803isXKBenabled(Display *display) {
804 int mop, beve, berr;
805 if( !awt_XKBDetected ) {
806 /*
807 * NB: TODO: hope it will return False if XkbIgnoreExtension was called!
808 */
809 awt_UseXKB = XQueryExtension(display, "XKEYBOARD", &mop, &beve, &berr);
810 awt_XKBDetected = True1;
811 }
812 return awt_UseXKB;
813}
814
815/*
816 * Map a keycode to the corresponding keysym.
817 * This replaces the deprecated X11 function XKeycodeToKeysym
818 */
819KeySym
820keycodeToKeysym(Display *display, KeyCode keycode, int index) {
821 static int min_kc = -1;
822 static int max_kc;
823 if (min_kc == -1) {
824 (void) XDisplayKeycodes(display, &min_kc, &max_kc);
825 }
826 if (keycode < min_kc || keycode > max_kc || index < 0) {
827 return NoSymbol0L;
828 }
829 int num_syms;
830 KeySym *key_syms = XGetKeyboardMapping(display, keycode, 1, &num_syms);
831 if (index >= num_syms) {
832 XFree(key_syms);
833 return NoSymbol0L;
834 }
835 KeySym ks = key_syms[index];
836 XFree(key_syms);
837 return ks;
838}
839
840static Boolean
841isKPevent(XEvent *event)
842{
843 /*
844 * Xlib manual, ch 12.7 says, as a first rule for choice of keysym:
845 * The numlock modifier is on and the second KeySym is a keypad KeySym. In this case,
846 * if the Shift modifier is on, or if the Lock modifier is on and is interpreted as ShiftLock,
847 * then the first KeySym is used, otherwise the second KeySym is used.
848 *
849 * However, Xsun server does ignore ShiftLock and always takes 3-rd element from an array.
850 *
851 * So, is it a keypad keysym?
852 */
853 Boolean bsun = isXsunServer( event );
854 Boolean bxkb = isXKBenabled( event->xkey.display );
855 return IsKeypadKey( keycodeToKeysym(event->xkey.display, event->xkey.keycode,(bsun && !bxkb ? 2 : 1) ) )(((KeySym)(keycodeToKeysym(event->xkey.display, event->
xkey.keycode,(bsun && !bxkb ? 2 : 1) )) >= 0xff80)
&& ((KeySym)(keycodeToKeysym(event->xkey.display,
event->xkey.keycode,(bsun && !bxkb ? 2 : 1) )) <=
0xffbd))
;
856}
857static void
858dumpKeysymArray(XEvent *event) {
859 printf(" 0x%lX\n", (unsigned long)keycodeToKeysym(event->xkey.display, event->xkey.keycode, 0))__printf_chk (2 - 1, " 0x%lX\n", (unsigned long)keycodeToKeysym
(event->xkey.display, event->xkey.keycode, 0))
;
860 printf(" 0x%lX\n", (unsigned long)keycodeToKeysym(event->xkey.display, event->xkey.keycode, 1))__printf_chk (2 - 1, " 0x%lX\n", (unsigned long)keycodeToKeysym
(event->xkey.display, event->xkey.keycode, 1))
;
861 printf(" 0x%lX\n", (unsigned long)keycodeToKeysym(event->xkey.display, event->xkey.keycode, 2))__printf_chk (2 - 1, " 0x%lX\n", (unsigned long)keycodeToKeysym
(event->xkey.display, event->xkey.keycode, 2))
;
862 printf(" 0x%lX\n", (unsigned long)keycodeToKeysym(event->xkey.display, event->xkey.keycode, 3))__printf_chk (2 - 1, " 0x%lX\n", (unsigned long)keycodeToKeysym
(event->xkey.display, event->xkey.keycode, 3))
;
863}
864/*
865 * In a next redesign, get rid of this code altogether.
866 *
867 */
868static void
869handleKeyEventWithNumLockMask_New(XEvent *event, KeySym *keysym)
870{
871 KeySym originalKeysym = *keysym;
Value stored to 'originalKeysym' during its initialization is never read
872 if( !isKPevent( event ) ) {
873 return;
874 }
875 if( isXsunServer( event ) && !awt_UseXKB) {
876 if( (event->xkey.state & ShiftMask(1<<0)) ) { // shift modifier is on
877 *keysym = keycodeToKeysym(event->xkey.display,
878 event->xkey.keycode, 3);
879 }else {
880 *keysym = keycodeToKeysym(event->xkey.display,
881 event->xkey.keycode, 2);
882 }
883 } else {
884 if( (event->xkey.state & ShiftMask(1<<0)) || // shift modifier is on
885 ((event->xkey.state & LockMask(1<<1)) && // lock modifier is on
886 (awt_ModLockIsShiftLock)) ) { // it is interpreted as ShiftLock
887 *keysym = keycodeToKeysym(event->xkey.display,
888 event->xkey.keycode, 0);
889 }else{
890 *keysym = keycodeToKeysym(event->xkey.display,
891 event->xkey.keycode, 1);
892 }
893 }
894}
895
896/* Called from handleKeyEvent.
897 * The purpose of this function is to make some adjustments to keysyms
898 * that have been found to be necessary when the NumLock mask is set.
899 * They come from various bug fixes and rearchitectures.
900 * This function is meant to be called when
901 * (event->xkey.state & awt_NumLockMask) is TRUE.
902 */
903static void
904handleKeyEventWithNumLockMask(XEvent *event, KeySym *keysym)
905{
906 KeySym originalKeysym = *keysym;
907
908#if !defined(__linux__1)
909 /* The following code on Linux will cause the keypad keys
910 * not to echo on JTextField when the NumLock is on. The
911 * keysyms will be 0, because the last parameter 2 is not defined.
912 * See Xlib Programming Manual, O'Reilly & Associates, Section
913 * 9.1.5 "Other Keyboard-handling Routines", "The meaning of
914 * the keysym list beyond the first two (unmodified, Shift or
915 * Shift Lock) is not defined."
916 */
917
918 /* Translate again with NumLock as modifier. */
919 /* ECH - I wonder why we think that NumLock corresponds to 2?
920 On Linux, we've seen xmodmap -pm yield mod2 as NumLock,
921 but I don't know that it will be for every configuration.
922 Perhaps using the index (modn in awt_MToolkit.c:setup_modifier_map)
923 would be more correct.
924 */
925 *keysym = keycodeToKeysym(event->xkey.display,
926 event->xkey.keycode, 2);
927 if (originalKeysym != *keysym) {
928 DTRACE_PRINTLN3("%s originalKeysym=0x%x, keysym=0x%x",{ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 930, (3), (("%s originalKeysym=0x%x, keysym=0x%x")), (("In handleKeyEventWithNumLockMask ifndef linux:"
)), ((originalKeysym)), ((*keysym)), (0), (0), (0), (0), (0) )
; }
929 "In handleKeyEventWithNumLockMask ifndef linux:",{ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 930, (3), (("%s originalKeysym=0x%x, keysym=0x%x")), (("In handleKeyEventWithNumLockMask ifndef linux:"
)), ((originalKeysym)), ((*keysym)), (0), (0), (0), (0), (0) )
; }
930 originalKeysym, *keysym){ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 930, (3), (("%s originalKeysym=0x%x, keysym=0x%x")), (("In handleKeyEventWithNumLockMask ifndef linux:"
)), ((originalKeysym)), ((*keysym)), (0), (0), (0), (0), (0) )
; }
;
931 }
932#endif
933
934 /* Note: the XK_R? key assignments are for Type 4 kbds */
935 switch (*keysym) {
936 case XK_R130xffde:
937 *keysym = XK_KP_10xffb1;
938 break;
939 case XK_R140xffdf:
940 *keysym = XK_KP_20xffb2;
941 break;
942 case XK_R150xffe0:
943 *keysym = XK_KP_30xffb3;
944 break;
945 case XK_R100xffdb:
946 *keysym = XK_KP_40xffb4;
947 break;
948 case XK_R110xffdc:
949 *keysym = XK_KP_50xffb5;
950 break;
951 case XK_R120xffdd:
952 *keysym = XK_KP_60xffb6;
953 break;
954 case XK_R70xffd8:
955 *keysym = XK_KP_70xffb7;
956 break;
957 case XK_R80xffd9:
958 *keysym = XK_KP_80xffb8;
959 break;
960 case XK_R90xffda:
961 *keysym = XK_KP_90xffb9;
962 break;
963 case XK_KP_Insert0xff9e:
964 *keysym = XK_KP_00xffb0;
965 break;
966 case XK_KP_Delete0xff9f:
967 *keysym = XK_KP_Decimal0xffae;
968 break;
969 case XK_R40xffd5:
970 *keysym = XK_KP_Equal0xffbd; /* Type 4 kbd */
971 break;
972 case XK_R50xffd6:
973 *keysym = XK_KP_Divide0xffaf;
974 break;
975 case XK_R60xffd7:
976 *keysym = XK_KP_Multiply0xffaa;
977 break;
978 /*
979 * Need the following keysym changes for Linux key releases.
980 * Sometimes the modifier state gets messed up, so we get a
981 * KP_Left when we should get a KP_4, for example.
982 * XK_KP_Insert and XK_KP_Delete were already handled above.
983 */
984 case XK_KP_Left0xff96:
985 *keysym = XK_KP_40xffb4;
986 break;
987 case XK_KP_Up0xff97:
988 *keysym = XK_KP_80xffb8;
989 break;
990 case XK_KP_Right0xff98:
991 *keysym = XK_KP_60xffb6;
992 break;
993 case XK_KP_Down0xff99:
994 *keysym = XK_KP_20xffb2;
995 break;
996 case XK_KP_Home0xff95:
997 *keysym = XK_KP_70xffb7;
998 break;
999 case XK_KP_End0xff9c:
1000 *keysym = XK_KP_10xffb1;
1001 break;
1002 case XK_KP_Page_Up0xff9a:
1003 *keysym = XK_KP_90xffb9;
1004 break;
1005 case XK_KP_Page_Down0xff9b:
1006 *keysym = XK_KP_30xffb3;
1007 break;
1008 case XK_KP_Begin0xff9d:
1009 *keysym = XK_KP_50xffb5;
1010 break;
1011 default:
1012 break;
1013 }
1014
1015 if (originalKeysym != *keysym) {
1016 DTRACE_PRINTLN3("%s originalKeysym=0x%x, keysym=0x%x",{ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 1017, (3), (("%s originalKeysym=0x%x, keysym=0x%x")), (("In handleKeyEventWithNumLockMask:"
)), ((originalKeysym)), ((*keysym)), (0), (0), (0), (0), (0) )
; }
1017 "In handleKeyEventWithNumLockMask:", originalKeysym, *keysym){ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 1017, (3), (("%s originalKeysym=0x%x, keysym=0x%x")), (("In handleKeyEventWithNumLockMask:"
)), ((originalKeysym)), ((*keysym)), (0), (0), (0), (0), (0) )
; }
;
1018 }
1019}
1020
1021/* This function is called as the keyChar parameter of a call to
1022 * awt_post_java_key_event. It depends on being called after adjustKeySym.
1023 *
1024 * This function just handles a few values where we know that the
1025 * keysym is not the same as the unicode value. For values that
1026 * we don't handle explicitly, we just cast the keysym to a jchar.
1027 * Most of the real mapping work that gets the correct keysym is handled
1028 * in the mapping table, adjustKeySym, etc.
1029 *
1030 * XXX
1031 * Maybe we should enumerate the keysyms for which we have a mapping
1032 * in the keyMap, but that don't map to unicode chars, and return
1033 * CHAR_UNDEFINED? Then use the buffer value from XLookupString
1034 * instead of the keysym as the keychar when posting. Then we don't
1035 * need to test using mapsToUnicodeChar. That way, we would post keyTyped
1036 * for all the chars that generate unicode chars, including LATIN2-4, etc.
1037 * Note: what does the buffer from XLookupString contain when
1038 * the character is a non-printable unicode character like Cancel or Delete?
1039 */
1040jchar
1041keySymToUnicodeCharacter(KeySym keysym) {
1042 jchar unicodeValue = (jchar) keysym;
1043
1044 switch (keysym) {
1045 case XK_BackSpace0xff08:
1046 case XK_Tab0xff09:
1047 case XK_Linefeed0xff0a:
1048 case XK_Escape0xff1b:
1049 case XK_Delete0xffff:
1050 /* Strip off highorder bits defined in xkeysymdef.h
1051 * I think doing this converts them to values that
1052 * we can cast to jchars and use as java keychars.
1053 */
1054 unicodeValue = (jchar) (keysym & 0x007F);
1055 break;
1056 case XK_Return0xff0d:
1057 unicodeValue = (jchar) 0x000a; /* the unicode char for Linefeed */
1058 break;
1059 case XK_Cancel0xff69:
1060 unicodeValue = (jchar) 0x0018; /* the unicode char for Cancel */
1061 break;
1062 default:
1063 break;
1064 }
1065
1066 if (unicodeValue != (jchar)keysym) {
1067 DTRACE_PRINTLN3("%s originalKeysym=0x%x, keysym=0x%x",{ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 1068, (3), (("%s originalKeysym=0x%x, keysym=0x%x")), (("In keysymToUnicode:"
)), ((keysym)), ((unicodeValue)), (0), (0), (0), (0), (0) ); }
1068 "In keysymToUnicode:", keysym, unicodeValue){ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; DTrace_PrintFunction
((DTrace_VPrintln), &_Dt_FileTraceId, &_dt_lineid_, "/home/daniel/Projects/java/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c"
, 1068, (3), (("%s originalKeysym=0x%x, keysym=0x%x")), (("In keysymToUnicode:"
)), ((keysym)), ((unicodeValue)), (0), (0), (0), (0), (0) ); }
;
1069 }
1070
1071 return unicodeValue;
1072}
1073
1074
1075void
1076awt_post_java_key_event(JNIEnv *env, jobject peer, jint id,
1077 jlong when, jint keyCode, jchar keyChar, jint keyLocation, jint state, XEvent * event)
1078{
1079 JNU_CallMethodByName(env, NULL((void*)0), peer, "postKeyEvent", "(IJICIIJI)V", id,
1080 when, keyCode, keyChar, keyLocation, state, ptr_to_jlong(event)((jlong)(event)), (jint)sizeof(XEvent));
1081} /* awt_post_java_key_event() */
1082
1083
1084
1085JNIEXPORT__attribute__((visibility("default"))) jint JNICALL
1086Java_sun_awt_X11_XWindow_getAWTKeyCodeForKeySym(JNIEnv *env, jclass clazz, jint keysym) {
1087 jint keycode = java_awt_event_KeyEvent_VK_UNDEFINED0L;
1088 Boolean mapsToUnicodeChar;
1089 jint keyLocation;
1090 keysymToAWTKeyCode(keysym, &keycode, &mapsToUnicodeChar, &keyLocation);
1091 return keycode;
1092}
1093
1094JNIEXPORT__attribute__((visibility("default"))) jboolean JNICALL Java_sun_awt_X11_XWindow_haveCurrentX11InputMethodInstance
1095(JNIEnv *env, jobject object) {
1096 /*printf("Java_sun_awt_X11_XWindow_haveCurrentX11InputMethodInstance: %s\n", (currentX11InputMethodInstance==NULL? "NULL":" notnull"));
1097 */
1098 return currentX11InputMethodInstance != NULL((void*)0) ? JNI_TRUE1 : JNI_FALSE0;
1099}
1100
1101JNIEXPORT__attribute__((visibility("default"))) jboolean JNICALL Java_sun_awt_X11_XWindow_x11inputMethodLookupString
1102(JNIEnv *env, jobject object, jlong event, jlongArray keysymArray) {
1103 KeySym keysym = NoSymbol0L;
1104 Boolean boo;
1105 /* keysymArray (and testbuf[]) have dimension 2 because we put there two
1106 * perhaps different values of keysyms.
1107 * XXX: not anymore at the moment, but I'll still keep them as arrays
1108 * for a while. If in the course of testing we will be satisfied with
1109 * a current single result from awt_x11inputmethod_lookupString, we'll
1110 * change this.
1111 */
1112 jlong testbuf[2];
1113
1114 testbuf[1]=0;
1115
1116 boo = awt_x11inputmethod_lookupString((XKeyPressedEvent*)jlong_to_ptr(event)((void*)(event)), &keysym);
1117 testbuf[0] = keysym;
1118
1119 (*env)->SetLongArrayRegion(env, keysymArray, 0, 2, (jlong *)(testbuf));
1120 return boo ? JNI_TRUE1 : JNI_FALSE0;
1121}
1122
1123
1124extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
1125
1126/* syncTopLevelPos() is necessary to insure that the window manager has in
1127 * fact moved us to our final position relative to the reParented WM window.
1128 * We have noted a timing window which our shell has not been moved so we
1129 * screw up the insets thinking they are 0,0. Wait (for a limited period of
1130 * time to let the WM hava a chance to move us
1131 */
1132void syncTopLevelPos( Display *d, Window w, XWindowAttributes *winAttr ) {
1133 int32_t i = 0;
1134 do {
1135 XGetWindowAttributes( d, w, winAttr );
1136 /* Sometimes we get here before the WM has updated the
1137 ** window data struct with the correct position. Loop
1138 ** until we get a non-zero position.
1139 */
1140 if ((winAttr->x != 0) || (winAttr->y != 0)) {
1141 break;
1142 }
1143 else {
1144 /* What we really want here is to sync with the WM,
1145 ** but there's no explicit way to do this, so we
1146 ** call XSync for a delay.
1147 */
1148 XSync(d, False0);
1149 }
1150 } while (i++ < 50);
1151}
1152
1153JNIEXPORT__attribute__((visibility("default"))) void JNICALL Java_sun_awt_X11_XWindow_setSizeHints
1154(JNIEnv *env, jclass clazz, jlong window, jlong x, jlong y, jlong width, jlong height) {
1155 XSizeHints *size_hints = XAllocSizeHints();
1156 size_hints->flags = USPosition(1L << 0) | PPosition(1L << 2) | PSize(1L << 3);
1157 size_hints->x = (int)x;
1158 size_hints->y = (int)y;
1159 size_hints->width = (int)width;
1160 size_hints->height = (int)height;
1161 XSetWMNormalHints(awt_display, (Window)window, size_hints);
1162 XFree((char*)size_hints);
1163}
1164
1165
1166JNIEXPORT__attribute__((visibility("default"))) void JNICALL
1167Java_sun_awt_X11_XWindow_initIDs
1168 (JNIEnv *env, jclass clazz)
1169{
1170 char *ptr = NULL((void*)0);
1171 windowID = (*env)->GetFieldID(env, clazz, "window", "J");
1172 CHECK_NULL(windowID)do { if ((windowID) == ((void*)0)) { return; } } while (0);
1173 targetID = (*env)->GetFieldID(env, clazz, "target", "Ljava/awt/Component;");
1174 CHECK_NULL(targetID)do { if ((targetID) == ((void*)0)) { return; } } while (0);
1175 graphicsConfigID = (*env)->GetFieldID(env, clazz, "graphicsConfig", "Lsun/awt/X11GraphicsConfig;");
1176 CHECK_NULL(graphicsConfigID)do { if ((graphicsConfigID) == ((void*)0)) { return; } } while
(0)
;
1177 drawStateID = (*env)->GetFieldID(env, clazz, "drawState", "I");
1178 CHECK_NULL(drawStateID)do { if ((drawStateID) == ((void*)0)) { return; } } while (0);
1179 ptr = getenv("_AWT_USE_TYPE4_PATCH");
1180 if( ptr != NULL((void*)0) && ptr[0] != 0 ) {
1181 if( strncmp("true", ptr, 4) == 0 ) {
1182 awt_UseType4Patch = True1;
1183 }else if( strncmp("false", ptr, 5) == 0 ) {
1184 awt_UseType4Patch = False0;
1185 }
1186 }
1187}
1188
1189JNIEXPORT__attribute__((visibility("default"))) jint JNICALL
1190Java_sun_awt_X11_XWindow_getKeySymForAWTKeyCode(JNIEnv* env, jclass clazz, jint keycode) {
1191 return awt_getX11KeySym(keycode);
1192}