提交 865548ae 编写于 作者: D dholmes

8025673: [macosx] Disable X11 AWT toolkit

Summary: Disable but not completely remove the XAWT and headless toolkits on Mac OS X
Reviewed-by: anthony, art, ihse, erikj
Contributed-by: david.dehaven@oracle.com
上级 16a0edae
...@@ -96,11 +96,7 @@ ifneq ($(OPENJDK_TARGET_OS), solaris) ...@@ -96,11 +96,7 @@ ifneq ($(OPENJDK_TARGET_OS), solaris)
EXCLUDES += com/oracle/security EXCLUDES += com/oracle/security
endif endif
# In the old build, this isn't excluded on macosx, even though it probably EXFILES += WrapperGenerator.java
# should be.
ifneq ($(OPENJDK_TARGET_OS), macosx)
EXFILES += WrapperGenerator.java
endif
ifneq ($(OPENJDK_TARGET_OS), windows) ifneq ($(OPENJDK_TARGET_OS), windows)
# Exclude Window security related files in src/share/classes # Exclude Window security related files in src/share/classes
...@@ -169,7 +165,11 @@ ifeq (, $(filter $(OPENJDK_TARGET_OS), windows macosx)) ...@@ -169,7 +165,11 @@ ifeq (, $(filter $(OPENJDK_TARGET_OS), windows macosx))
EXFILES += sun/awt/AWTCharset.java EXFILES += sun/awt/AWTCharset.java
endif endif
ifneq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
# exclude all X11 on Mac, we can't exclude some like below or we'll have compilation errors
EXCLUDES += sun/awt/X11
else
# TBD: figure out how to eliminate this long list
EXFILES += sun/awt/X11/ScreenFormat.java \ EXFILES += sun/awt/X11/ScreenFormat.java \
sun/awt/X11/XArc.java \ sun/awt/X11/XArc.java \
sun/awt/X11/XChar2b.java \ sun/awt/X11/XChar2b.java \
......
...@@ -66,15 +66,17 @@ include gensrc/GensrcExceptions.gmk ...@@ -66,15 +66,17 @@ include gensrc/GensrcExceptions.gmk
GENSRC += $(GENSRC_EXCEPTIONS) GENSRC += $(GENSRC_EXCEPTIONS)
ifneq ($(OPENJDK_TARGET_OS), windows) ifneq ($(OPENJDK_TARGET_OS), windows)
include gensrc/GensrcIcons.gmk include gensrc/GensrcIcons.gmk
GENSRC += $(GENSRC_AWT_ICONS) GENSRC += $(GENSRC_AWT_ICONS)
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
GENSRC += $(GENSRC_OSX_ICONS) GENSRC += $(GENSRC_OSX_ICONS)
endif endif
include gensrc/GensrcX11Wrappers.gmk ifneq ($(OPENJDK_TARGET_OS), macosx)
GENSRC += $(GENSRC_X11WRAPPERS) include gensrc/GensrcX11Wrappers.gmk
GENSRC += $(GENSRC_X11WRAPPERS)
endif
endif endif
include gensrc/GensrcCLDR.gmk include gensrc/GensrcCLDR.gmk
......
...@@ -32,7 +32,7 @@ TOOLS_SRC := $(JDK_TOPDIR)/make/tools/src \ ...@@ -32,7 +32,7 @@ TOOLS_SRC := $(JDK_TOPDIR)/make/tools/src \
$(JDK_TOPDIR)/makefiles/sun/osxapp \ $(JDK_TOPDIR)/makefiles/sun/osxapp \
$(JDK_TOPDIR)/make/tools/swing-beans $(JDK_TOPDIR)/make/tools/swing-beans
ifneq ($(OPENJDK_TARGET_OS), windows) ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
TOOLS_SRC += $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator TOOLS_SRC += $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
endif endif
......
...@@ -226,7 +226,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) ...@@ -226,7 +226,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/d3d $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/d3d
else else ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBAWT_DIRS += \ LIBAWT_DIRS += \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11 $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11
endif endif
...@@ -509,15 +509,7 @@ BUILD_LIBRARIES += $(BUILD_LIBAWT) ...@@ -509,15 +509,7 @@ BUILD_LIBRARIES += $(BUILD_LIBAWT)
########################################################################################## ##########################################################################################
# TODO!! ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
# Even though this variable as a general name, it is
# only used on macos, in fontpath.c, as prefix for where to find fonts.
#
# It's used for libawt_headless _and_ libawt_xawt
#
X11_PATH := /usr/X11R6
ifneq ($(OPENJDK_TARGET_OS), windows)
ifndef BUILD_HEADLESS_ONLY ifndef BUILD_HEADLESS_ONLY
LIBAWT_XAWT_DIRS := \ LIBAWT_XAWT_DIRS := \
...@@ -532,7 +524,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows) ...@@ -532,7 +524,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/xawt \ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/xawt \
LIBAWT_XAWT_CFLAGS := -DXAWT -DXAWT_HACK \ LIBAWT_XAWT_CFLAGS := -DXAWT -DXAWT_HACK \
-DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \ -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
$(CUPS_CFLAGS) \ $(CUPS_CFLAGS) \
$(foreach dir, $(LIBAWT_XAWT_DIRS), -I$(dir)) \ $(foreach dir, $(LIBAWT_XAWT_DIRS), -I$(dir)) \
-I$(JDK_TOPDIR)/src/share/native/sun/java2d \ -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
...@@ -627,11 +619,6 @@ ifneq ($(OPENJDK_TARGET_OS), windows) ...@@ -627,11 +619,6 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
LIBAWT_XAWT_LDFLAGS += -lpthread LIBAWT_XAWT_LDFLAGS += -lpthread
endif endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBAWT_XAWT_LDFLAGS_SUFFIX += -lpthread
endif
# On macosx, the shared library origin is set twice for this lib.
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
LIBRARY := awt_xawt, \ LIBRARY := awt_xawt, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
...@@ -653,10 +640,6 @@ ifneq ($(OPENJDK_TARGET_OS), windows) ...@@ -653,10 +640,6 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
-R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \ -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
$(call SET_SHARED_LIBRARY_ORIGIN) \ $(call SET_SHARED_LIBRARY_ORIGIN) \
$(call SET_SHARED_LIBRARY_ORIGIN,/..), \ $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN) \
$(call SET_SHARED_LIBRARY_ORIGIN). \
$(call SET_SHARED_LIBRARY_ORIGIN) \
$(call SET_SHARED_LIBRARY_ORIGIN)., \
LDFLAGS_SUFFIX := $(LIBAWT_XAWT_LDFLAGS_SUFFIX), \ LDFLAGS_SUFFIX := $(LIBAWT_XAWT_LDFLAGS_SUFFIX), \
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
RC_FLAGS := $(RC_FLAGS) \ RC_FLAGS := $(RC_FLAGS) \
...@@ -788,6 +771,11 @@ ifeq ($(OPENJDK_TARGET_OS), windows) ...@@ -788,6 +771,11 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \ LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
X11TextRenderer.c X11TextRenderer.c
LIBFONTMANAGER_OPTIMIZATION := HIGHEST LIBFONTMANAGER_OPTIMIZATION := HIGHEST
else ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
X11TextRenderer.c \
fontpath.c \
lcdglyph.c
else else
LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \ LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
lcdglyph.c lcdglyph.c
...@@ -845,7 +833,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \ ...@@ -845,7 +833,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT) $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris macosx)) ifeq ($(OPENJDK_TARGET_OS), solaris)
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_XAWT) $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_XAWT)
endif endif
...@@ -947,22 +935,21 @@ ifeq ($(OPENJDK_TARGET_OS), windows) ...@@ -947,22 +935,21 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
else # OPENJDK_TARGET_OS not windows else # OPENJDK_TARGET_OS not windows
JAWT_LIBS :=
ifneq ($(OPENJDK_TARGET_OS), solaris)
JAWT_LIBS += -lawt
endif
ifndef BUILD_HEADLESS_ONLY
JAWT_LIBS += -lawt_xawt
else
JAWT_LIBS += -lawt_headless
HEADLESS_CFLAG += -DHEADLESS
endif
JAWT_FILES := jawt.c
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
JAWT_FILES := jawt.m JAWT_FILES := jawt.m
JAWT_LIBS := -lawt_lwawt JAWT_LIBS := -lawt_lwawt
else
JAWT_FILES := jawt.c
JAWT_LIBS :=
ifneq ($(OPENJDK_TARGET_OS), solaris)
JAWT_LIBS += -lawt
endif
ifndef BUILD_HEADLESS_ONLY
JAWT_LIBS += -lawt_xawt
else
JAWT_LIBS += -lawt_headless
HEADLESS_CFLAG += -DHEADLESS
endif
endif endif
$(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \ $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
...@@ -1094,7 +1081,8 @@ endif ...@@ -1094,7 +1081,8 @@ endif
########################################################################################## ##########################################################################################
ifeq ($(BUILD_HEADLESS), true) ifeq ($(BUILD_HEADLESS), true)
ifneq ($(OPENJDK_TARGET_OS), windows) # Mac and Windows only use the native AWT lib, do not build libawt_headless
ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/share/native/sun/font \ LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/share/native/sun/font \
$(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \ $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
...@@ -1108,7 +1096,7 @@ ifeq ($(BUILD_HEADLESS), true) ...@@ -1108,7 +1096,7 @@ ifeq ($(BUILD_HEADLESS), true)
endif endif
LIBAWT_HEADLESS_CFLAGS := -DHEADLESS=true \ LIBAWT_HEADLESS_CFLAGS := -DHEADLESS=true \
-DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \ -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
$(CUPS_CFLAGS) \ $(CUPS_CFLAGS) \
$(X_CFLAGS) \ $(X_CFLAGS) \
-I$(JDK_TOPDIR)/src/share/native/sun/java2d \ -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
...@@ -1155,16 +1143,6 @@ ifeq ($(BUILD_HEADLESS), true) ...@@ -1155,16 +1143,6 @@ ifeq ($(BUILD_HEADLESS), true)
AccelGlyphCache.c \ AccelGlyphCache.c \
CUPSfuncs.c CUPSfuncs.c
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBAWT_HEADLESS_FILES += \
AWTFont.m \
AWTStrike.m \
CCharToGlyphMapper.m \
CGGlyphImages.m \
CGGlyphOutlines.m \
CoreTextSupport.m
endif
LIBAWT_HEADLESS_REORDER := LIBAWT_HEADLESS_REORDER :=
ifeq ($(OPENJDK_TARGET_OS), solaris) ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64) ifneq ($(OPENJDK_TARGET_CPU), x86_64)
...@@ -1191,13 +1169,6 @@ ifeq ($(BUILD_HEADLESS), true) ...@@ -1191,13 +1169,6 @@ ifeq ($(BUILD_HEADLESS), true)
REORDER := $(LIBAWT_HEADLESS_REORDER), \ REORDER := $(LIBAWT_HEADLESS_REORDER), \
LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \ LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \ LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
LDFLAGS_SUFFIX_macosx := -ljvm $(LIBCXX) -lawt $(LIBDL) -ljava \
-framework Accelerate \
-framework ApplicationServices \
-framework Cocoa \
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-framework JavaNativeFoundation \
-framework JavaRuntimeSupport, \
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_headless, \ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_headless, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
......
...@@ -206,6 +206,11 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props) ...@@ -206,6 +206,11 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
if (sprops->awt_toolkit) { if (sprops->awt_toolkit) {
PUTPROP(props, "awt.toolkit", sprops->awt_toolkit); PUTPROP(props, "awt.toolkit", sprops->awt_toolkit);
} }
#ifdef MACOSX
if (sprops->awt_headless) {
PUTPROP(props, "java.awt.headless", sprops->awt_headless);
}
#endif
/* os properties */ /* os properties */
PUTPROP(props, "os.name", sprops->os_name); PUTPROP(props, "os.name", sprops->os_name);
......
...@@ -116,6 +116,8 @@ typedef struct { ...@@ -116,6 +116,8 @@ typedef struct {
char *gopherPort; char *gopherPort;
char *exceptionList; char *exceptionList;
char *awt_headless /* java.awt.headless setting, if NULL (default) will not be set */
#endif #endif
} java_props_t; } java_props_t;
......
...@@ -105,40 +105,17 @@ char *setupMacOSXLocale(int cat) { ...@@ -105,40 +105,17 @@ char *setupMacOSXLocale(int cat) {
} }
} }
/* There are several toolkit options on Mac OS X, so we should try to int isInAquaSession() {
* pick the "best" one, given what we know about the environment Java
* is running under
*/
static PreferredToolkit getPreferredToolkitFromEnv() {
char *envVar = getenv("AWT_TOOLKIT");
if (envVar == NULL) return unset;
if (strcasecmp(envVar, "CToolkit") == 0) return CToolkit;
if (strcasecmp(envVar, "XToolkit") == 0) return XToolkit;
if (strcasecmp(envVar, "HToolkit") == 0) return HToolkit;
return unset;
}
static bool isInAquaSession() {
// Is the WindowServer available? // Is the WindowServer available?
SecuritySessionId session_id; SecuritySessionId session_id;
SessionAttributeBits session_info; SessionAttributeBits session_info;
OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info); OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info);
if (status != noErr) return false; if (status == noErr) {
if (!(session_info & sessionHasGraphicAccess)) return false; if (session_info & sessionHasGraphicAccess) {
return true; return 1;
} }
}
PreferredToolkit getPreferredToolkit() { return 0;
static PreferredToolkit pref = unset;
if (pref != unset) return pref;
PreferredToolkit prefFromEnv = getPreferredToolkitFromEnv();
if (prefFromEnv != unset) return pref = prefFromEnv;
if (isInAquaSession()) return pref = CToolkit;
return pref = HToolkit;
} }
void setOSNameAndVersion(java_props_t *sprops) { void setOSNameAndVersion(java_props_t *sprops) {
......
...@@ -29,10 +29,4 @@ char *setupMacOSXLocale(int cat); ...@@ -29,10 +29,4 @@ char *setupMacOSXLocale(int cat);
void setOSNameAndVersion(java_props_t *sprops); void setOSNameAndVersion(java_props_t *sprops);
void setUserHome(java_props_t *sprops); void setUserHome(java_props_t *sprops);
void setProxyProperties(java_props_t *sProps); void setProxyProperties(java_props_t *sProps);
int isInAquaSession();
enum PreferredToolkit_enum {
unset = 0, CToolkit, XToolkit, HToolkit
};
typedef enum PreferredToolkit_enum PreferredToolkit;
PreferredToolkit getPreferredToolkit();
...@@ -454,40 +454,21 @@ GetJavaProperties(JNIEnv *env) ...@@ -454,40 +454,21 @@ GetJavaProperties(JNIEnv *env)
/* patches/service packs installed */ /* patches/service packs installed */
sprops.patch_level = "unknown"; sprops.patch_level = "unknown";
/* Java 2D properties */ /* Java 2D/AWT properties */
#ifdef MACOSX #ifdef MACOSX
PreferredToolkit prefToolkit = getPreferredToolkit(); // Always the same GraphicsEnvironment and Toolkit on Mac OS X
switch (prefToolkit) { sprops.graphics_env = "sun.awt.CGraphicsEnvironment";
case CToolkit: sprops.awt_toolkit = "sun.lwawt.macosx.LWCToolkit";
case HToolkit:
sprops.graphics_env = "sun.awt.CGraphicsEnvironment"; // check if we're in a GUI login session and set java.awt.headless=true if not
break; sprops.awt_headless = isInAquaSession() ? NULL : "true";
case XToolkit: #else
#endif
sprops.graphics_env = "sun.awt.X11GraphicsEnvironment"; sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
#ifdef MACOSX
break;
}
#endif
/* AWT properties */
#ifdef JAVASE_EMBEDDED #ifdef JAVASE_EMBEDDED
sprops.awt_toolkit = getEmbeddedToolkit(); sprops.awt_toolkit = getEmbeddedToolkit();
if (sprops.awt_toolkit == NULL) // default as below if (sprops.awt_toolkit == NULL) // default as below
#endif
#ifdef MACOSX
switch (prefToolkit) {
case CToolkit:
sprops.awt_toolkit = "sun.lwawt.macosx.LWCToolkit";
break;
case XToolkit:
#endif #endif
sprops.awt_toolkit = "sun.awt.X11.XToolkit"; sprops.awt_toolkit = "sun.awt.X11.XToolkit";
#ifdef MACOSX
break;
default:
sprops.awt_toolkit = "sun.awt.HToolkit";
break;
}
#endif #endif
/* This is used only for debugging of font problems. */ /* This is used only for debugging of font problems. */
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* questions. * questions.
*/ */
#if defined(__linux__) || defined(MACOSX) #if defined(__linux__)
#include <string.h> #include <string.h>
#endif /* __linux__ */ #endif /* __linux__ */
#include <stdio.h> #include <stdio.h>
...@@ -59,26 +59,12 @@ ...@@ -59,26 +59,12 @@
extern Display *awt_display; extern Display *awt_display;
#endif /* !HEADLESS */ #endif /* !HEADLESS */
#ifdef MACOSX
//
// XXXDARWIN: Hard-code the path to Apple's fontconfig, as it is
// not included in the dyld search path by default, and 10.4
// does not support -rpath.
//
// This ignores the build time setting of ALT_FREETYPE_LIB_PATH,
// and should be replaced with -rpath/@rpath support on 10.5 or later,
// or via support for a the FREETYPE_LIB_PATH define.
#define FONTCONFIG_DLL_VERSIONED X11_PATH "/lib/" VERSIONED_JNI_LIB_NAME("fontconfig", "1")
#define FONTCONFIG_DLL X11_PATH "/lib/" JNI_LIB_NAME("fontconfig")
#else
#define FONTCONFIG_DLL_VERSIONED VERSIONED_JNI_LIB_NAME("fontconfig", "1") #define FONTCONFIG_DLL_VERSIONED VERSIONED_JNI_LIB_NAME("fontconfig", "1")
#define FONTCONFIG_DLL JNI_LIB_NAME("fontconfig") #define FONTCONFIG_DLL JNI_LIB_NAME("fontconfig")
#endif
#define MAXFDIRS 512 /* Max number of directories that contain fonts */ #define MAXFDIRS 512 /* Max number of directories that contain fonts */
#if !defined(__linux__) && !defined(MACOSX) #if !defined(__linux__)
/* /*
* This can be set in the makefile to "/usr/X11" if so desired. * This can be set in the makefile to "/usr/X11" if so desired.
*/ */
...@@ -128,22 +114,6 @@ static char *fullSolarisFontPath[] = { ...@@ -128,22 +114,6 @@ static char *fullSolarisFontPath[] = {
NULL, /* terminates the list */ NULL, /* terminates the list */
}; };
#elif MACOSX
static char *full_MACOSX_X11FontPath[] = {
X11_PATH "/lib/X11/fonts/TrueType",
X11_PATH "/lib/X11/fonts/truetype",
X11_PATH "/lib/X11/fonts/tt",
X11_PATH "/lib/X11/fonts/TTF",
X11_PATH "/lib/X11/fonts/OTF",
PACKAGE_PATH "/share/fonts/TrueType",
PACKAGE_PATH "/share/fonts/truetype",
PACKAGE_PATH "/share/fonts/tt",
PACKAGE_PATH "/share/fonts/TTF",
PACKAGE_PATH "/share/fonts/OTF",
X11_PATH "/lib/X11/fonts/Type1",
PACKAGE_PATH "/share/fonts/Type1",
NULL, /* terminates the list */
};
#else /* __linux */ #else /* __linux */
/* All the known interesting locations we have discovered on /* All the known interesting locations we have discovered on
* various flavors of Linux * various flavors of Linux
...@@ -400,7 +370,7 @@ static char **getX11FontPath () ...@@ -400,7 +370,7 @@ static char **getX11FontPath ()
#endif /* !HEADLESS */ #endif /* !HEADLESS */
#if defined(__linux__) || defined(MACOSX) #if defined(__linux__)
/* from awt_LoadLibrary.c */ /* from awt_LoadLibrary.c */
JNIEXPORT jboolean JNICALL AWTIsHeadless(); JNIEXPORT jboolean JNICALL AWTIsHeadless();
#endif #endif
...@@ -527,8 +497,6 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) { ...@@ -527,8 +497,6 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
#if defined(__linux__) #if defined(__linux__)
knowndirs = fullLinuxFontPath; knowndirs = fullLinuxFontPath;
#elif defined(MACOSX)
knowndirs = full_MACOSX_X11FontPath;
#else /* IF SOLARIS */ #else /* IF SOLARIS */
knowndirs = fullSolarisFontPath; knowndirs = fullSolarisFontPath;
#endif #endif
...@@ -539,7 +507,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) { ...@@ -539,7 +507,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
* be initialised. * be initialised.
*/ */
#ifndef HEADLESS #ifndef HEADLESS
#if defined(__linux__) || defined(MACOSX) #if defined(__linux__)
/* There's no headless build on linux ... */ /* There's no headless build on linux ... */
if (!AWTIsHeadless()) { /* .. so need to call a function to check */ if (!AWTIsHeadless()) { /* .. so need to call a function to check */
#endif #endif
...@@ -555,7 +523,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) { ...@@ -555,7 +523,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
x11dirs = getX11FontPath(); x11dirs = getX11FontPath();
} }
AWT_UNLOCK(); AWT_UNLOCK();
#if defined(__linux__) || defined(MACOSX) #if defined(__linux__)
} }
#endif #endif
#endif /* !HEADLESS */ #endif /* !HEADLESS */
......
...@@ -77,6 +77,12 @@ case "$OS" in ...@@ -77,6 +77,12 @@ case "$OS" in
FILESEP="\\" FILESEP="\\"
;; ;;
Darwin)
VAR="Lets not forget about Mac"
DEFAULT_JDK=$(/usr/libexec/java_home)
FILESEP="/"
;;
# catch all other OSs # catch all other OSs
* ) * )
echo "Unrecognized system! $OS" echo "Unrecognized system! $OS"
...@@ -171,6 +177,22 @@ case "$OS" in ...@@ -171,6 +177,22 @@ case "$OS" in
fi fi
;; ;;
Darwin)
${TESTJAVA}/bin/java -Djava.awt.headless=true \
TestWrapped sun.lwawt.macosx.LWCToolkit
status=$?
if [ ! $status -eq "0" ]; then
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.lwawt.macosx.LWCToolkit";
fi
${TESTJAVA}/bin/java -Djava.awt.headless=true \
-Dawt.toolkit=sun.lwawt.macosx.LWCToolkit \
TestWrapped sun.lwawt.macosx.LWCToolkit
status=$?
if [ ! $status -eq "0" ]; then
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.lwawt.macosx.LWCToolkit";
fi
;;
esac esac
pass "All the tests are PASSED"; pass "All the tests are PASSED";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册