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