2
|
1 |
/*
|
|
2 |
* Copyright 2002-2006 Sun Microsystems, Inc. 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. Sun designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
* have any 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 |
#include "awt_AWTEvent.h"
|
|
50 |
|
|
51 |
#define XK_KATAKANA
|
|
52 |
#include <X11/keysym.h> /* standard X keysyms */
|
|
53 |
#include <X11/DECkeysym.h> /* DEC vendor-specific */
|
|
54 |
#include <X11/Sunkeysym.h> /* Sun vendor-specific */
|
|
55 |
#include <X11/ap_keysym.h> /* Apollo (HP) vendor-specific */
|
|
56 |
/*
|
|
57 |
* #include <X11/HPkeysym.h> HP vendor-specific
|
|
58 |
* I checked HPkeysym.h into the workspace because although
|
|
59 |
* I think it will ship with X11R6.4.2 (and later) on Linux,
|
|
60 |
* it doesn't seem to be in Solaris 9 Update 2.
|
|
61 |
*
|
|
62 |
* This is done not only for the hp keysyms, but also to
|
|
63 |
* give us the osf keysyms that are also defined in HPkeysym.h.
|
|
64 |
* However, HPkeysym.h is missing a couple of osf keysyms,
|
|
65 |
* so I have #defined them below.
|
|
66 |
*/
|
|
67 |
#include "HPkeysym.h" /* HP vendor-specific */
|
|
68 |
|
|
69 |
#include "java_awt_event_KeyEvent.h"
|
|
70 |
#include "java_awt_event_InputEvent.h"
|
|
71 |
#include "java_awt_event_MouseEvent.h"
|
|
72 |
#include "java_awt_event_MouseWheelEvent.h"
|
|
73 |
#include "java_awt_AWTEvent.h"
|
|
74 |
|
|
75 |
/*
|
|
76 |
* Two osf keys are not defined in standard keysym.h,
|
|
77 |
* /Xm/VirtKeys.h, or HPkeysym.h, so I added them below.
|
|
78 |
* I found them in /usr/openwin/lib/X11/XKeysymDB
|
|
79 |
*/
|
|
80 |
#ifndef osfXK_Prior
|
|
81 |
#define osfXK_Prior 0x1004FF55
|
|
82 |
#endif
|
|
83 |
#ifndef osfXK_Next
|
|
84 |
#define osfXK_Next 0x1004FF56
|
|
85 |
#endif
|
|
86 |
|
|
87 |
jfieldID windowID;
|
|
88 |
jfieldID drawStateID;
|
|
89 |
jfieldID targetID;
|
|
90 |
jfieldID graphicsConfigID;
|
|
91 |
|
|
92 |
extern jobject currentX11InputMethodInstance;
|
|
93 |
extern Boolean awt_x11inputmethod_lookupString(XKeyPressedEvent *, KeySym *);
|
|
94 |
Boolean awt_UseType4Patch = False;
|
|
95 |
/* how about HEADLESS */
|
|
96 |
Boolean awt_ServerDetected = False;
|
|
97 |
Boolean awt_XKBDetected = False;
|
|
98 |
Boolean awt_IsXsun = False;
|
|
99 |
Boolean awt_UseXKB = False;
|
|
100 |
|
|
101 |
typedef struct KEYMAP_ENTRY {
|
|
102 |
jint awtKey;
|
|
103 |
KeySym x11Key;
|
|
104 |
Boolean mapsToUnicodeChar;
|
|
105 |
jint keyLocation;
|
|
106 |
} KeymapEntry;
|
|
107 |
|
|
108 |
/* NB: XK_R? keysyms are for Type 4 keyboards.
|
|
109 |
* The corresponding XK_F? keysyms are for Type 5
|
|
110 |
*
|
|
111 |
* Note: this table must be kept in sorted order, since it is traversed
|
|
112 |
* according to both Java keycode and X keysym. There are a number of
|
|
113 |
* keycodes that map to more than one corresponding keysym, and we need
|
|
114 |
* to choose the right one. Unfortunately, there are some keysyms that
|
|
115 |
* can map to more than one keycode, depending on what kind of keyboard
|
|
116 |
* is in use (e.g. F11 and F12).
|
|
117 |
*/
|
|
118 |
|
|
119 |
KeymapEntry keymapTable[] =
|
|
120 |
{
|
|
121 |
{java_awt_event_KeyEvent_VK_A, XK_a, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
122 |
{java_awt_event_KeyEvent_VK_B, XK_b, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
123 |
{java_awt_event_KeyEvent_VK_C, XK_c, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
124 |
{java_awt_event_KeyEvent_VK_D, XK_d, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
125 |
{java_awt_event_KeyEvent_VK_E, XK_e, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
126 |
{java_awt_event_KeyEvent_VK_F, XK_f, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
127 |
{java_awt_event_KeyEvent_VK_G, XK_g, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
128 |
{java_awt_event_KeyEvent_VK_H, XK_h, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
129 |
{java_awt_event_KeyEvent_VK_I, XK_i, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
130 |
{java_awt_event_KeyEvent_VK_J, XK_j, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
131 |
{java_awt_event_KeyEvent_VK_K, XK_k, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
132 |
{java_awt_event_KeyEvent_VK_L, XK_l, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
133 |
{java_awt_event_KeyEvent_VK_M, XK_m, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
134 |
{java_awt_event_KeyEvent_VK_N, XK_n, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
135 |
{java_awt_event_KeyEvent_VK_O, XK_o, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
136 |
{java_awt_event_KeyEvent_VK_P, XK_p, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
137 |
{java_awt_event_KeyEvent_VK_Q, XK_q, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
138 |
{java_awt_event_KeyEvent_VK_R, XK_r, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
139 |
{java_awt_event_KeyEvent_VK_S, XK_s, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
140 |
{java_awt_event_KeyEvent_VK_T, XK_t, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
141 |
{java_awt_event_KeyEvent_VK_U, XK_u, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
142 |
{java_awt_event_KeyEvent_VK_V, XK_v, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
143 |
{java_awt_event_KeyEvent_VK_W, XK_w, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
144 |
{java_awt_event_KeyEvent_VK_X, XK_x, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
145 |
{java_awt_event_KeyEvent_VK_Y, XK_y, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
146 |
{java_awt_event_KeyEvent_VK_Z, XK_z, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
147 |
|
|
148 |
/* TTY Function keys */
|
|
149 |
{java_awt_event_KeyEvent_VK_BACK_SPACE, XK_BackSpace, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
150 |
{java_awt_event_KeyEvent_VK_TAB, XK_Tab, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
151 |
{java_awt_event_KeyEvent_VK_TAB, XK_ISO_Left_Tab, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
152 |
{java_awt_event_KeyEvent_VK_CLEAR, XK_Clear, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
153 |
{java_awt_event_KeyEvent_VK_ENTER, XK_Return, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
154 |
{java_awt_event_KeyEvent_VK_ENTER, XK_Linefeed, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
155 |
{java_awt_event_KeyEvent_VK_PAUSE, XK_Pause, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
156 |
{java_awt_event_KeyEvent_VK_PAUSE, XK_F21, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
157 |
{java_awt_event_KeyEvent_VK_PAUSE, XK_R1, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
158 |
{java_awt_event_KeyEvent_VK_SCROLL_LOCK, XK_Scroll_Lock, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
159 |
{java_awt_event_KeyEvent_VK_SCROLL_LOCK, XK_F23, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
160 |
{java_awt_event_KeyEvent_VK_SCROLL_LOCK, XK_R3, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
161 |
{java_awt_event_KeyEvent_VK_ESCAPE, XK_Escape, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
162 |
|
|
163 |
/* Other vendor-specific versions of TTY Function keys */
|
|
164 |
{java_awt_event_KeyEvent_VK_BACK_SPACE, osfXK_BackSpace, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
165 |
{java_awt_event_KeyEvent_VK_CLEAR, osfXK_Clear, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
166 |
{java_awt_event_KeyEvent_VK_ESCAPE, osfXK_Escape, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
167 |
|
|
168 |
/* Modifier keys */
|
|
169 |
{java_awt_event_KeyEvent_VK_SHIFT, XK_Shift_L, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_LEFT},
|
|
170 |
{java_awt_event_KeyEvent_VK_SHIFT, XK_Shift_R, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_RIGHT},
|
|
171 |
{java_awt_event_KeyEvent_VK_CONTROL, XK_Control_L, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_LEFT},
|
|
172 |
{java_awt_event_KeyEvent_VK_CONTROL, XK_Control_R, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_RIGHT},
|
|
173 |
{java_awt_event_KeyEvent_VK_ALT, XK_Alt_L, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_LEFT},
|
|
174 |
{java_awt_event_KeyEvent_VK_ALT, XK_Alt_R, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_RIGHT},
|
|
175 |
{java_awt_event_KeyEvent_VK_META, XK_Meta_L, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_LEFT},
|
|
176 |
{java_awt_event_KeyEvent_VK_META, XK_Meta_R, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_RIGHT},
|
|
177 |
{java_awt_event_KeyEvent_VK_CAPS_LOCK, XK_Caps_Lock, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
178 |
|
|
179 |
/* Misc Functions */
|
|
180 |
{java_awt_event_KeyEvent_VK_PRINTSCREEN, XK_Print, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
181 |
{java_awt_event_KeyEvent_VK_PRINTSCREEN, XK_F22, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
182 |
{java_awt_event_KeyEvent_VK_PRINTSCREEN, XK_R2, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
183 |
{java_awt_event_KeyEvent_VK_CANCEL, XK_Cancel, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
184 |
{java_awt_event_KeyEvent_VK_HELP, XK_Help, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
185 |
{java_awt_event_KeyEvent_VK_NUM_LOCK, XK_Num_Lock, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
186 |
|
|
187 |
/* Other vendor-specific versions of Misc Functions */
|
|
188 |
{java_awt_event_KeyEvent_VK_CANCEL, osfXK_Cancel, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
189 |
{java_awt_event_KeyEvent_VK_HELP, osfXK_Help, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
190 |
|
|
191 |
/* Rectangular Navigation Block */
|
|
192 |
{java_awt_event_KeyEvent_VK_HOME, XK_Home, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
193 |
{java_awt_event_KeyEvent_VK_HOME, XK_R7, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
194 |
{java_awt_event_KeyEvent_VK_PAGE_UP, XK_Page_Up, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
195 |
{java_awt_event_KeyEvent_VK_PAGE_UP, XK_Prior, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
196 |
{java_awt_event_KeyEvent_VK_PAGE_UP, XK_R9, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
197 |
{java_awt_event_KeyEvent_VK_PAGE_DOWN, XK_Page_Down, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
198 |
{java_awt_event_KeyEvent_VK_PAGE_DOWN, XK_Next, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
199 |
{java_awt_event_KeyEvent_VK_PAGE_DOWN, XK_R15, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
200 |
{java_awt_event_KeyEvent_VK_END, XK_End, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
201 |
{java_awt_event_KeyEvent_VK_END, XK_R13, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
202 |
{java_awt_event_KeyEvent_VK_INSERT, XK_Insert, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
203 |
{java_awt_event_KeyEvent_VK_DELETE, XK_Delete, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
204 |
|
|
205 |
/* Keypad equivalents of Rectangular Navigation Block */
|
|
206 |
{java_awt_event_KeyEvent_VK_HOME, XK_KP_Home, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
207 |
{java_awt_event_KeyEvent_VK_PAGE_UP, XK_KP_Page_Up, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
208 |
{java_awt_event_KeyEvent_VK_PAGE_UP, XK_KP_Prior, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
209 |
{java_awt_event_KeyEvent_VK_PAGE_DOWN, XK_KP_Page_Down, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
210 |
{java_awt_event_KeyEvent_VK_PAGE_DOWN, XK_KP_Next, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
211 |
{java_awt_event_KeyEvent_VK_END, XK_KP_End, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
212 |
{java_awt_event_KeyEvent_VK_INSERT, XK_KP_Insert, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
213 |
{java_awt_event_KeyEvent_VK_DELETE, XK_KP_Delete, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
214 |
|
|
215 |
/* Other vendor-specific Rectangular Navigation Block */
|
|
216 |
{java_awt_event_KeyEvent_VK_PAGE_UP, osfXK_PageUp, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
217 |
{java_awt_event_KeyEvent_VK_PAGE_UP, osfXK_Prior, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
218 |
{java_awt_event_KeyEvent_VK_PAGE_DOWN, osfXK_PageDown, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
219 |
{java_awt_event_KeyEvent_VK_PAGE_DOWN, osfXK_Next, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
220 |
{java_awt_event_KeyEvent_VK_END, osfXK_EndLine, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
221 |
{java_awt_event_KeyEvent_VK_INSERT, osfXK_Insert, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
222 |
{java_awt_event_KeyEvent_VK_DELETE, osfXK_Delete, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
223 |
|
|
224 |
/* Triangular Navigation Block */
|
|
225 |
{java_awt_event_KeyEvent_VK_LEFT, XK_Left, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
226 |
{java_awt_event_KeyEvent_VK_UP, XK_Up, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
227 |
{java_awt_event_KeyEvent_VK_RIGHT, XK_Right, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
228 |
{java_awt_event_KeyEvent_VK_DOWN, XK_Down, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
229 |
|
|
230 |
/* Keypad equivalents of Triangular Navigation Block */
|
|
231 |
{java_awt_event_KeyEvent_VK_KP_LEFT, XK_KP_Left, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
232 |
{java_awt_event_KeyEvent_VK_KP_UP, XK_KP_Up, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
233 |
{java_awt_event_KeyEvent_VK_KP_RIGHT, XK_KP_Right, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
234 |
{java_awt_event_KeyEvent_VK_KP_DOWN, XK_KP_Down, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
235 |
|
|
236 |
/* Other vendor-specific Triangular Navigation Block */
|
|
237 |
{java_awt_event_KeyEvent_VK_LEFT, osfXK_Left, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
238 |
{java_awt_event_KeyEvent_VK_UP, osfXK_Up, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
239 |
{java_awt_event_KeyEvent_VK_RIGHT, osfXK_Right, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
240 |
{java_awt_event_KeyEvent_VK_DOWN, osfXK_Down, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
241 |
|
|
242 |
/* Remaining Cursor control & motion */
|
|
243 |
{java_awt_event_KeyEvent_VK_BEGIN, XK_Begin, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
244 |
{java_awt_event_KeyEvent_VK_BEGIN, XK_KP_Begin, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
245 |
|
|
246 |
{java_awt_event_KeyEvent_VK_0, XK_0, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
247 |
{java_awt_event_KeyEvent_VK_1, XK_1, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
248 |
{java_awt_event_KeyEvent_VK_2, XK_2, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
249 |
{java_awt_event_KeyEvent_VK_3, XK_3, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
250 |
{java_awt_event_KeyEvent_VK_4, XK_4, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
251 |
{java_awt_event_KeyEvent_VK_5, XK_5, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
252 |
{java_awt_event_KeyEvent_VK_6, XK_6, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
253 |
{java_awt_event_KeyEvent_VK_7, XK_7, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
254 |
{java_awt_event_KeyEvent_VK_8, XK_8, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
255 |
{java_awt_event_KeyEvent_VK_9, XK_9, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
256 |
|
|
257 |
{java_awt_event_KeyEvent_VK_SPACE, XK_space, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
258 |
{java_awt_event_KeyEvent_VK_EXCLAMATION_MARK, XK_exclam, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
259 |
{java_awt_event_KeyEvent_VK_QUOTEDBL, XK_quotedbl, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
260 |
{java_awt_event_KeyEvent_VK_NUMBER_SIGN, XK_numbersign, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
261 |
{java_awt_event_KeyEvent_VK_DOLLAR, XK_dollar, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
262 |
{java_awt_event_KeyEvent_VK_AMPERSAND, XK_ampersand, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
263 |
{java_awt_event_KeyEvent_VK_QUOTE, XK_apostrophe, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
264 |
{java_awt_event_KeyEvent_VK_LEFT_PARENTHESIS, XK_parenleft, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
265 |
{java_awt_event_KeyEvent_VK_RIGHT_PARENTHESIS, XK_parenright, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
266 |
{java_awt_event_KeyEvent_VK_ASTERISK, XK_asterisk, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
267 |
{java_awt_event_KeyEvent_VK_PLUS, XK_plus, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
268 |
{java_awt_event_KeyEvent_VK_COMMA, XK_comma, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
269 |
{java_awt_event_KeyEvent_VK_MINUS, XK_minus, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
270 |
{java_awt_event_KeyEvent_VK_PERIOD, XK_period, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
271 |
{java_awt_event_KeyEvent_VK_SLASH, XK_slash, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
272 |
|
|
273 |
{java_awt_event_KeyEvent_VK_COLON, XK_colon, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
274 |
{java_awt_event_KeyEvent_VK_SEMICOLON, XK_semicolon, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
275 |
{java_awt_event_KeyEvent_VK_LESS, XK_less, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
276 |
{java_awt_event_KeyEvent_VK_EQUALS, XK_equal, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
277 |
{java_awt_event_KeyEvent_VK_GREATER, XK_greater, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
278 |
|
|
279 |
{java_awt_event_KeyEvent_VK_AT, XK_at, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
280 |
|
|
281 |
{java_awt_event_KeyEvent_VK_OPEN_BRACKET, XK_bracketleft, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
282 |
{java_awt_event_KeyEvent_VK_BACK_SLASH, XK_backslash, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
283 |
{java_awt_event_KeyEvent_VK_CLOSE_BRACKET, XK_bracketright, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
284 |
{java_awt_event_KeyEvent_VK_CIRCUMFLEX, XK_asciicircum, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
285 |
{java_awt_event_KeyEvent_VK_UNDERSCORE, XK_underscore, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
286 |
{java_awt_event_KeyEvent_VK_BACK_QUOTE, XK_grave, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
287 |
|
|
288 |
{java_awt_event_KeyEvent_VK_BRACELEFT, XK_braceleft, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
289 |
{java_awt_event_KeyEvent_VK_BRACERIGHT, XK_braceright, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
290 |
|
|
291 |
{java_awt_event_KeyEvent_VK_INVERTED_EXCLAMATION_MARK, XK_exclamdown, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
292 |
|
|
293 |
/* Remaining Numeric Keypad Keys */
|
|
294 |
{java_awt_event_KeyEvent_VK_NUMPAD0, XK_KP_0, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
295 |
{java_awt_event_KeyEvent_VK_NUMPAD1, XK_KP_1, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
296 |
{java_awt_event_KeyEvent_VK_NUMPAD2, XK_KP_2, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
297 |
{java_awt_event_KeyEvent_VK_NUMPAD3, XK_KP_3, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
298 |
{java_awt_event_KeyEvent_VK_NUMPAD4, XK_KP_4, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
299 |
{java_awt_event_KeyEvent_VK_NUMPAD5, XK_KP_5, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
300 |
{java_awt_event_KeyEvent_VK_NUMPAD6, XK_KP_6, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
301 |
{java_awt_event_KeyEvent_VK_NUMPAD7, XK_KP_7, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
302 |
{java_awt_event_KeyEvent_VK_NUMPAD8, XK_KP_8, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
303 |
{java_awt_event_KeyEvent_VK_NUMPAD9, XK_KP_9, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
304 |
{java_awt_event_KeyEvent_VK_SPACE, XK_KP_Space, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
305 |
{java_awt_event_KeyEvent_VK_TAB, XK_KP_Tab, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
306 |
{java_awt_event_KeyEvent_VK_ENTER, XK_KP_Enter, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
307 |
{java_awt_event_KeyEvent_VK_EQUALS, XK_KP_Equal, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
308 |
{java_awt_event_KeyEvent_VK_EQUALS, XK_R4, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
309 |
{java_awt_event_KeyEvent_VK_MULTIPLY, XK_KP_Multiply, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
310 |
{java_awt_event_KeyEvent_VK_MULTIPLY, XK_F26, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
311 |
{java_awt_event_KeyEvent_VK_MULTIPLY, XK_R6, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
312 |
{java_awt_event_KeyEvent_VK_ADD, XK_KP_Add, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
313 |
{java_awt_event_KeyEvent_VK_SEPARATOR, XK_KP_Separator, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
314 |
{java_awt_event_KeyEvent_VK_SUBTRACT, XK_KP_Subtract, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
315 |
{java_awt_event_KeyEvent_VK_SUBTRACT, XK_F24, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
316 |
{java_awt_event_KeyEvent_VK_DECIMAL, XK_KP_Decimal, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
317 |
{java_awt_event_KeyEvent_VK_DIVIDE, XK_KP_Divide, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
318 |
{java_awt_event_KeyEvent_VK_DIVIDE, XK_F25, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
319 |
{java_awt_event_KeyEvent_VK_DIVIDE, XK_R5, TRUE, java_awt_event_KeyEvent_KEY_LOCATION_NUMPAD},
|
|
320 |
|
|
321 |
/* Function Keys */
|
|
322 |
{java_awt_event_KeyEvent_VK_F1, XK_F1, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
323 |
{java_awt_event_KeyEvent_VK_F2, XK_F2, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
324 |
{java_awt_event_KeyEvent_VK_F3, XK_F3, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
325 |
{java_awt_event_KeyEvent_VK_F4, XK_F4, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
326 |
{java_awt_event_KeyEvent_VK_F5, XK_F5, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
327 |
{java_awt_event_KeyEvent_VK_F6, XK_F6, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
328 |
{java_awt_event_KeyEvent_VK_F7, XK_F7, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
329 |
{java_awt_event_KeyEvent_VK_F8, XK_F8, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
330 |
{java_awt_event_KeyEvent_VK_F9, XK_F9, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
331 |
{java_awt_event_KeyEvent_VK_F10, XK_F10, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
332 |
{java_awt_event_KeyEvent_VK_F11, XK_F11, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
333 |
{java_awt_event_KeyEvent_VK_F12, XK_F12, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
334 |
|
|
335 |
/* Sun vendor-specific version of F11 and F12 */
|
|
336 |
{java_awt_event_KeyEvent_VK_F11, SunXK_F36, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
337 |
{java_awt_event_KeyEvent_VK_F12, SunXK_F37, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
338 |
|
|
339 |
/* X11 keysym names for input method related keys don't always
|
|
340 |
* match keytop engravings or Java virtual key names, so here we
|
|
341 |
* only map constants that we've found on real keyboards.
|
|
342 |
*/
|
|
343 |
/* Type 5c Japanese keyboard: kakutei */
|
|
344 |
{java_awt_event_KeyEvent_VK_ACCEPT, XK_Execute, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
345 |
/* Type 5c Japanese keyboard: henkan */
|
|
346 |
{java_awt_event_KeyEvent_VK_CONVERT, XK_Kanji, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
347 |
/* Type 5c Japanese keyboard: nihongo */
|
|
348 |
{java_awt_event_KeyEvent_VK_INPUT_METHOD_ON_OFF, XK_Henkan_Mode, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
349 |
/* VK_KANA_LOCK is handled separately because it generates the
|
|
350 |
* same keysym as ALT_GRAPH in spite of its different behavior.
|
|
351 |
*/
|
|
352 |
|
|
353 |
{java_awt_event_KeyEvent_VK_COMPOSE, XK_Multi_key, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
354 |
{java_awt_event_KeyEvent_VK_ALT_GRAPH, XK_Mode_switch, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
355 |
|
|
356 |
/* Editing block */
|
|
357 |
{java_awt_event_KeyEvent_VK_AGAIN, XK_Redo, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
358 |
{java_awt_event_KeyEvent_VK_AGAIN, XK_L2, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
359 |
{java_awt_event_KeyEvent_VK_UNDO, XK_Undo, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
360 |
{java_awt_event_KeyEvent_VK_UNDO, XK_L4, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
361 |
{java_awt_event_KeyEvent_VK_COPY, XK_L6, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
362 |
{java_awt_event_KeyEvent_VK_PASTE, XK_L8, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
363 |
{java_awt_event_KeyEvent_VK_CUT, XK_L10, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
364 |
{java_awt_event_KeyEvent_VK_FIND, XK_Find, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
365 |
{java_awt_event_KeyEvent_VK_FIND, XK_L9, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
366 |
{java_awt_event_KeyEvent_VK_PROPS, XK_L3, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
367 |
{java_awt_event_KeyEvent_VK_STOP, XK_L1, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
368 |
|
|
369 |
/* Sun vendor-specific versions for editing block */
|
|
370 |
{java_awt_event_KeyEvent_VK_AGAIN, SunXK_Again, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
371 |
{java_awt_event_KeyEvent_VK_UNDO, SunXK_Undo, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
372 |
{java_awt_event_KeyEvent_VK_COPY, SunXK_Copy, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
373 |
{java_awt_event_KeyEvent_VK_PASTE, SunXK_Paste, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
374 |
{java_awt_event_KeyEvent_VK_CUT, SunXK_Cut, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
375 |
{java_awt_event_KeyEvent_VK_FIND, SunXK_Find, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
376 |
{java_awt_event_KeyEvent_VK_PROPS, SunXK_Props, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
377 |
{java_awt_event_KeyEvent_VK_STOP, SunXK_Stop, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
378 |
|
|
379 |
/* Apollo (HP) vendor-specific versions for editing block */
|
|
380 |
{java_awt_event_KeyEvent_VK_COPY, apXK_Copy, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
381 |
{java_awt_event_KeyEvent_VK_CUT, apXK_Cut, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
382 |
{java_awt_event_KeyEvent_VK_PASTE, apXK_Paste, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
383 |
|
|
384 |
/* Other vendor-specific versions for editing block */
|
|
385 |
{java_awt_event_KeyEvent_VK_COPY, osfXK_Copy, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
386 |
{java_awt_event_KeyEvent_VK_CUT, osfXK_Cut, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
387 |
{java_awt_event_KeyEvent_VK_PASTE, osfXK_Paste, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
388 |
{java_awt_event_KeyEvent_VK_UNDO, osfXK_Undo, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
389 |
|
|
390 |
/* Dead key mappings (for European keyboards) */
|
|
391 |
{java_awt_event_KeyEvent_VK_DEAD_GRAVE, XK_dead_grave, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
392 |
{java_awt_event_KeyEvent_VK_DEAD_ACUTE, XK_dead_acute, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
393 |
{java_awt_event_KeyEvent_VK_DEAD_CIRCUMFLEX, XK_dead_circumflex, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
394 |
{java_awt_event_KeyEvent_VK_DEAD_TILDE, XK_dead_tilde, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
395 |
{java_awt_event_KeyEvent_VK_DEAD_MACRON, XK_dead_macron, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
396 |
{java_awt_event_KeyEvent_VK_DEAD_BREVE, XK_dead_breve, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
397 |
{java_awt_event_KeyEvent_VK_DEAD_ABOVEDOT, XK_dead_abovedot, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
398 |
{java_awt_event_KeyEvent_VK_DEAD_DIAERESIS, XK_dead_diaeresis, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
399 |
{java_awt_event_KeyEvent_VK_DEAD_ABOVERING, XK_dead_abovering, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
400 |
{java_awt_event_KeyEvent_VK_DEAD_DOUBLEACUTE, XK_dead_doubleacute, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
401 |
{java_awt_event_KeyEvent_VK_DEAD_CARON, XK_dead_caron, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
402 |
{java_awt_event_KeyEvent_VK_DEAD_CEDILLA, XK_dead_cedilla, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
403 |
{java_awt_event_KeyEvent_VK_DEAD_OGONEK, XK_dead_ogonek, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
404 |
{java_awt_event_KeyEvent_VK_DEAD_IOTA, XK_dead_iota, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
405 |
{java_awt_event_KeyEvent_VK_DEAD_VOICED_SOUND, XK_dead_voiced_sound, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
406 |
{java_awt_event_KeyEvent_VK_DEAD_SEMIVOICED_SOUND, XK_dead_semivoiced_sound, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
407 |
|
|
408 |
/* Sun vendor-specific dead key mappings (for European keyboards) */
|
|
409 |
{java_awt_event_KeyEvent_VK_DEAD_GRAVE, SunXK_FA_Grave, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
410 |
{java_awt_event_KeyEvent_VK_DEAD_CIRCUMFLEX, SunXK_FA_Circum, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
411 |
{java_awt_event_KeyEvent_VK_DEAD_TILDE, SunXK_FA_Tilde, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
412 |
{java_awt_event_KeyEvent_VK_DEAD_ACUTE, SunXK_FA_Acute, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
413 |
{java_awt_event_KeyEvent_VK_DEAD_DIAERESIS, SunXK_FA_Diaeresis, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
414 |
{java_awt_event_KeyEvent_VK_DEAD_CEDILLA, SunXK_FA_Cedilla, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
415 |
|
|
416 |
/* DEC vendor-specific dead key mappings (for European keyboards) */
|
|
417 |
{java_awt_event_KeyEvent_VK_DEAD_ABOVERING, DXK_ring_accent, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
418 |
{java_awt_event_KeyEvent_VK_DEAD_CIRCUMFLEX, DXK_circumflex_accent, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
419 |
{java_awt_event_KeyEvent_VK_DEAD_CEDILLA, DXK_cedilla_accent, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
420 |
{java_awt_event_KeyEvent_VK_DEAD_ACUTE, DXK_acute_accent, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
421 |
{java_awt_event_KeyEvent_VK_DEAD_GRAVE, DXK_grave_accent, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
422 |
{java_awt_event_KeyEvent_VK_DEAD_TILDE, DXK_tilde, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
423 |
{java_awt_event_KeyEvent_VK_DEAD_DIAERESIS, DXK_diaeresis, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
424 |
|
|
425 |
/* Other vendor-specific dead key mappings (for European keyboards) */
|
|
426 |
{java_awt_event_KeyEvent_VK_DEAD_ACUTE, hpXK_mute_acute, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
427 |
{java_awt_event_KeyEvent_VK_DEAD_GRAVE, hpXK_mute_grave, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
428 |
{java_awt_event_KeyEvent_VK_DEAD_CIRCUMFLEX, hpXK_mute_asciicircum, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
429 |
{java_awt_event_KeyEvent_VK_DEAD_DIAERESIS, hpXK_mute_diaeresis, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
430 |
{java_awt_event_KeyEvent_VK_DEAD_TILDE, hpXK_mute_asciitilde, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
|
|
431 |
|
|
432 |
{java_awt_event_KeyEvent_VK_UNDEFINED, NoSymbol, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN}
|
|
433 |
};
|
|
434 |
|
|
435 |
static Boolean
|
|
436 |
keyboardHasKanaLockKey()
|
|
437 |
{
|
|
438 |
static Boolean haveResult = FALSE;
|
|
439 |
static Boolean result = FALSE;
|
|
440 |
|
|
441 |
int32_t minKeyCode, maxKeyCode, keySymsPerKeyCode;
|
|
442 |
KeySym *keySyms, *keySymsStart, keySym;
|
|
443 |
int32_t i;
|
|
444 |
int32_t kanaCount = 0;
|
|
445 |
|
|
446 |
// Solaris doesn't let you swap keyboards without rebooting,
|
|
447 |
// so there's no need to check for the kana lock key more than once.
|
|
448 |
if (haveResult) {
|
|
449 |
return result;
|
|
450 |
}
|
|
451 |
|
|
452 |
// There's no direct way to determine whether the keyboard has
|
|
453 |
// a kana lock key. From available keyboard mapping tables, it looks
|
|
454 |
// like only keyboards with the kana lock key can produce keysyms
|
|
455 |
// for kana characters. So, as an indirect test, we check for those.
|
|
456 |
XDisplayKeycodes(awt_display, &minKeyCode, &maxKeyCode);
|
|
457 |
keySyms = XGetKeyboardMapping(awt_display, minKeyCode, maxKeyCode - minKeyCode + 1, &keySymsPerKeyCode);
|
|
458 |
keySymsStart = keySyms;
|
|
459 |
for (i = 0; i < (maxKeyCode - minKeyCode + 1) * keySymsPerKeyCode; i++) {
|
|
460 |
keySym = *keySyms++;
|
|
461 |
if ((keySym & 0xff00) == 0x0400) {
|
|
462 |
kanaCount++;
|
|
463 |
}
|
|
464 |
}
|
|
465 |
XFree(keySymsStart);
|
|
466 |
|
|
467 |
// use a (somewhat arbitrary) minimum so we don't get confused by a stray function key
|
|
468 |
result = kanaCount > 10;
|
|
469 |
haveResult = TRUE;
|
|
470 |
return result;
|
|
471 |
}
|
|
472 |
|
|
473 |
static void
|
|
474 |
keysymToAWTKeyCode(KeySym x11Key, jint *keycode, Boolean *mapsToUnicodeChar,
|
|
475 |
jint *keyLocation)
|
|
476 |
{
|
|
477 |
int32_t i;
|
|
478 |
|
|
479 |
// Solaris uses XK_Mode_switch for both the non-locking AltGraph
|
|
480 |
// and the locking Kana key, but we want to keep them separate for
|
|
481 |
// KeyEvent.
|
|
482 |
if (x11Key == XK_Mode_switch && keyboardHasKanaLockKey()) {
|
|
483 |
*keycode = java_awt_event_KeyEvent_VK_KANA_LOCK;
|
|
484 |
*mapsToUnicodeChar = FALSE;
|
|
485 |
*keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN;
|
|
486 |
return;
|
|
487 |
}
|
|
488 |
|
|
489 |
for (i = 0;
|
|
490 |
keymapTable[i].awtKey != java_awt_event_KeyEvent_VK_UNDEFINED;
|
|
491 |
i++)
|
|
492 |
{
|
|
493 |
if (keymapTable[i].x11Key == x11Key) {
|
|
494 |
*keycode = keymapTable[i].awtKey;
|
|
495 |
*mapsToUnicodeChar = keymapTable[i].mapsToUnicodeChar;
|
|
496 |
*keyLocation = keymapTable[i].keyLocation;
|
|
497 |
return;
|
|
498 |
}
|
|
499 |
}
|
|
500 |
|
|
501 |
*keycode = java_awt_event_KeyEvent_VK_UNDEFINED;
|
|
502 |
*mapsToUnicodeChar = FALSE;
|
|
503 |
*keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN;
|
|
504 |
|
|
505 |
DTRACE_PRINTLN1("keysymToAWTKeyCode: no key mapping found: keysym = 0x%x", x11Key);
|
|
506 |
}
|
|
507 |
|
|
508 |
KeySym
|
|
509 |
awt_getX11KeySym(jint awtKey)
|
|
510 |
{
|
|
511 |
int32_t i;
|
|
512 |
|
|
513 |
if (awtKey == java_awt_event_KeyEvent_VK_KANA_LOCK && keyboardHasKanaLockKey()) {
|
|
514 |
return XK_Mode_switch;
|
|
515 |
}
|
|
516 |
|
|
517 |
for (i = 0; keymapTable[i].awtKey != 0; i++) {
|
|
518 |
if (keymapTable[i].awtKey == awtKey) {
|
|
519 |
return keymapTable[i].x11Key;
|
|
520 |
}
|
|
521 |
}
|
|
522 |
|
|
523 |
DTRACE_PRINTLN1("awt_getX11KeySym: no key mapping found: awtKey = 0x%x", awtKey);
|
|
524 |
return NoSymbol;
|
|
525 |
}
|
|
526 |
|
|
527 |
/* Called from handleKeyEvent. The purpose of this function is
|
|
528 |
* to check for a list of vendor-specific keysyms, most of which
|
|
529 |
* have values greater than 0xFFFF. Most of these keys don't map
|
|
530 |
* to unicode characters, but some do.
|
|
531 |
*
|
|
532 |
* For keys that don't map to unicode characters, the keysym
|
|
533 |
* is irrelevant at this point. We set the keysym to zero
|
|
534 |
* to ensure that the switch statement immediately below
|
|
535 |
* this function call (in adjustKeySym) won't incorrectly act
|
|
536 |
* on them after the high bits are stripped off.
|
|
537 |
*
|
|
538 |
* For keys that do map to unicode characters, we change the keysym
|
|
539 |
* to the equivalent that is < 0xFFFF
|
|
540 |
*/
|
|
541 |
static void
|
|
542 |
handleVendorKeySyms(XEvent *event, KeySym *keysym)
|
|
543 |
{
|
|
544 |
KeySym originalKeysym = *keysym;
|
|
545 |
|
|
546 |
switch (*keysym) {
|
|
547 |
/* Apollo (HP) vendor-specific from <X11/ap_keysym.h> */
|
|
548 |
case apXK_Copy:
|
|
549 |
case apXK_Cut:
|
|
550 |
case apXK_Paste:
|
|
551 |
/* DEC vendor-specific from <X11/DECkeysym.h> */
|
|
552 |
case DXK_ring_accent: /* syn usldead_ring */
|
|
553 |
case DXK_circumflex_accent:
|
|
554 |
case DXK_cedilla_accent: /* syn usldead_cedilla */
|
|
555 |
case DXK_acute_accent:
|
|
556 |
case DXK_grave_accent:
|
|
557 |
case DXK_tilde:
|
|
558 |
case DXK_diaeresis:
|
|
559 |
/* Sun vendor-specific from <X11/Sunkeysym.h> */
|
|
560 |
case SunXK_FA_Grave:
|
|
561 |
case SunXK_FA_Circum:
|
|
562 |
case SunXK_FA_Tilde:
|
|
563 |
case SunXK_FA_Acute:
|
|
564 |
case SunXK_FA_Diaeresis:
|
|
565 |
case SunXK_FA_Cedilla:
|
|
566 |
case SunXK_F36: /* Labeled F11 */
|
|
567 |
case SunXK_F37: /* Labeled F12 */
|
|
568 |
case SunXK_Props:
|
|
569 |
case SunXK_Copy:
|
|
570 |
case SunXK_Open:
|
|
571 |
case SunXK_Paste:
|
|
572 |
case SunXK_Cut:
|
|
573 |
/* Other vendor-specific from HPkeysym.h */
|
|
574 |
case hpXK_mute_acute: /* syn usldead_acute */
|
|
575 |
case hpXK_mute_grave: /* syn usldead_grave */
|
|
576 |
case hpXK_mute_asciicircum: /* syn usldead_asciicircum */
|
|
577 |
case hpXK_mute_diaeresis: /* syn usldead_diaeresis */
|
|
578 |
case hpXK_mute_asciitilde: /* syn usldead_asciitilde */
|
|
579 |
case osfXK_Copy:
|
|
580 |
case osfXK_Cut:
|
|
581 |
case osfXK_Paste:
|
|
582 |
case osfXK_PageUp:
|
|
583 |
case osfXK_PageDown:
|
|
584 |
case osfXK_EndLine:
|
|
585 |
case osfXK_Clear:
|
|
586 |
case osfXK_Left:
|
|
587 |
case osfXK_Up:
|
|
588 |
case osfXK_Right:
|
|
589 |
case osfXK_Down:
|
|
590 |
case osfXK_Prior:
|
|
591 |
case osfXK_Next:
|
|
592 |
case osfXK_Insert:
|
|
593 |
case osfXK_Undo:
|
|
594 |
case osfXK_Help:
|
|
595 |
*keysym = 0;
|
|
596 |
break;
|
|
597 |
/*
|
|
598 |
* The rest DO map to unicode characters, so translate them
|
|
599 |
*/
|
|
600 |
case osfXK_BackSpace:
|
|
601 |
*keysym = XK_BackSpace;
|
|
602 |
break;
|
|
603 |
case osfXK_Escape:
|
|
604 |
*keysym = XK_Escape;
|
|
605 |
break;
|
|
606 |
case osfXK_Cancel:
|
|
607 |
*keysym = XK_Cancel;
|
|
608 |
break;
|
|
609 |
case osfXK_Delete:
|
|
610 |
*keysym = XK_Delete;
|
|
611 |
break;
|
|
612 |
default:
|
|
613 |
break;
|
|
614 |
}
|
|
615 |
|
|
616 |
if (originalKeysym != *keysym) {
|
|
617 |
DTRACE_PRINTLN3("%s originalKeysym=0x%x, keysym=0x%x",
|
|
618 |
"In handleVendorKeySyms:", originalKeysym, *keysym);
|
|
619 |
}
|
|
620 |
}
|
|
621 |
|
|
622 |
/* Called from handleKeyEvent.
|
|
623 |
* The purpose of this function is to adjust the keysym and XEvent
|
|
624 |
* keycode for a key event. This is basically a conglomeration of
|
|
625 |
* bugfixes that require these adjustments.
|
|
626 |
* Note that none of the keysyms in this function are less than 256.
|
|
627 |
*/
|
|
628 |
static void
|
|
629 |
adjustKeySym(XEvent *event, KeySym *keysym)
|
|
630 |
{
|
|
631 |
KeySym originalKeysym = *keysym;
|
|
632 |
KeyCode originalKeycode = event->xkey.keycode;
|
|
633 |
|
|
634 |
/* We have seen bits set in the high two bytes on Linux,
|
|
635 |
* which prevents this switch statement from executing
|
|
636 |
* correctly. Strip off the high order bits.
|
|
637 |
*/
|
|
638 |
*keysym &= 0x0000FFFF;
|
|
639 |
|
|
640 |
switch (*keysym) {
|
|
641 |
case XK_ISO_Left_Tab: /* shift-tab on Linux */
|
|
642 |
*keysym = XK_Tab;
|
|
643 |
break;
|
|
644 |
case XK_KP_Decimal:
|
|
645 |
*keysym = '.';
|
|
646 |
break;
|
|
647 |
case XK_KP_Add:
|
|
648 |
*keysym = '+';
|
|
649 |
break;
|
|
650 |
case XK_F24: /* NumLock off */
|
|
651 |
case XK_KP_Subtract: /* NumLock on */
|
|
652 |
*keysym = '-';
|
|
653 |
break;
|
|
654 |
case XK_F25: /* NumLock off */
|
|
655 |
case XK_KP_Divide: /* NumLock on */
|
|
656 |
*keysym = '/';
|
|
657 |
break;
|
|
658 |
case XK_F26: /* NumLock off */
|
|
659 |
case XK_KP_Multiply: /* NumLock on */
|
|
660 |
*keysym = '*';
|
|
661 |
break;
|
|
662 |
case XK_KP_Equal:
|
|
663 |
*keysym = '=';
|
|
664 |
break;
|
|
665 |
case XK_KP_0:
|
|
666 |
*keysym = '0';
|
|
667 |
break;
|
|
668 |
case XK_KP_1:
|
|
669 |
*keysym = '1';
|
|
670 |
break;
|
|
671 |
case XK_KP_2:
|
|
672 |
*keysym = '2';
|
|
673 |
break;
|
|
674 |
case XK_KP_3:
|
|
675 |
*keysym = '3';
|
|
676 |
break;
|
|
677 |
case XK_KP_4:
|
|
678 |
*keysym = '4';
|
|
679 |
break;
|
|
680 |
case XK_KP_5:
|
|
681 |
*keysym = '5';
|
|
682 |
break;
|
|
683 |
case XK_KP_6:
|
|
684 |
*keysym = '6';
|
|
685 |
break;
|
|
686 |
case XK_KP_7:
|
|
687 |
*keysym = '7';
|
|
688 |
break;
|
|
689 |
case XK_KP_8:
|
|
690 |
*keysym = '8';
|
|
691 |
break;
|
|
692 |
case XK_KP_9:
|
|
693 |
*keysym = '9';
|
|
694 |
break;
|
|
695 |
case XK_KP_Left: /* Bug 4350175 */
|
|
696 |
*keysym = XK_Left;
|
|
697 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
698 |
break;
|
|
699 |
case XK_KP_Up:
|
|
700 |
*keysym = XK_Up;
|
|
701 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
702 |
break;
|
|
703 |
case XK_KP_Right:
|
|
704 |
*keysym = XK_Right;
|
|
705 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
706 |
break;
|
|
707 |
case XK_KP_Down:
|
|
708 |
*keysym = XK_Down;
|
|
709 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
710 |
break;
|
|
711 |
case XK_KP_Home:
|
|
712 |
*keysym = XK_Home;
|
|
713 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
714 |
break;
|
|
715 |
case XK_KP_End:
|
|
716 |
*keysym = XK_End;
|
|
717 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
718 |
break;
|
|
719 |
case XK_KP_Page_Up:
|
|
720 |
*keysym = XK_Page_Up;
|
|
721 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
722 |
break;
|
|
723 |
case XK_KP_Page_Down:
|
|
724 |
*keysym = XK_Page_Down;
|
|
725 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
726 |
break;
|
|
727 |
case XK_KP_Begin:
|
|
728 |
*keysym = XK_Begin;
|
|
729 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
730 |
break;
|
|
731 |
case XK_KP_Insert:
|
|
732 |
*keysym = XK_Insert;
|
|
733 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
734 |
break;
|
|
735 |
case XK_KP_Delete:
|
|
736 |
*keysym = XK_Delete;
|
|
737 |
event->xkey.keycode = XKeysymToKeycode(awt_display, *keysym);
|
|
738 |
break;
|
|
739 |
case XK_KP_Enter:
|
|
740 |
*keysym = XK_Linefeed;
|
|
741 |
event->xkey.keycode = XKeysymToKeycode(awt_display, XK_Return);
|
|
742 |
break;
|
|
743 |
default:
|
|
744 |
break;
|
|
745 |
}
|
|
746 |
|
|
747 |
if (originalKeysym != *keysym) {
|
|
748 |
DTRACE_PRINTLN2("In adjustKeySym: originalKeysym=0x%x, keysym=0x%x",
|
|
749 |
originalKeysym, *keysym);
|
|
750 |
}
|
|
751 |
if (originalKeycode != event->xkey.keycode) {
|
|
752 |
DTRACE_PRINTLN2("In adjustKeySym: originalKeycode=0x%x, keycode=0x%x",
|
|
753 |
originalKeycode, event->xkey.keycode);
|
|
754 |
}
|
|
755 |
}
|
|
756 |
|
|
757 |
/*
|
|
758 |
* What a sniffer sez?
|
|
759 |
* Xsun and Xorg if NumLock is on do two thing different:
|
|
760 |
* keep Keypad key in different places of keysyms array and
|
|
761 |
* ignore/obey "ModLock is ShiftLock", so we should choose.
|
|
762 |
* People say, it's right to use behavior and not Vendor tags to decide.
|
|
763 |
* Maybe. But why these tags were invented, then?
|
|
764 |
* TODO: use behavior, not tags. Maybe.
|
|
765 |
*/
|
|
766 |
static Boolean
|
|
767 |
isXsunServer(XEvent *event) {
|
|
768 |
if( awt_ServerDetected ) return awt_IsXsun;
|
|
769 |
if( strncmp( ServerVendor( event->xkey.display ), "Sun Microsystems, Inc.", 32) ) {
|
|
770 |
awt_ServerDetected = True;
|
|
771 |
awt_IsXsun = False;
|
|
772 |
return False;
|
|
773 |
}
|
|
774 |
// Now, it's Sun. It still may be Xorg though, eg on Solaris 10, x86.
|
|
775 |
// Today (2005), VendorRelease of Xorg is a Big Number unlike Xsun.
|
|
776 |
if( VendorRelease( event->xkey.display ) > 10000 ) {
|
|
777 |
awt_ServerDetected = True;
|
|
778 |
awt_IsXsun = False;
|
|
779 |
return False;
|
|
780 |
}
|
|
781 |
awt_ServerDetected = True;
|
|
782 |
awt_IsXsun = True;
|
|
783 |
return True;
|
|
784 |
}
|
|
785 |
/*
|
|
786 |
* +kb or -kb ?
|
|
787 |
*/
|
|
788 |
static Boolean
|
|
789 |
isXKBenabled(Display *display) {
|
|
790 |
int mop, beve, berr;
|
|
791 |
if( !awt_XKBDetected ) {
|
|
792 |
/*
|
|
793 |
* NB: TODO: hope it will return False if XkbIgnoreExtension was called!
|
|
794 |
*/
|
|
795 |
awt_UseXKB = XQueryExtension(display, "XKEYBOARD", &mop, &beve, &berr);
|
|
796 |
awt_XKBDetected = True;
|
|
797 |
}
|
|
798 |
return awt_UseXKB;
|
|
799 |
}
|
|
800 |
static Boolean
|
|
801 |
isKPevent(XEvent *event)
|
|
802 |
{
|
|
803 |
/*
|
|
804 |
* Xlib manual, ch 12.7 says, as a first rule for choice of keysym:
|
|
805 |
* The numlock modifier is on and the second KeySym is a keypad KeySym. In this case,
|
|
806 |
* if the Shift modifier is on, or if the Lock modifier is on and is interpreted as ShiftLock,
|
|
807 |
* then the first KeySym is used, otherwise the second KeySym is used.
|
|
808 |
*
|
|
809 |
* However, Xsun server does ignore ShiftLock and always takes 3-rd element from an array.
|
|
810 |
*
|
|
811 |
* So, is it a keypad keysym?
|
|
812 |
*/
|
|
813 |
Boolean bsun = isXsunServer( event );
|
|
814 |
Boolean bxkb = isXKBenabled( event->xkey.display );
|
|
815 |
return IsKeypadKey( XKeycodeToKeysym(event->xkey.display, event->xkey.keycode,(bsun && !bxkb ? 2 : 1) ) );
|
|
816 |
}
|
|
817 |
static void
|
|
818 |
dumpKeysymArray(XEvent *event) {
|
|
819 |
printf(" 0x%X\n",XKeycodeToKeysym(event->xkey.display, event->xkey.keycode, 0));
|
|
820 |
printf(" 0x%X\n",XKeycodeToKeysym(event->xkey.display, event->xkey.keycode, 1));
|
|
821 |
printf(" 0x%X\n",XKeycodeToKeysym(event->xkey.display, event->xkey.keycode, 2));
|
|
822 |
printf(" 0x%X\n",XKeycodeToKeysym(event->xkey.display, event->xkey.keycode, 3));
|
|
823 |
}
|
|
824 |
/*
|
|
825 |
* In a next redesign, get rid of this code altogether.
|
|
826 |
*
|
|
827 |
*/
|
|
828 |
static void
|
|
829 |
handleKeyEventWithNumLockMask_New(XEvent *event, KeySym *keysym)
|
|
830 |
{
|
|
831 |
KeySym originalKeysym = *keysym;
|
|
832 |
if( !isKPevent( event ) ) {
|
|
833 |
return;
|
|
834 |
}
|
|
835 |
if( isXsunServer( event ) && !awt_UseXKB) {
|
|
836 |
if( (event->xkey.state & ShiftMask) ) { // shift modifier is on
|
|
837 |
*keysym = XKeycodeToKeysym(event->xkey.display,
|
|
838 |
event->xkey.keycode, 3);
|
|
839 |
}else {
|
|
840 |
*keysym = XKeycodeToKeysym(event->xkey.display,
|
|
841 |
event->xkey.keycode, 2);
|
|
842 |
}
|
|
843 |
} else {
|
|
844 |
if( (event->xkey.state & ShiftMask) || // shift modifier is on
|
|
845 |
((event->xkey.state & LockMask) && // lock modifier is on
|
|
846 |
(awt_ModLockIsShiftLock)) ) { // it is interpreted as ShiftLock
|
|
847 |
*keysym = XKeycodeToKeysym(event->xkey.display,
|
|
848 |
event->xkey.keycode, 0);
|
|
849 |
}else{
|
|
850 |
*keysym = XKeycodeToKeysym(event->xkey.display,
|
|
851 |
event->xkey.keycode, 1);
|
|
852 |
}
|
|
853 |
}
|
|
854 |
}
|
|
855 |
|
|
856 |
/* Called from handleKeyEvent.
|
|
857 |
* The purpose of this function is to make some adjustments to keysyms
|
|
858 |
* that have been found to be necessary when the NumLock mask is set.
|
|
859 |
* They come from various bug fixes and rearchitectures.
|
|
860 |
* This function is meant to be called when
|
|
861 |
* (event->xkey.state & awt_NumLockMask) is TRUE.
|
|
862 |
*/
|
|
863 |
static void
|
|
864 |
handleKeyEventWithNumLockMask(XEvent *event, KeySym *keysym)
|
|
865 |
{
|
|
866 |
KeySym originalKeysym = *keysym;
|
|
867 |
|
|
868 |
#ifndef __linux__
|
|
869 |
/* The following code on Linux will cause the keypad keys
|
|
870 |
* not to echo on JTextField when the NumLock is on. The
|
|
871 |
* keysyms will be 0, because the last parameter 2 is not defined.
|
|
872 |
* See Xlib Programming Manual, O'Reilly & Associates, Section
|
|
873 |
* 9.1.5 "Other Keyboard-handling Routines", "The meaning of
|
|
874 |
* the keysym list beyond the first two (unmodified, Shift or
|
|
875 |
* Shift Lock) is not defined."
|
|
876 |
*/
|
|
877 |
|
|
878 |
/* Translate again with NumLock as modifier. */
|
|
879 |
/* ECH - I wonder why we think that NumLock corresponds to 2?
|
|
880 |
On Linux, we've seen xmodmap -pm yield mod2 as NumLock,
|
|
881 |
but I don't know that it will be for every configuration.
|
|
882 |
Perhaps using the index (modn in awt_MToolkit.c:setup_modifier_map)
|
|
883 |
would be more correct.
|
|
884 |
*/
|
|
885 |
*keysym = XKeycodeToKeysym(event->xkey.display,
|
|
886 |
event->xkey.keycode, 2);
|
|
887 |
if (originalKeysym != *keysym) {
|
|
888 |
DTRACE_PRINTLN3("%s originalKeysym=0x%x, keysym=0x%x",
|
|
889 |
"In handleKeyEventWithNumLockMask ifndef linux:",
|
|
890 |
originalKeysym, *keysym);
|
|
891 |
}
|
|
892 |
#endif
|
|
893 |
|
|
894 |
/* Note: the XK_R? key assignments are for Type 4 kbds */
|
|
895 |
switch (*keysym) {
|
|
896 |
case XK_R13:
|
|
897 |
*keysym = XK_KP_1;
|
|
898 |
break;
|
|
899 |
case XK_R14:
|
|
900 |
*keysym = XK_KP_2;
|
|
901 |
break;
|
|
902 |
case XK_R15:
|
|
903 |
*keysym = XK_KP_3;
|
|
904 |
break;
|
|
905 |
case XK_R10:
|
|
906 |
*keysym = XK_KP_4;
|
|
907 |
break;
|
|
908 |
case XK_R11:
|
|
909 |
*keysym = XK_KP_5;
|
|
910 |
break;
|
|
911 |
case XK_R12:
|
|
912 |
*keysym = XK_KP_6;
|
|
913 |
break;
|
|
914 |
case XK_R7:
|
|
915 |
*keysym = XK_KP_7;
|
|
916 |
break;
|
|
917 |
case XK_R8:
|
|
918 |
*keysym = XK_KP_8;
|
|
919 |
break;
|
|
920 |
case XK_R9:
|
|
921 |
*keysym = XK_KP_9;
|
|
922 |
break;
|
|
923 |
case XK_KP_Insert:
|
|
924 |
*keysym = XK_KP_0;
|
|
925 |
break;
|
|
926 |
case XK_KP_Delete:
|
|
927 |
*keysym = XK_KP_Decimal;
|
|
928 |
break;
|
|
929 |
case XK_R4:
|
|
930 |
*keysym = XK_KP_Equal; /* Type 4 kbd */
|
|
931 |
break;
|
|
932 |
case XK_R5:
|
|
933 |
*keysym = XK_KP_Divide;
|
|
934 |
break;
|
|
935 |
case XK_R6:
|
|
936 |
*keysym = XK_KP_Multiply;
|
|
937 |
break;
|
|
938 |
/*
|
|
939 |
* Need the following keysym changes for Linux key releases.
|
|
940 |
* Sometimes the modifier state gets messed up, so we get a
|
|
941 |
* KP_Left when we should get a KP_4, for example.
|
|
942 |
* XK_KP_Insert and XK_KP_Delete were already handled above.
|
|
943 |
*/
|
|
944 |
case XK_KP_Left:
|
|
945 |
*keysym = XK_KP_4;
|
|
946 |
break;
|
|
947 |
case XK_KP_Up:
|
|
948 |
*keysym = XK_KP_8;
|
|
949 |
break;
|
|
950 |
case XK_KP_Right:
|
|
951 |
*keysym = XK_KP_6;
|
|
952 |
break;
|
|
953 |
case XK_KP_Down:
|
|
954 |
*keysym = XK_KP_2;
|
|
955 |
break;
|
|
956 |
case XK_KP_Home:
|
|
957 |
*keysym = XK_KP_7;
|
|
958 |
break;
|
|
959 |
case XK_KP_End:
|
|
960 |
*keysym = XK_KP_1;
|
|
961 |
break;
|
|
962 |
case XK_KP_Page_Up:
|
|
963 |
*keysym = XK_KP_9;
|
|
964 |
break;
|
|
965 |
case XK_KP_Page_Down:
|
|
966 |
*keysym = XK_KP_3;
|
|
967 |
break;
|
|
968 |
case XK_KP_Begin:
|
|
969 |
*keysym = XK_KP_5;
|
|
970 |
break;
|
|
971 |
default:
|
|
972 |
break;
|
|
973 |
}
|
|
974 |
|
|
975 |
if (originalKeysym != *keysym) {
|
|
976 |
DTRACE_PRINTLN3("%s originalKeysym=0x%x, keysym=0x%x",
|
|
977 |
"In handleKeyEventWithNumLockMask:", originalKeysym, *keysym);
|
|
978 |
}
|
|
979 |
}
|
|
980 |
|
|
981 |
|
|
982 |
/* This function is called as the keyChar parameter of a call to
|
|
983 |
* awt_post_java_key_event. It depends on being called after adjustKeySym.
|
|
984 |
*
|
|
985 |
* This function just handles a few values where we know that the
|
|
986 |
* keysym is not the same as the unicode value. For values that
|
|
987 |
* we don't handle explicitly, we just cast the keysym to a jchar.
|
|
988 |
* Most of the real mapping work that gets the correct keysym is handled
|
|
989 |
* in the mapping table, adjustKeySym, etc.
|
|
990 |
*
|
|
991 |
* XXX
|
|
992 |
* Maybe we should enumerate the keysyms for which we have a mapping
|
|
993 |
* in the keyMap, but that don't map to unicode chars, and return
|
|
994 |
* CHAR_UNDEFINED? Then use the buffer value from XLookupString
|
|
995 |
* instead of the keysym as the keychar when posting. Then we don't
|
|
996 |
* need to test using mapsToUnicodeChar. That way, we would post keyTyped
|
|
997 |
* for all the chars that generate unicode chars, including LATIN2-4, etc.
|
|
998 |
* Note: what does the buffer from XLookupString contain when
|
|
999 |
* the character is a non-printable unicode character like Cancel or Delete?
|
|
1000 |
*/
|
|
1001 |
jchar
|
|
1002 |
keySymToUnicodeCharacter(KeySym keysym) {
|
|
1003 |
jchar unicodeValue = (jchar) keysym;
|
|
1004 |
|
|
1005 |
switch (keysym) {
|
|
1006 |
case XK_BackSpace:
|
|
1007 |
case XK_Tab:
|
|
1008 |
case XK_Linefeed:
|
|
1009 |
case XK_Escape:
|
|
1010 |
case XK_Delete:
|
|
1011 |
/* Strip off highorder bits defined in xkeysymdef.h
|
|
1012 |
* I think doing this converts them to values that
|
|
1013 |
* we can cast to jchars and use as java keychars.
|
|
1014 |
*/
|
|
1015 |
unicodeValue = (jchar) (keysym & 0x007F);
|
|
1016 |
break;
|
|
1017 |
case XK_Return:
|
|
1018 |
unicodeValue = (jchar) 0x000a; /* the unicode char for Linefeed */
|
|
1019 |
break;
|
|
1020 |
case XK_Cancel:
|
|
1021 |
unicodeValue = (jchar) 0x0018; /* the unicode char for Cancel */
|
|
1022 |
break;
|
|
1023 |
default:
|
|
1024 |
break;
|
|
1025 |
}
|
|
1026 |
|
|
1027 |
if (unicodeValue != (jchar)keysym) {
|
|
1028 |
DTRACE_PRINTLN3("%s originalKeysym=0x%x, keysym=0x%x",
|
|
1029 |
"In keysymToUnicode:", keysym, unicodeValue);
|
|
1030 |
}
|
|
1031 |
|
|
1032 |
return unicodeValue;
|
|
1033 |
}
|
|
1034 |
|
|
1035 |
|
|
1036 |
void
|
|
1037 |
awt_post_java_key_event(JNIEnv *env, jobject peer, jint id,
|
|
1038 |
jlong when, jint keyCode, jchar keyChar, jint keyLocation, jint state, XEvent * event)
|
|
1039 |
{
|
|
1040 |
JNU_CallMethodByName(env, NULL, peer, "postKeyEvent", "(IJICIIJI)V", id,
|
|
1041 |
when, keyCode, keyChar, keyLocation, state, ptr_to_jlong(event), (jint)sizeof(XEvent));
|
|
1042 |
} /* awt_post_java_key_event() */
|
|
1043 |
|
|
1044 |
|
|
1045 |
|
|
1046 |
JNIEXPORT jint JNICALL
|
|
1047 |
Java_sun_awt_X11_XWindow_getAWTKeyCodeForKeySym(JNIEnv *env, jclass clazz, jint keysym) {
|
|
1048 |
jint keycode = java_awt_event_KeyEvent_VK_UNDEFINED;
|
|
1049 |
Boolean mapsToUnicodeChar;
|
|
1050 |
jint keyLocation;
|
|
1051 |
keysymToAWTKeyCode(keysym, &keycode, &mapsToUnicodeChar, &keyLocation);
|
|
1052 |
return keycode;
|
|
1053 |
}
|
|
1054 |
|
|
1055 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XWindow_haveCurrentX11InputMethodInstance
|
|
1056 |
(JNIEnv *env, jobject object) {
|
|
1057 |
/*printf("Java_sun_awt_X11_XWindow_haveCurrentX11InputMethodInstance: %s\n", (currentX11InputMethodInstance==NULL? "NULL":" notnull"));
|
|
1058 |
*/
|
|
1059 |
return currentX11InputMethodInstance != NULL ? JNI_TRUE : JNI_FALSE;
|
|
1060 |
}
|
|
1061 |
|
|
1062 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XWindow_x11inputMethodLookupString
|
|
1063 |
(JNIEnv *env, jobject object, jlong event, jlongArray keysymArray) {
|
|
1064 |
KeySym keysym = NoSymbol;
|
|
1065 |
Boolean boo;
|
|
1066 |
/* keysymArray (and testbuf[]) have dimension 2 because we put there two
|
|
1067 |
* perhaps different values of keysyms.
|
|
1068 |
* XXX: not anymore at the moment, but I'll still keep them as arrays
|
|
1069 |
* for a while. If in the course of testing we will be satisfied with
|
|
1070 |
* a current single result from awt_x11inputmethod_lookupString, we'll
|
|
1071 |
* change this.
|
|
1072 |
*/
|
|
1073 |
jlong testbuf[2];
|
|
1074 |
|
|
1075 |
testbuf[1]=0;
|
|
1076 |
|
|
1077 |
boo = awt_x11inputmethod_lookupString((XKeyPressedEvent*)jlong_to_ptr(event), &keysym);
|
|
1078 |
testbuf[0] = keysym;
|
|
1079 |
|
|
1080 |
(*env)->SetLongArrayRegion(env, keysymArray, 0, 2, (jlong *)(testbuf));
|
|
1081 |
return boo ? JNI_TRUE : JNI_FALSE;
|
|
1082 |
}
|
|
1083 |
|
|
1084 |
|
|
1085 |
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
|
|
1086 |
|
|
1087 |
/*
|
|
1088 |
* Class: Java_sun_awt_X11_XWindow_getNativeColor
|
|
1089 |
* Method: getNativeColor
|
|
1090 |
* Signature (Ljava/awt/Color;Ljava/awt/GraphicsConfiguration;)I
|
|
1091 |
*/
|
|
1092 |
JNIEXPORT jint JNICALL Java_sun_awt_X11_XWindow_getNativeColor
|
|
1093 |
(JNIEnv *env, jobject this, jobject color, jobject gc_object) {
|
|
1094 |
AwtGraphicsConfigDataPtr adata;
|
|
1095 |
/* fire warning because JNU_GetLongFieldAsPtr casts jlong to (void *) */
|
|
1096 |
adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, gc_object, x11GraphicsConfigIDs.aData);
|
|
1097 |
return awtJNI_GetColorForVis(env, color, adata);
|
|
1098 |
}
|
|
1099 |
|
|
1100 |
/* syncTopLevelPos() is necessary to insure that the window manager has in
|
|
1101 |
* fact moved us to our final position relative to the reParented WM window.
|
|
1102 |
* We have noted a timing window which our shell has not been moved so we
|
|
1103 |
* screw up the insets thinking they are 0,0. Wait (for a limited period of
|
|
1104 |
* time to let the WM hava a chance to move us
|
|
1105 |
*/
|
|
1106 |
void syncTopLevelPos( Display *d, Window w, XWindowAttributes *winAttr ) {
|
|
1107 |
int32_t i = 0;
|
|
1108 |
do {
|
|
1109 |
XGetWindowAttributes( d, w, winAttr );
|
|
1110 |
/* Sometimes we get here before the WM has updated the
|
|
1111 |
** window data struct with the correct position. Loop
|
|
1112 |
** until we get a non-zero position.
|
|
1113 |
*/
|
|
1114 |
if ((winAttr->x != 0) || (winAttr->y != 0)) {
|
|
1115 |
break;
|
|
1116 |
}
|
|
1117 |
else {
|
|
1118 |
/* What we really want here is to sync with the WM,
|
|
1119 |
** but there's no explicit way to do this, so we
|
|
1120 |
** call XSync for a delay.
|
|
1121 |
*/
|
|
1122 |
XSync(d, False);
|
|
1123 |
}
|
|
1124 |
} while (i++ < 50);
|
|
1125 |
}
|
|
1126 |
|
|
1127 |
static Window getTopWindow(Window win, Window *rootWin)
|
|
1128 |
{
|
|
1129 |
Window root=None, current_window=win, parent=None, *ignore_children=NULL;
|
|
1130 |
Window prev_window=None;
|
|
1131 |
unsigned int ignore_uint=0;
|
|
1132 |
Status status = 0;
|
|
1133 |
|
|
1134 |
if (win == None) return None;
|
|
1135 |
do {
|
|
1136 |
status = XQueryTree(awt_display,
|
|
1137 |
current_window,
|
|
1138 |
&root,
|
|
1139 |
&parent,
|
|
1140 |
&ignore_children,
|
|
1141 |
&ignore_uint);
|
|
1142 |
XFree(ignore_children);
|
|
1143 |
if (status == 0) return None;
|
|
1144 |
prev_window = current_window;
|
|
1145 |
current_window = parent;
|
|
1146 |
} while (parent != root);
|
|
1147 |
*rootWin = root;
|
|
1148 |
return prev_window;
|
|
1149 |
}
|
|
1150 |
|
|
1151 |
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XWindow_getTopWindow
|
|
1152 |
(JNIEnv *env, jclass clazz, jlong win, jlong rootWin) {
|
|
1153 |
return getTopWindow((Window) win, (Window*) jlong_to_ptr(rootWin));
|
|
1154 |
}
|
|
1155 |
|
|
1156 |
static void
|
|
1157 |
getWMInsets
|
|
1158 |
(Window window, int *left, int *top, int *right, int *bottom, int *border) {
|
|
1159 |
// window is event->xreparent.window
|
|
1160 |
Window topWin = None, rootWin = None, containerWindow = None;
|
|
1161 |
XWindowAttributes winAttr, topAttr;
|
|
1162 |
int screenX, screenY;
|
|
1163 |
topWin = getTopWindow(window, &rootWin);
|
|
1164 |
syncTopLevelPos(awt_display, topWin, &topAttr);
|
|
1165 |
// (screenX, screenY) is (0,0) of the reparented window
|
|
1166 |
// converted to screen coordinates.
|
|
1167 |
XTranslateCoordinates(awt_display, window, rootWin,
|
|
1168 |
0,0, &screenX, &screenY, &containerWindow);
|
|
1169 |
*left = screenX - topAttr.x - topAttr.border_width;
|
|
1170 |
*top = screenY - topAttr.y - topAttr.border_width;
|
|
1171 |
XGetWindowAttributes(awt_display, window, &winAttr);
|
|
1172 |
*right = topAttr.width - ((winAttr.width) + *left);
|
|
1173 |
*bottom = topAttr.height - ((winAttr.height) + *top);
|
|
1174 |
*border = topAttr.border_width;
|
|
1175 |
}
|
|
1176 |
|
|
1177 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XWindow_getWMInsets
|
|
1178 |
(JNIEnv *env, jclass clazz, jlong window, jlong left, jlong top, jlong right, jlong bottom, jlong border) {
|
|
1179 |
getWMInsets((Window) window,
|
|
1180 |
(int*) jlong_to_ptr(left),
|
|
1181 |
(int*) jlong_to_ptr(top),
|
|
1182 |
(int*) jlong_to_ptr(right),
|
|
1183 |
(int*) jlong_to_ptr(bottom),
|
|
1184 |
(int*) jlong_to_ptr(border));
|
|
1185 |
}
|
|
1186 |
|
|
1187 |
static void
|
|
1188 |
getWindowBounds
|
|
1189 |
(Window window, int *x, int *y, int *width, int *height) {
|
|
1190 |
XWindowAttributes winAttr;
|
|
1191 |
XSync(awt_display, False);
|
|
1192 |
XGetWindowAttributes(awt_display, window, &winAttr);
|
|
1193 |
*x = winAttr.x;
|
|
1194 |
*y = winAttr.y;
|
|
1195 |
*width = winAttr.width;
|
|
1196 |
*height = winAttr.height;
|
|
1197 |
}
|
|
1198 |
|
|
1199 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XWindow_getWindowBounds
|
|
1200 |
(JNIEnv *env, jclass clazz, jlong window, jlong x, jlong y, jlong width, jlong height) {
|
|
1201 |
getWindowBounds((Window) window, (int*) jlong_to_ptr(x), (int*) jlong_to_ptr(y),
|
|
1202 |
(int*) jlong_to_ptr(width), (int*) jlong_to_ptr(height));
|
|
1203 |
}
|
|
1204 |
|
|
1205 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XWindow_setSizeHints
|
|
1206 |
(JNIEnv *env, jclass clazz, jlong window, jlong x, jlong y, jlong width, jlong height) {
|
|
1207 |
XSizeHints *size_hints = XAllocSizeHints();
|
|
1208 |
size_hints->flags = USPosition | PPosition | PSize;
|
|
1209 |
size_hints->x = (int)x;
|
|
1210 |
size_hints->y = (int)y;
|
|
1211 |
size_hints->width = (int)width;
|
|
1212 |
size_hints->height = (int)height;
|
|
1213 |
XSetWMNormalHints(awt_display, (Window)window, size_hints);
|
|
1214 |
XFree((char*)size_hints);
|
|
1215 |
}
|
|
1216 |
|
|
1217 |
|
|
1218 |
JNIEXPORT void JNICALL
|
|
1219 |
Java_sun_awt_X11_XWindow_initIDs
|
|
1220 |
(JNIEnv *env, jclass clazz)
|
|
1221 |
{
|
|
1222 |
char *ptr = NULL;
|
|
1223 |
windowID = (*env)->GetFieldID(env, clazz, "window", "J");
|
|
1224 |
targetID = (*env)->GetFieldID(env, clazz, "target", "Ljava/awt/Component;");
|
|
1225 |
graphicsConfigID = (*env)->GetFieldID(env, clazz, "graphicsConfig", "Lsun/awt/X11GraphicsConfig;");
|
|
1226 |
drawStateID = (*env)->GetFieldID(env, clazz, "drawState", "I");
|
|
1227 |
ptr = getenv("_AWT_USE_TYPE4_PATCH");
|
|
1228 |
if( ptr != NULL && ptr[0] != 0 ) {
|
|
1229 |
if( strncmp("true", ptr, 4) == 0 ) {
|
|
1230 |
awt_UseType4Patch = True;
|
|
1231 |
}else if( strncmp("false", ptr, 5) == 0 ) {
|
|
1232 |
awt_UseType4Patch = False;
|
|
1233 |
}
|
|
1234 |
}
|
|
1235 |
}
|
|
1236 |
|
|
1237 |
JNIEXPORT int JNICALL
|
|
1238 |
Java_sun_awt_X11_XWindow_getKeySymForAWTKeyCode(JNIEnv* env, jclass clazz, jint keycode) {
|
|
1239 |
return awt_getX11KeySym(keycode);
|
|
1240 |
}
|