jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java
author yan
Tue, 28 Apr 2009 13:41:11 -0700
changeset 2660 3c98e01dcbcf
parent 439 3488710b02f8
child 3938 ef327bd847c0
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 120
diff changeset
     2
 * Copyright 2003-2008 Sun Microsystems, Inc.  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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.awt.X11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import sun.misc.Unsafe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.logging.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.AWTKeyStroke;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.event.InputEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * Common class for all XEmbed protocol participating classes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * Contains constant definitions and helper routines.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
public class XEmbedHelper {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    private static final Logger xembedLog = Logger.getLogger("sun.awt.X11.xembed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    final static Unsafe unsafe = Unsafe.getUnsafe();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    final static int XEMBED_VERSION = 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
        XEMBED_MAPPED = (1 << 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/* XEMBED messages */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    final static int XEMBED_EMBEDDED_NOTIFY     =       0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    final static int XEMBED_WINDOW_ACTIVATE  =  1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    final static int XEMBED_WINDOW_DEACTIVATE =         2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    final static int XEMBED_REQUEST_FOCUS               =3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    final static int XEMBED_FOCUS_IN    =       4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    final static int XEMBED_FOCUS_OUT   =       5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    final static int XEMBED_FOCUS_NEXT  =       6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    final static int XEMBED_FOCUS_PREV  =       7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
/* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    final static int XEMBED_GRAB_KEY = 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    final static int XEMBED_UNGRAB_KEY = 9;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    final static int XEMBED_MODALITY_ON         =       10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    final static int XEMBED_MODALITY_OFF        =       11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    final static int XEMBED_REGISTER_ACCELERATOR =    12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    final static int XEMBED_UNREGISTER_ACCELERATOR=   13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    final static int XEMBED_ACTIVATE_ACCELERATOR  =   14;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    final static int NON_STANDARD_XEMBED_GTK_GRAB_KEY = 108;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    final static int NON_STANDARD_XEMBED_GTK_UNGRAB_KEY = 109;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
//     A detail code is required for XEMBED_FOCUS_IN. The following values are valid:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
/* Details for  XEMBED_FOCUS_IN: */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    final static int XEMBED_FOCUS_CURRENT       =       0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    final static int XEMBED_FOCUS_FIRST         =       1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    final static int XEMBED_FOCUS_LAST  =       2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
// Modifiers bits
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    final static int XEMBED_MODIFIER_SHIFT   = (1 << 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    final static int XEMBED_MODIFIER_CONTROL = (1 << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    final static int XEMBED_MODIFIER_ALT     = (1 << 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    final static int XEMBED_MODIFIER_SUPER   = (1 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    final static int XEMBED_MODIFIER_HYPER   = (1 << 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    static XAtom XEmbedInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    static XAtom XEmbed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    XEmbedHelper() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        if (XEmbed == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            XEmbed = XAtom.get("_XEMBED");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            if (xembedLog.isLoggable(Level.FINER)) xembedLog.finer("Created atom " + XEmbed.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        if (XEmbedInfo == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            XEmbedInfo = XAtom.get("_XEMBED_INFO");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            if (xembedLog.isLoggable(Level.FINER)) xembedLog.finer("Created atom " + XEmbedInfo.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    void sendMessage(long window, int message) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        sendMessage(window, message, 0, 0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    void sendMessage(long window, int message, long detail, long data1, long data2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        XClientMessageEvent msg = new XClientMessageEvent();
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 120
diff changeset
    97
        msg.set_type((int)XConstants.ClientMessage);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        msg.set_window(window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        msg.set_message_type(XEmbed.getAtom());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        msg.set_format(32);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        msg.set_data(0, XToolkit.getCurrentServerTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        msg.set_data(1, message);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        msg.set_data(2, detail);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        msg.set_data(3, data1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        msg.set_data(4, data2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        XToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Sending " + XEmbedMessageToString(msg));
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 120
diff changeset
   109
            XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XConstants.NoEventMask, msg.pData);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            XToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        msg.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    static String msgidToString(int msg_id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        switch (msg_id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
          case XEMBED_EMBEDDED_NOTIFY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
              return "XEMBED_EMBEDDED_NOTIFY";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
          case XEMBED_WINDOW_ACTIVATE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
              return "XEMBED_WINDOW_ACTIVATE";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
          case XEMBED_WINDOW_DEACTIVATE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
              return "XEMBED_WINDOW_DEACTIVATE";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
          case XEMBED_FOCUS_IN:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
              return "XEMBED_FOCUS_IN";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
          case XEMBED_FOCUS_OUT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
              return "XEMBED_FOCUS_OUT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
          case XEMBED_REQUEST_FOCUS:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
              return "XEMBED_REQUEST_FOCUS";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
          case XEMBED_FOCUS_NEXT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
              return "XEMBED_FOCUS_NEXT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
          case XEMBED_FOCUS_PREV:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
              return "XEMBED_FOCUS_PREV";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
          case XEMBED_MODALITY_ON:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
              return "XEMBED_MODALITY_ON";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
          case XEMBED_MODALITY_OFF:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
              return "XEMBED_MODALITY_OFF";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
          case XEMBED_REGISTER_ACCELERATOR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
              return "XEMBED_REGISTER_ACCELERATOR";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
          case XEMBED_UNREGISTER_ACCELERATOR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
              return "XEMBED_UNREGISTER_ACCELERATOR";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
          case XEMBED_ACTIVATE_ACCELERATOR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
              return "XEMBED_ACTIVATE_ACCELERATOR";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
          case XEMBED_GRAB_KEY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
              return "XEMBED_GRAB_KEY";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
          case XEMBED_UNGRAB_KEY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
              return "XEMBED_UNGRAB_KEY";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
          case NON_STANDARD_XEMBED_GTK_UNGRAB_KEY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
              return "NON_STANDARD_XEMBED_GTK_UNGRAB_KEY";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
          case NON_STANDARD_XEMBED_GTK_GRAB_KEY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
              return "NON_STANDARD_XEMBED_GTK_GRAB_KEY";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
          case XConstants.KeyPress | XEmbedServerTester.SYSTEM_EVENT_MASK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
              return "KeyPress";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
          case XConstants.MapNotify | XEmbedServerTester.SYSTEM_EVENT_MASK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
              return "MapNotify";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
          case XConstants.PropertyNotify | XEmbedServerTester.SYSTEM_EVENT_MASK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
              return "PropertyNotify";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
              return "unknown XEMBED id " + msg_id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    static String focusIdToString(int focus_id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        switch(focus_id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
          case XEMBED_FOCUS_CURRENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
              return "XEMBED_FOCUS_CURRENT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
          case XEMBED_FOCUS_FIRST:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
              return "XEMBED_FOCUS_FIRST";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
          case XEMBED_FOCUS_LAST:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
              return "XEMBED_FOCUS_LAST";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
              return "unknown focus id " + focus_id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    static String XEmbedMessageToString(XClientMessageEvent msg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        return ("XEmbed message to " + Long.toHexString(msg.get_window()) + ": " + msgidToString((int)msg.get_data(1)) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                ", detail: " + msg.get_data(2) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                ", data:[" + msg.get_data(3) + "," + msg.get_data(4) + "]");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * Converts XEMBED modifiers mask into AWT InputEvent mask
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    int getModifiers(int state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        int mods = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        if ((state & XEMBED_MODIFIER_SHIFT) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            mods |= InputEvent.SHIFT_DOWN_MASK;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        if ((state & XEMBED_MODIFIER_CONTROL) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            mods |= InputEvent.CTRL_DOWN_MASK;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        if ((state & XEMBED_MODIFIER_ALT) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            mods |= InputEvent.ALT_DOWN_MASK;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        // FIXME: What is super/hyper?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        // FIXME: Experiments show that SUPER is ALT. So what is Alt then?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        if ((state & XEMBED_MODIFIER_SUPER) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            mods |= InputEvent.ALT_DOWN_MASK;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
//         if ((state & XEMBED_MODIFIER_HYPER) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
//             mods |= InputEvent.DOWN_MASK;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
//         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        return mods;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    // Shouldn't be called on Toolkit thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        XBaseWindow.checkSecurity();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        int keycode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        XToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            keycode = XWindow.getAWTKeyCodeForKeySym((int)keysym);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            XToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        int modifiers = getModifiers((int)state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
}