From 16a0edae1622c2369e1cffee6947b261a400c46f Mon Sep 17 00:00:00 2001 From: dholmes Date: Thu, 24 Oct 2013 20:46:23 -0400 Subject: [PATCH] 8016096: [macosx] jawt_md.h shipped with jdk is outdated Summary: Revised build system and added platform specific headers for Mac OS X Reviewed-by: anthony, art, ihse, erikj Contributed-by: david.dehaven@oracle.com --- makefiles/CopyFiles.gmk | 2 +- makefiles/gensrc/GensrcX11Wrappers.gmk | 2 +- src/macosx/javavm/export/jawt_md.h | 77 +++++++++++++++++++ src/macosx/javavm/export/jni_md.h | 42 ++++++++++ src/macosx/javavm/export/jvm_md.h | 81 ++++++++++++++++++++ src/macosx/native/sun/awt/AWTSurfaceLayers.h | 3 +- src/macosx/native/sun/awt/CMenuComponent.h | 2 +- src/macosx/native/sun/awt/jawt.m | 3 +- src/macosx/native/sun/font/CoreTextSupport.h | 2 +- src/share/javavm/export/jawt.h | 4 +- 10 files changed, 209 insertions(+), 9 deletions(-) create mode 100644 src/macosx/javavm/export/jawt_md.h create mode 100644 src/macosx/javavm/export/jni_md.h create mode 100644 src/macosx/javavm/export/jvm_md.h diff --git a/makefiles/CopyFiles.gmk b/makefiles/CopyFiles.gmk index 02bafafbb..0ac509cc7 100644 --- a/makefiles/CopyFiles.gmk +++ b/makefiles/CopyFiles.gmk @@ -48,7 +48,7 @@ H_TARGET_FILES = $(INCLUDEDIR)/jdwpTransport.h \ $(INCLUDEDIR)/%.h: $(JDK_TOPDIR)/src/share/javavm/export/%.h $(call install-file) -$(OPENJDK_TARGET_OS_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export/%.h +$(OPENJDK_TARGET_OS_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_EXPORT_DIR)/javavm/export/%.h $(call install-file) COPY_FILES = $(H_TARGET_FILES) diff --git a/makefiles/gensrc/GensrcX11Wrappers.gmk b/makefiles/gensrc/GensrcX11Wrappers.gmk index c6f7da80f..4da4f37b2 100644 --- a/makefiles/gensrc/GensrcX11Wrappers.gmk +++ b/makefiles/gensrc/GensrcX11Wrappers.gmk @@ -99,7 +99,7 @@ ifneq ($(COMPILE_TYPE), cross) $(X_LIBS) \ -I$(JDK_OUTPUTDIR)/include \ -I$(JDK_TOPDIR)/src/share/javavm/export \ - -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \ + -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_EXPORT_DIR)/javavm/export \ -I$(JDK_TOPDIR)/src/share/native/common \ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \ -I$(JDK_TOPDIR)/src/solaris/native/sun/awt \ diff --git a/src/macosx/javavm/export/jawt_md.h b/src/macosx/javavm/export/jawt_md.h new file mode 100644 index 000000000..1d66461bf --- /dev/null +++ b/src/macosx/javavm/export/jawt_md.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1999, 2013 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#ifndef _JAVASOFT_JAWT_MD_H_ +#define _JAVASOFT_JAWT_MD_H_ + +#include "jawt.h" + +#ifdef __OBJC__ +#import +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Mac OS X specific declarations for AWT native interface. + * See notes in jawt.h for an example of use. + */ + +/* + * When calling JAWT_GetAWT with a JAWT version less than 1.7, you must pass this + * flag or you will not be able to get a valid drawing surface and JAWT_GetAWT will + * return false. This is to maintain compatibility with applications that used the + * interface with Java 6 which had multiple rendering models. This flag is not necessary + * when JAWT version 1.7 or greater is used as this is the only supported rendering mode. + * + * Example: + * JAWT awt; + * awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER; + * jboolean success = JAWT_GetAWT(env, &awt); + */ +#define JAWT_MACOSX_USE_CALAYER 0x80000000 + +/* + * When the native Cocoa toolkit is in use, the pointer stored in + * JAWT_DrawingSurfaceInfo->platformInfo points to a NSObject that conforms to the + * JAWT_SurfaceLayers protocol. Setting the layer property of this object will cause the + * specified layer to be overlaid on the Components rectangle. If the window the + * Component belongs to has a CALayer attached to it, this layer will be accessible via + * the windowLayer property. + */ +#ifdef __OBJC__ +@protocol JAWT_SurfaceLayers +@property (readwrite, retain) CALayer *layer; +@property (readonly) CALayer *windowLayer; +@end +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !_JAVASOFT_JAWT_MD_H_ */ diff --git a/src/macosx/javavm/export/jni_md.h b/src/macosx/javavm/export/jni_md.h new file mode 100644 index 000000000..9e47bedd6 --- /dev/null +++ b/src/macosx/javavm/export/jni_md.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#ifndef _JAVASOFT_JNI_MD_H_ +#define _JAVASOFT_JNI_MD_H_ + +#define JNIEXPORT __attribute__((visibility("default"))) +#define JNIIMPORT __attribute__((visibility("default"))) +#define JNICALL + +typedef int jint; +#ifdef _LP64 /* 64-bit */ +typedef long jlong; +#else +typedef long long jlong; +#endif + +typedef signed char jbyte; + +#endif /* !_JAVASOFT_JNI_MD_H_ */ diff --git a/src/macosx/javavm/export/jvm_md.h b/src/macosx/javavm/export/jvm_md.h new file mode 100644 index 000000000..012bb1bab --- /dev/null +++ b/src/macosx/javavm/export/jvm_md.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#ifndef _JAVASOFT_JVM_MD_H_ +#define _JAVASOFT_JVM_MD_H_ + +/* + * This file is currently collecting system-specific dregs for the + * JNI conversion, which should be sorted out later. + */ + +#include /* For DIR */ +#include /* For MAXPATHLEN */ +#include /* For F_OK, R_OK, W_OK */ +#include /* For ptrdiff_t */ +#include /* For uintptr_t */ + +#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"} +#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"} + +#define JNI_LIB_PREFIX "lib" +#define JNI_LIB_SUFFIX ".dylib" +#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME "." VERSION JNI_LIB_SUFFIX +#define JNI_LIB_NAME(NAME) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX + +#define JVM_MAXPATHLEN MAXPATHLEN + +#define JVM_R_OK R_OK +#define JVM_W_OK W_OK +#define JVM_X_OK X_OK +#define JVM_F_OK F_OK + +/* + * File I/O + */ + +#include +#include +#include +#include +#include + +/* O Flags */ + +#define JVM_O_RDONLY O_RDONLY +#define JVM_O_WRONLY O_WRONLY +#define JVM_O_RDWR O_RDWR +#define JVM_O_O_APPEND O_APPEND +#define JVM_O_EXCL O_EXCL +#define JVM_O_CREAT O_CREAT +#define JVM_O_DELETE 0x10000 + +/* Signals */ + +#define JVM_SIGINT SIGINT +#define JVM_SIGTERM SIGTERM + + +#endif /* !_JAVASOFT_JVM_MD_H_ */ diff --git a/src/macosx/native/sun/awt/AWTSurfaceLayers.h b/src/macosx/native/sun/awt/AWTSurfaceLayers.h index 820be3773..58aec0b61 100644 --- a/src/macosx/native/sun/awt/AWTSurfaceLayers.h +++ b/src/macosx/native/sun/awt/AWTSurfaceLayers.h @@ -23,8 +23,7 @@ * questions. */ -// REMIND: import -#import +#import /* * The CALayer-based rendering model returns an object conforming diff --git a/src/macosx/native/sun/awt/CMenuComponent.h b/src/macosx/native/sun/awt/CMenuComponent.h index 2e0a64542..e5aff96c4 100644 --- a/src/macosx/native/sun/awt/CMenuComponent.h +++ b/src/macosx/native/sun/awt/CMenuComponent.h @@ -24,7 +24,7 @@ */ #import -#import +#import @interface CMenuComponent : NSObject { diff --git a/src/macosx/native/sun/awt/jawt.m b/src/macosx/native/sun/awt/jawt.m index c295665fb..96669ef6e 100644 --- a/src/macosx/native/sun/awt/jawt.m +++ b/src/macosx/native/sun/awt/jawt.m @@ -25,8 +25,7 @@ #import -// REMIND: import -#import +#import #import "awt_DrawingSurface.h" diff --git a/src/macosx/native/sun/font/CoreTextSupport.h b/src/macosx/native/sun/font/CoreTextSupport.h index 037354492..467694d57 100644 --- a/src/macosx/native/sun/font/CoreTextSupport.h +++ b/src/macosx/native/sun/font/CoreTextSupport.h @@ -24,7 +24,7 @@ */ #import -#import +#import #import #include "AWTFont.h" diff --git a/src/share/javavm/export/jawt.h b/src/share/javavm/export/jawt.h index be443a319..eb7fe4f15 100644 --- a/src/share/javavm/export/jawt.h +++ b/src/share/javavm/export/jawt.h @@ -154,7 +154,9 @@ typedef struct jawt_DrawingSurfaceInfo { /* * Pointer to the platform-specific information. This can be safely * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a - * JAWT_X11DrawingSurfaceInfo on Solaris. See jawt_md.h for details. + * JAWT_X11DrawingSurfaceInfo on Solaris. On Mac OS X this is a + * pointer to a NSObject that conforms to the JAWT_SurfaceLayers + * protocol. See jawt_md.h for details. */ void* platformInfo; /* Cached pointer to the underlying drawing surface */ -- GitLab