src/java.desktop/unix/classes/sun/awt/X11/XlibWrapper.java
author prr
Thu, 01 Nov 2018 13:56:14 -0700
changeset 52535 45a5c4d812d9
parent 47216 71c04702a3d5
permissions -rw-r--r--
8213213: Remove src/java.desktop/unix/classes/sun/awt/X11/keysym2ucs.h Reviewed-by: serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
26021
847033cb0339 8033141: Cleanup of sun.awt.X11 package
serb
parents: 23010
diff changeset
     2
 * Copyright (c) 2002, 2014, 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: 4370
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: 4370
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: 4370
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4370
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4370
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
package sun.awt.X11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.security.AccessController;
26021
847033cb0339 8033141: Cleanup of sun.awt.X11 package
serb
parents: 23010
diff changeset
    29
33674
566777f73c32 8140606: Update library code to use internal Unsafe
chegar
parents: 32865
diff changeset
    30
import jdk.internal.misc.Unsafe;
13604
31089af1a447 7163201: Simplify toolkit internals references
bagiras
parents: 5506
diff changeset
    31
import sun.security.action.GetPropertyAction;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
26021
847033cb0339 8033141: Cleanup of sun.awt.X11 package
serb
parents: 23010
diff changeset
    33
final class XlibWrapper {
847033cb0339 8033141: Cleanup of sun.awt.X11 package
serb
parents: 23010
diff changeset
    34
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
    static Unsafe unsafe = Unsafe.getUnsafe();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    // strange constants
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
    static final int MAXSIZE = 32767;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    static final int MINSIZE = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    // define a private constructor here to prevent this class and all
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    // its descendants from being created
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private XlibWrapper()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
   Display *XOpenDisplay(display_name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
   char *display_name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
*/
26021
847033cb0339 8033141: Cleanup of sun.awt.X11 package
serb
parents: 23010
diff changeset
    51
    static final String[] eventToString =
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    {"<none:0>", "<none:1>", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     "SelectionClear", "SelectionRequest", "SelectionNotify", "ColormapNotify",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     "ClientMessage", "MappingNotify", "LASTEvent"};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    static native void XFree(long ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    static native void memcpy(long dest_ptr, long src_ptr, long length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    static native long getAddress(Object o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    static native void copyIntArray(long dest_ptr, Object array, int size_bytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    static native void copyLongArray(long dest_ptr, Object array, int size_bytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Gets byte string from str_ptr and copies it into byte array
26021
847033cb0339 8033141: Cleanup of sun.awt.X11 package
serb
parents: 23010
diff changeset
    69
     * String should be NULL terminated.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    static native byte[] getStringBytes(long str_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    static  native long XOpenDisplay(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    static  native void XCloseDisplay(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    static  native long XDisplayString(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    static  native void XSetCloseDownMode(long display, int close_mode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    static  native long DefaultScreen(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    static native long ScreenOfDisplay(long display, long screen_number);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    static native int DoesBackingStore(long screen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    static native  long DisplayWidth(long display, long screen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    static native  long DisplayWidthMM(long display, long screen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    static native long DisplayHeight(long display, long screen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    static native long DisplayHeightMM(long display, long screen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    static  native long RootWindow(long display, long screen_number);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    static native int ScreenCount(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
   Window XCreateWindow(display, parent, x, y, width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
   border_width, depth,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
   class, visual, valuemask, attributes)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
   Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
   Window parent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
   int x, y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
   unsigned int width, height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
   unsigned int border_width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
   int depth;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
   unsigned int class;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
   Visual *visual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
   unsigned long valuemask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
   XSetWindowAttributes *attributes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    static native long XCreateWindow(long display, long parent, int x,int  y, int width, int height, int border_width, int depth, long wclass, long visual, long valuemask, long attributes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    static native void XDestroyWindow(long display, long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    static native int XGrabPointer(long display, long grab_window,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                                   int owner_events, int event_mask, int pointer_mode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                                   int keyboard_mode, long confine_to, long cursor, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    static native void XUngrabPointer(long display, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    static native int XGrabKeyboard(long display, long grab_window,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                                    int owner_events, int pointer_mode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                                    int keyboard_mode, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    static native void XUngrabKeyboard(long display, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    static native void XGrabServer(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    static native void XUngrabServer(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
void XSetWMProperties(display, w, window_name, icon_name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
argv, argc, normal_hints, wm_hints, class_hints)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
Window w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
XTextProperty *window_name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
XTextProperty *icon_name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
char **argv;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
int argc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
XSizeHints *normal_hints;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
XWMHints *wm_hints;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
XClassHint *class_hints;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
XMapWindow(display, w)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
Window w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    static  native void XMapWindow(long display, long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    static  native void XMapRaised(long display, long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    static  native void XRaiseWindow(long display, long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    static native void XLowerWindow(long display, long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    static native void XRestackWindows(long display, long windows, int length);
2472
b7aba00cabb6 6693253: Security Warning appearance requires enhancements
anthony
parents: 2462
diff changeset
   160
    static native void XConfigureWindow(long display, long window,
b7aba00cabb6 6693253: Security Warning appearance requires enhancements
anthony
parents: 2462
diff changeset
   161
            long value_mask, long values);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    static native void XSetInputFocus(long display, long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    static native void XSetInputFocus2(long display, long window, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    static native long XGetInputFocus(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
XUnmapWindow(display, w)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
Window w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    static  native void XUnmapWindow(long display, long window);
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
  XSelectInput(display, w, event_mask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
  Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
  Window w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
  long event_mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    static  native void XSelectInput(long display, long window, long event_mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
       XNextEvent(display, event_return)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
       Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
       XEvent *event_return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    static  native void XNextEvent(long display,long ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     XMaskEvent(display, event_mask, event_return)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
           long event_mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
           XEvent *event_return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    static native void XMaskEvent(long display, long event_mask, long event_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    static native void XWindowEvent(long display, long window, long event_mask, long event_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
      Bool XFilterEvent(event, w)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
           XEvent *event;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
           Window w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    static native boolean XFilterEvent(long ptr, long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     Bool XSupportsLocale()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
static native boolean XSupportsLocale();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     char *XSetLocaleModifiers(modifier_list)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
           char *modifier_list;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
static native String XSetLocaleModifiers(String modifier_list);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    static  native int XTranslateCoordinates(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                                             long display, long src_w, long dest_w,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                                             long src_x, long src_y,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                                             long dest_x_return, long dest_y_return,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                                             long child_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
       XPeekEvent(display, event_return)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
       Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
       XEvent *event_return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    static  native void XPeekEvent(long display,long ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
  XFlush(display)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
  Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    static native void XFlush(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
  XSync(display, discard)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
  Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
  Bool discard;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    static native void XSync(long display,int discard);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
/*    XMoveResizeWindow(display, w, x, y, width, height)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
      Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
      Window w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
      int x, y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
      unsigned int width, height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    static native void XMoveResizeWindow(long display, long window, int x, int y, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    static native void XResizeWindow(long display, long window, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    static native void XMoveWindow(long display, long window, int x, int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     Bool XQueryPointer(display, w, root_return, child_return,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     root_x_return, root_y_return,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                          win_x_return, win_y_return,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     mask_return)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
           Window w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
           Window *root_return, *child_return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
           int *root_x_return, *root_y_return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
           int *win_x_return, *win_y_return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
           unsigned int *mask_return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
 static native boolean  XQueryPointer (long display, long window, long root_return, long child_return, long root_x_return, long root_y_return, long win_x_return, long win_y_return, long mask_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
/*    XFreeCursor(display, cursor)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
           Cursor cursor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
 static native void XFreeCursor(long display, long cursor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
   XSetWindowBackground(display, w, background_pixel)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
   Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
   Window w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
   unsigned long background_pixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    static native void XSetWindowBackground(long display, long window, long background_pixel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    static native int XEventsQueued(long display, int mode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
  Atom XInternAtom(display, atom_name, only_if_exists)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
  Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
  char *atom_name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
  Bool only_if_exists;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    static native int XInternAtoms(long display, String[] names, boolean only_if_exists, long atoms);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    static native void SetProperty(long display, long window, long atom, String str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    static native String GetProperty(long display ,long window, long atom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    static native long InternAtom(long display, String string, int only_if_exists);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    static native int XGetWindowProperty(long display, long window, long atom,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                                         long long_offset, long long_length,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                                         long delete, long req_type, long actualy_type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                                         long actualy_format, long nitems_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                                         long bytes_after, long data_ptr);
32865
f9cb6e427f9e 8136783: Run blessed-modifier-order script on java.desktop
prr
parents: 26037
diff changeset
   316
    static native void XChangePropertyImpl(long display, long window, long atom,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                                           long type, int format, int mode, long data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                                           int nelements);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    static void XChangeProperty(long display, long window, long atom,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                                long type, int format, int mode, long data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                                int nelements) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        // TODO: handling of XChangePropertyImpl return value, if not Success - don't cache
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        if (XPropertyCache.isCachingSupported() &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            XToolkit.windowToXWindow(window) != null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            WindowPropertyGetter.isCacheableProperty(XAtom.get(atom)) &&
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   326
            mode == XConstants.PropModeReplace)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            int length = (format / 8) * nelements;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            XPropertyCache.storeCache(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                new XPropertyCache.PropertyCacheEntry(format,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
                                                      nelements,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                                                      0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                                                      data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                                                      length),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                window,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                XAtom.get(atom));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        XChangePropertyImpl(display, window, atom, type, format, mode, data, nelements);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    static native void XChangePropertyS(long display, long window, long atom,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
                                       long type, int format, int mode, String value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    static native void XDeleteProperty(long display, long window, long atom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    static native void XSetTransientFor(long display, long window, long transient_for_window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    static native void XSetWMHints(long display, long window, long wmhints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    static native void XGetWMHints(long display, long window, long wmhints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    static native long XAllocWMHints();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    static native int XGetPointerMapping(long display, long map, int buttonNumber);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    static native String XGetDefault(long display, String program, String option);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    static native long getScreenOfWindow(long display, long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    static native long XScreenNumberOfScreen(long screen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    static native int XIconifyWindow(long display, long window, long screenNumber);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    static native String ServerVendor(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    static native int VendorRelease(long display);
3088
b0260407a050 6711676: Numpad keys trigger more than one KeyEvent.
yan
parents: 2802
diff changeset
   356
    static native boolean IsXsunKPBehavior(long display);
4370
cc409c51b108 5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents: 3088
diff changeset
   357
    static native boolean IsSunKeyboard(long display);
cc409c51b108 5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents: 3088
diff changeset
   358
    static native boolean IsKanaKeyboard(long display);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    static native void XBell(long display, int percent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
 /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
          Cursor XCreateFontCursor(display, shape)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
           unsigned int shape;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
           we always pass int as shape param.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
           perhaps later we will need to change type of shape to long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    static native int XCreateFontCursor(long display, int shape);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     Pixmap XCreateBitmapFromData(display, d, data, width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     height)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
           Drawable d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
           char *data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
           unsigned int width, height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    static native long XCreateBitmapFromData(long display, long drawable, long data, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
 /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
      XFreePixmap(display, pixmap)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
           Pixmap pixmap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
   static native void XFreePixmap(long display, long pixmap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
  /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     Cursor XCreatePixmapCursor(display, source, mask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     foreground_color, background_color, x, y)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
           Pixmap source;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
           Pixmap mask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
           XColor *foreground_color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
           XColor *background_color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
           unsigned int x, y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
   static native long XCreatePixmapCursor(long display, long source, long mask, long fore, long back, int x, int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
         Status XQueryBestCursor(display, d, width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     width_return, height_return)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
           Drawable d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
           unsigned int width, height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
           unsigned int *width_return, *height_return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    static native boolean XQueryBestCursor(long display, long drawable, int width, int height, long width_return, long height_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     Status XAllocColor(display, colormap, screen_in_out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
           Colormap colormap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
           XColor *screen_in_out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    static native boolean XAllocColor( long display, long colormap, long screen_in_out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
    static native long SetToolkitErrorHandler();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    static native void XSetErrorHandler(long handler);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    static native int CallErrorHandler(long handler, long display, long event_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
 /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
      XChangeWindowAttributes(display, w, valuemask, attributes)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
           Display *display;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
           Window w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
           unsigned long valuemask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
           XSetWindowAttributes *attributes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    static native void XChangeWindowAttributes(long display, long window, long valuemask, long attributes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    static native int XGetWindowAttributes(long display, long window, long attr_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    static native int XGetGeometry(long display, long drawable, long root_return, long x_return, long y_return,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                                   long width_return, long height_return, long border_width_return, long depth_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    static native int XGetWMNormalHints(long display, long window, long hints, long supplied_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    static native void XSetWMNormalHints(long display, long window, long hints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    static native void XSetMinMaxHints(long display, long window, int x, int y, int width, int height, long flags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    static native long XAllocSizeHints();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    static native int XSendEvent(long display, long window, boolean propagate, long event_mask, long event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    static native void XPutBackEvent(long display, long event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    static native int XQueryTree(long display, long window, long root_return, long parent_return, long children_return, long nchildren_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    static native long XGetVisualInfo(long display, long vinfo_mask, long vinfo_template, long nitems_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    static native void XReparentWindow(long display, long window, long parent, int x, int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    static native void XConvertSelection(long display, long selection,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
                                         long target, long property,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                                         long requestor, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    static native void XSetSelectionOwner(long display, long selection,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
                                          long owner, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    static native long XGetSelectionOwner(long display, long selection);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    static native String XGetAtomName(long display, long atom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    static native long XMaxRequestSize(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    static native long XCreatePixmap(long display, long drawable, int width, int height, int depth);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    static native long XCreateImage(long display, long visual_ptr, int depth, int format,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
                                    int offset, long data, int width, int height, int bitmap_pad,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
                                    int bytes_per_line);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
    static native void XDestroyImage(long image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    static native void XPutImage(long display, long drawable, long gc, long image,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
                                 int src_x, int src_y, int dest_x, int dest_y,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
                                 int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
    static native long XCreateGC(long display, long drawable, long valuemask, long values);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    static native void XFreeGC(long display, long gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
    static native void XSetWindowBackgroundPixmap(long display, long window, long pixmap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    static native void XClearWindow(long display, long window);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
    static native int XGetIconSizes(long display, long window, long ret_sizes, long ret_count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    static native int XdbeQueryExtension(long display, long major_version_return,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
                                         long minor_version_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
    static native boolean XQueryExtension(long display, String name, long mop_return,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
                                         long feve_return, long err_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    static native boolean IsKeypadKey(long keysym);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    static native long XdbeAllocateBackBufferName(long display, long window, int swap_action);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    static native int XdbeDeallocateBackBufferName(long display, long buffer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    static native int XdbeBeginIdiom(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    static native int XdbeEndIdiom(long display);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    static native int XdbeSwapBuffers(long display, long swap_info, int num_windows);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
1966
12a51fb0db0d 5100701: Toolkit.getLockingKeyState() does not work on XToolkit, but works on Motif
yan
parents: 439
diff changeset
   494
    static native void XQueryKeymap(long display, long vector);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    static native long XKeycodeToKeysym(long display, int keycode, int index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    static native int XKeysymToKeycode(long display, long keysym);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
2473
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   499
    // xkb-related
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   500
    static native int XkbGetEffectiveGroup(long display);
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   501
    static native long XkbKeycodeToKeysym(long display, int keycode, int group, int level);
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   502
    static native void XkbSelectEvents(long display, long device, long bits_to_change, long values_for_bits);
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   503
    static native void XkbSelectEventDetails(long display, long device, long event_type,
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   504
                                              long bits_to_change, long values_for_bits);
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   505
    static native boolean XkbQueryExtension(long display, long opcode_rtrn, long event_rtrn,
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   506
              long error_rtrn, long major_in_out, long minor_in_out);
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   507
    static native boolean XkbLibraryVersion(long lib_major_in_out, long lib_minor_in_out);
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   508
    static native long XkbGetMap(long display, long which, long device_spec);
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   509
    static native long XkbGetUpdatedMap(long display, long which, long xkb);
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   510
    static native void XkbFreeKeyboard(long xkb, long which, boolean free_all);
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   511
    static native boolean XkbTranslateKeyCode(long xkb, int keycode, long mods, long mods_rtrn, long keysym_rtrn);
20155
65bcc88496eb 8019282: keyRelesed is reached even though key was NOT released
serb
parents: 13604
diff changeset
   512
    static native void XkbSetDetectableAutoRepeat(long display, boolean detectable);
2473
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   513
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   514
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
    static native void XConvertCase(long keysym,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
                                    long keysym_lowercase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
                                    long keysym_uppercase);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    static native long XGetModifierMapping(long display);
4370
cc409c51b108 5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents: 3088
diff changeset
   520
    static native void XFreeModifiermap(long keymap);
cc409c51b108 5099725: AWT doesn't seem to handle MappingNotify events under X11.
yan
parents: 3088
diff changeset
   521
    static native void XRefreshKeyboardMapping(long event);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    static native void XChangeActivePointerGrab(long display, int mask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
                                                long cursor, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
      int (*XSynchronize(Display *display, Bool onoff))();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
          display   Specifies the connection to the X server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
          onoff     Specifies a Boolean value that indicates whether to enable or disable synchronization.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     */
26021
847033cb0339 8033141: Cleanup of sun.awt.X11 package
serb
parents: 23010
diff changeset
   532
    static native int XSynchronize(long display, boolean onoff);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * Extracts an X event that can be processed in a secondary loop.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * Should only be called on the toolkit thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * Returns false if this secondary event was terminated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    static native boolean XNextSecondaryLoopEvent(long display, long ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * Terminates the topmost secondary loop (if any).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * Should never be called on the toolkit thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    static native void ExitSecondaryLoop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     * Calls XTextPropertyToStringList on the specified byte array and returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     * the array of strings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
    static native String[] XTextPropertyToStringList(byte[] bytes, long encoding_atom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     * XSHAPE extension support.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
    static native boolean XShapeQueryExtension(long display, long event_base_return, long error_base_return);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
    static native void SetRectangularShape(long display, long window,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
            int lox, int loy, int hix, int hiy,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
            sun.java2d.pipe.Region region);
2472
b7aba00cabb6 6693253: Security Warning appearance requires enhancements
anthony
parents: 2462
diff changeset
   559
    /** Each int in the bitmap array is one pixel with a 32-bit color:
b7aba00cabb6 6693253: Security Warning appearance requires enhancements
anthony
parents: 2462
diff changeset
   560
     *  R, G, B, and Alpha.
b7aba00cabb6 6693253: Security Warning appearance requires enhancements
anthony
parents: 2462
diff changeset
   561
     */
b7aba00cabb6 6693253: Security Warning appearance requires enhancements
anthony
parents: 2462
diff changeset
   562
    static native void SetBitmapShape(long display, long window,
b7aba00cabb6 6693253: Security Warning appearance requires enhancements
anthony
parents: 2462
diff changeset
   563
             int width, int height, int[] bitmap);
b7aba00cabb6 6693253: Security Warning appearance requires enhancements
anthony
parents: 2462
diff changeset
   564
2462
192552ca8292 6809227: poor performance on Panel.Add() method in jdk6
dcherepanov
parents: 1966
diff changeset
   565
    static native void SetZOrder(long display, long window, long above);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
/* Global memory area used for X lib parameter passing */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
32865
f9cb6e427f9e 8136783: Run blessed-modifier-order script on java.desktop
prr
parents: 26037
diff changeset
   569
    static final long lbuffer = unsafe.allocateMemory(64);  // array to hold 8 longs
f9cb6e427f9e 8136783: Run blessed-modifier-order script on java.desktop
prr
parents: 26037
diff changeset
   570
    static final long ibuffer = unsafe.allocateMemory(32);  // array to hold 8 ints
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    static final long larg1 = lbuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    static final long larg2 = larg1+8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
    static final long larg3 = larg2+8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    static final long larg4 = larg3+8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    static final long larg5 = larg4+8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
    static final long larg6 = larg5+8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
    static final long larg7 = larg6+8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    static final long larg8 = larg7+8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    static final long iarg1 = ibuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    static final long iarg2 = iarg1+4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
    static final long iarg3 = iarg2+4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    static final long iarg4 = iarg3+4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    static final long iarg5 = iarg4+4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    static final long iarg6 = iarg5+4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
    static final long iarg7 = iarg6+4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
    static final long iarg8 = iarg7+4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
    static int dataModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    static final boolean isBuildInternal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
    static {
13604
31089af1a447 7163201: Simplify toolkit internals references
bagiras
parents: 5506
diff changeset
   595
        String dataModelProp = AccessController.doPrivileged(
31089af1a447 7163201: Simplify toolkit internals references
bagiras
parents: 5506
diff changeset
   596
            new GetPropertyAction("sun.arch.data.model"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
            dataModel = Integer.parseInt(dataModelProp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
            dataModel = 32;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
        isBuildInternal = getBuildInternal();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
//      System.loadLibrary("mawt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    static int getDataModel() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
        return dataModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
    static String hintsToString(long flags) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
        StringBuffer buf = new StringBuffer();
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   614
        if ((flags & XUtilConstants.PMaxSize) != 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
            buf.append("PMaxSize ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
        }
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   617
        if ((flags & XUtilConstants.PMinSize) != 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
            buf.append("PMinSize ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
        }
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   620
        if ((flags & XUtilConstants.USSize) != 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
            buf.append("USSize ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
        }
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   623
        if ((flags & XUtilConstants.USPosition) != 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
            buf.append("USPosition ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
        }
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   626
        if ((flags & XUtilConstants.PPosition) != 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
            buf.append("PPosition ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
        }
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   629
        if ((flags & XUtilConstants.PSize) != 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
            buf.append("PSize ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
        }
439
3488710b02f8 6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
dav
parents: 2
diff changeset
   632
        if ((flags & XUtilConstants.PWinGravity) != 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
            buf.append("PWinGravity ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        return buf.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
    }
2473
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   637
    static String getEventToString( int type ) {
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   638
        if( (type >= 0) && (type < eventToString.length)) {
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   639
            return eventToString[type];
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   640
        }else if( type == XToolkit.getXKBBaseEventCode() ) {
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   641
            //XXX TODO various xkb types
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   642
            return "XkbEvent";
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   643
        }
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   644
        return eventToString[0];
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2472
diff changeset
   645
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    private static boolean getBuildInternal() {
13604
31089af1a447 7163201: Simplify toolkit internals references
bagiras
parents: 5506
diff changeset
   648
        String javaVersion = AccessController.doPrivileged(
31089af1a447 7163201: Simplify toolkit internals references
bagiras
parents: 5506
diff changeset
   649
                                 new GetPropertyAction("java.version"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
        return javaVersion != null && javaVersion.contains("internal");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    }
2802
d05a9dcc8296 6678385: Random java.lang.StackOverflowError from various JDKs
art
parents: 2473
diff changeset
   652
d05a9dcc8296 6678385: Random java.lang.StackOverflowError from various JDKs
art
parents: 2473
diff changeset
   653
    static native void PrintXErrorEvent(long display, long event_ptr);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
}