src/java.desktop/share/native/include/jawt.h
author alanb
Thu, 21 Mar 2019 08:41:10 +0000
branchniosocketimpl-branch
changeset 57275 222fa5ed1c91
parent 47216 71c04702a3d5
permissions -rw-r--r--
Add @systemProperty ref to system property to configure old impl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
     2
 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
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: 2
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: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
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
#ifndef _JAVASOFT_JAWT_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define _JAVASOFT_JAWT_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "jni.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
extern "C" {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/*
40708
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
    36
 * AWT native interface.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * The AWT native interface allows a native C or C++ application a means
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * by which to access native structures in AWT.  This is to facilitate moving
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * legacy C and C++ applications to Java and to target the needs of the
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    41
 * developers who need to do their own native rendering to canvases
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    42
 * for performance or other reasons.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    44
 * Conversely it also provides mechanisms for an application which already
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    45
 * has a native window to provide that to AWT for AWT rendering.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    47
 * Since every platform may be different in its native data structures
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    48
 * and APIs for windowing systems the application must necessarily
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    49
 * provided per-platform source and compile and deliver per-platform
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    50
 * native code  to use this API.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    52
 * These interfaces are not part of the Java SE specification and
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    53
 * a VM is not required to implement this API. However it is strongly
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    54
 * recommended that all implementations which support headful AWT
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    55
 * also support these interfaces.
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    56
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * AWT Native Drawing Surface (JAWT_DrawingSurface).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * For each platform, there is a native drawing surface structure.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * platform-specific structure can be found in jawt_md.h.  It is recommended
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * that additional platforms follow the same model.  It is also recommended
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
    65
 * that VMs on all platforms support the existing structures in jawt_md.h.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *******************
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * EXAMPLE OF USAGE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *******************
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * In Win32, a programmer wishes to access the HWND of a canvas to perform
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * native rendering into it.  The programmer has declared the paint() method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * for their canvas subclass to be native:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * MyCanvas.java:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * public class MyCanvas extends Canvas {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *     static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *         System.loadLibrary("mylib");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *     public native void paint(Graphics g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * myfile.c:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * #include "jawt_md.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * #include <assert.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *     JAWT awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 *     JAWT_DrawingSurface* ds;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *     JAWT_DrawingSurfaceInfo* dsi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 *     JAWT_Win32DrawingSurfaceInfo* dsi_win;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *     jboolean result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 *     jint lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 *
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   105
 *     // Get the AWT. Request version 9 to access features in that release.
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   106
 *     awt.version = JAWT_VERSION_9;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 *     result = JAWT_GetAWT(env, &awt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 *     assert(result != JNI_FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 *     // Get the drawing surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 *     ds = awt.GetDrawingSurface(env, canvas);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 *     assert(ds != NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 *     // Lock the drawing surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 *     lock = ds->Lock(ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *     assert((lock & JAWT_LOCK_ERROR) == 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 *     // Get the drawing surface info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *     dsi = ds->GetDrawingSurfaceInfo(ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *     // Get the platform-specific drawing info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 *     dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 *     //////////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 *     // !!! DO PAINTING HERE !!! //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 *     //////////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 *     // Free the drawing surface info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 *     ds->FreeDrawingSurfaceInfo(dsi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 *     // Unlock the drawing surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 *     ds->Unlock(ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 *     // Free the drawing surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 *     awt.FreeDrawingSurface(ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * JAWT_Rectangle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * Structure for a native rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
typedef struct jawt_Rectangle {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    jint x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    jint y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    jint width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    jint height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
} JAWT_Rectangle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
struct jawt_DrawingSurface;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 * JAWT_DrawingSurfaceInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 * Structure for containing the underlying drawing information of a component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
typedef struct jawt_DrawingSurfaceInfo {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * Pointer to the platform-specific information.  This can be safely
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   161
     * JAWT_X11DrawingSurfaceInfo on Linux and Solaris. On Mac OS X this is a
21129
e1f4474a6723 8016096: [macosx] jawt_md.h shipped with jdk is outdated
dholmes
parents: 14342
diff changeset
   162
     * pointer to a NSObject that conforms to the JAWT_SurfaceLayers
e1f4474a6723 8016096: [macosx] jawt_md.h shipped with jdk is outdated
dholmes
parents: 14342
diff changeset
   163
     * protocol. See jawt_md.h for details.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    void* platformInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    /* Cached pointer to the underlying drawing surface */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    struct jawt_DrawingSurface* ds;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    /* Bounding rectangle of the drawing surface */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    JAWT_Rectangle bounds;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    /* Number of rectangles in the clip */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    jint clipSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    /* Clip rectangle array */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    JAWT_Rectangle* clip;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
} JAWT_DrawingSurfaceInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
#define JAWT_LOCK_ERROR                 0x00000001
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
#define JAWT_LOCK_CLIP_CHANGED          0x00000002
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
#define JAWT_LOCK_BOUNDS_CHANGED        0x00000004
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
#define JAWT_LOCK_SURFACE_CHANGED       0x00000008
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * JAWT_DrawingSurface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * Structure for containing the underlying drawing information of a component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 * All operations on a JAWT_DrawingSurface MUST be performed from the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 * thread as the call to GetDrawingSurface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
typedef struct jawt_DrawingSurface {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * Cached reference to the Java environment of the calling thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * If Lock(), Unlock(), GetDrawingSurfaceInfo() or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * FreeDrawingSurfaceInfo() are called from a different thread,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * this data member should be set before calling those functions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    JNIEnv* env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    /* Cached reference to the target object */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    jobject target;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * Lock the surface of the target component for native rendering.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * When finished drawing, the surface must be unlocked with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * Unlock().  This function returns a bitmask with one or more of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * following values:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * JAWT_LOCK_ERROR - When an error has occurred and the surface could not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * be locked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    jint (JNICALL *Lock)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        (struct jawt_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * Get the drawing surface info.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * The value returned may be cached, but the values may change if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * additional calls to Lock() or Unlock() are made.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * Lock() must be called before this can return a valid value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * Returns NULL if an error has occurred.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * When finished with the returned value, FreeDrawingSurfaceInfo must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        (struct jawt_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * Free the drawing surface info.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    void (JNICALL *FreeDrawingSurfaceInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        (JAWT_DrawingSurfaceInfo* dsi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * Unlock the drawing surface of the target component for native rendering.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    void (JNICALL *Unlock)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        (struct jawt_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
} JAWT_DrawingSurface;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
 * JAWT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
 * Structure for containing native AWT functions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
typedef struct jawt {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * Version of this structure.  This must always be set before
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   244
     * calling JAWT_GetAWT(). It affects the functions returned.
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   245
     * Must be one of the known pre-defined versions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    jint version;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Return a drawing surface from a target jobject.  This value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * may be cached.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * Returns NULL if an error has occurred.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * Target must be a java.awt.Component (should be a Canvas
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * or Window for native rendering).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * FreeDrawingSurface() must be called when finished with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * returned JAWT_DrawingSurface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        (JNIEnv* env, jobject target);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * Free the drawing surface allocated in GetDrawingSurface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    void (JNICALL *FreeDrawingSurface)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        (JAWT_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * Since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * Locks the entire AWT for synchronization purposes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    void (JNICALL *Lock)(JNIEnv* env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * Since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * Unlocks the entire AWT for synchronization purposes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    void (JNICALL *Unlock)(JNIEnv* env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * Since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * Returns a reference to a java.awt.Component from a native
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * platform handle.  On Windows, this corresponds to an HWND;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * on Solaris and Linux, this is a Drawable.  For other platforms,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * see the appropriate machine-dependent header file for a description.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * The reference returned by this function is a local
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * reference that is only valid in this environment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * This function returns a NULL reference if no component could be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * found with matching platform information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
40708
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   287
    /**
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   288
     * Since 9
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   289
     * Creates a java.awt.Frame placed in a native container. Container is
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   290
     * referenced by the native platform handle. For example on Windows this
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   291
     * corresponds to an HWND. For other platforms, see the appropriate
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   292
     * machine-dependent header file for a description. The reference returned
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   293
     * by this function is a local reference that is only valid in this
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   294
     * environment. This function returns a NULL reference if no frame could be
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   295
     * created with matching platform information.
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   296
     */
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   297
    jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo);
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   298
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   299
    /**
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   300
     * Since 9
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   301
     * Moves and resizes the embedded frame. The new location of the top-left
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   302
     * corner is specified by x and y parameters relative to the native parent
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   303
     * component. The new size is specified by width and height.
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   304
     *
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   305
     * The embedded frame should be created by CreateEmbeddedFrame() method, or
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   306
     * this function will not have any effect.
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   307
     *
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   308
     * java.awt.Component.setLocation() and java.awt.Component.setBounds() for
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   309
     * EmbeddedFrame really don't move it within the native parent. These
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   310
     * methods always locate the embedded frame at (0, 0) for backward
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   311
     * compatibility. To allow moving embedded frames this method was
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   312
     * introduced, and it works just the same way as setLocation() and
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   313
     * setBounds() for usual, non-embedded components.
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   314
     *
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   315
     * Using usual get/setLocation() and get/setBounds() together with this new
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   316
     * method is not recommended.
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   317
     */
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   318
    void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame,
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   319
            jint x, jint y, jint w, jint h);
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   320
    /**
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   321
     * Since 9
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   322
     * Synthesize a native message to activate or deactivate an EmbeddedFrame
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   323
     * window depending on the value of parameter doActivate, if "true"
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   324
     * activates the window; otherwise, deactivates the window.
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   325
     *
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   326
     * The embedded frame should be created by CreateEmbeddedFrame() method, or
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   327
     * this function will not have any effect.
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   328
     */
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   329
    void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env,
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   330
            jobject embeddedFrame, jboolean doActivate);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
} JAWT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
 * Get the AWT native structure.  This function returns JNI_FALSE if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
 * an error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
_JNI_IMPORT_OR_EXPORT_
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
45017
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   340
/*
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   341
 * Specify one of these constants as the JAWT.version
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   342
 * Specifying an earlier version will limit the available functions to
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   343
 * those provided in that earlier version of JAWT.
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   344
 * See the "Since" note on each API. Methods with no "Since"
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   345
 * may be presumed to be present in JAWT_VERSION_1_3.
7bd7767129ed 8179365: JAWT (AWT Native Interface) specification needs to be updated for JDK 9
prr
parents: 40708
diff changeset
   346
 */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
#define JAWT_VERSION_1_3 0x00010003
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
#define JAWT_VERSION_1_4 0x00010004
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
   349
#define JAWT_VERSION_1_7 0x00010007
40708
2516b180bfc0 8148109: [SWT] Provide a supported mechanism to use EmbeddedFrame
serb
parents: 25859
diff changeset
   350
#define JAWT_VERSION_9 0x00090000
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
} /* extern "C" */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
#endif /* !_JAVASOFT_JAWT_H_ */