8242559: Clean the "libawt_xawt" library from code for headless mode

Reviewed-by: kizune
This commit is contained in:
Sergey Bylokhov 2020-10-23 01:51:44 +00:00
parent ff5f2265d2
commit d8d9197712
29 changed files with 149 additions and 197 deletions

@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include "jni_util.h"
#include "awt_p.h"
#include "awt.h"
@ -31,14 +35,12 @@
#include <sun_awt_X11GraphicsEnvironment.h>
#include <sun_awt_X11GraphicsDevice.h>
#include <sun_awt_X11GraphicsConfig.h>
#ifndef HEADLESS
#include <X11/extensions/Xdbe.h>
#include <X11/XKBlib.h>
#ifndef NO_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
#include "GLXGraphicsConfig.h"
#endif /* !HEADLESS */
#include <jni.h>
#include <jni_util.h>
@ -54,8 +56,6 @@
#include <dlfcn.h>
#include "Trace.h"
#ifndef HEADLESS
int awt_numScreens; /* Xinerama-aware number of screens */
AwtScreenDataPtr x11Screens;
@ -66,12 +66,6 @@ AwtScreenDataPtr x11Screens;
*/
static jboolean glxRequested = JNI_FALSE;
#endif /* !HEADLESS */
#ifdef HEADLESS
#define Display void
#endif /* HEADLESS */
Display *awt_display;
jclass tkClass = NULL;
@ -92,9 +86,7 @@ jboolean awtLockInited = JNI_FALSE;
struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
#ifndef HEADLESS
int awtCreateX11Colormap(AwtGraphicsConfigDataPtr adata);
#endif /* HEADLESS */
static char *x11GraphicsConfigClassName = "sun/awt/X11GraphicsConfig";
@ -134,8 +126,6 @@ Java_sun_awt_X11GraphicsConfig_initIDs (JNIEnv *env, jclass cls)
CHECK_NULL(x11GraphicsConfigIDs.bitsPerPixel);
}
#ifndef HEADLESS
/*
* XIOErrorHandler
*/
@ -593,8 +583,6 @@ cleanup:
AWT_UNLOCK ();
}
#ifndef HEADLESS
/*
* Checks if Xinerama is running and perform Xinerama-related initialization.
*/
@ -656,7 +644,6 @@ static void xineramaInit(void) {
DTRACE_PRINTLN1("\ncouldn't open shared library: %s\n", dlerror());
}
}
#endif /* HEADLESS */
Display *
awt_init_Display(JNIEnv *env, jobject this)
@ -733,7 +720,6 @@ awt_init_Display(JNIEnv *env, jobject this)
return dpy;
}
#endif /* !HEADLESS */
/*
* Class: sun_awt_X11GraphicsEnvironment
@ -744,14 +730,9 @@ JNIEXPORT jint JNICALL
Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum(
JNIEnv *env, jobject this)
{
#ifdef HEADLESS
return (jint)0;
#else
return DefaultScreen(awt_display);
#endif /* !HEADLESS */
}
#ifndef HEADLESS
static void ensureConfigsInited(JNIEnv* env, int screen) {
if (x11Screens[screen].numConfigs == 0) {
if (env == NULL) {
@ -760,19 +741,12 @@ static void ensureConfigsInited(JNIEnv* env, int screen) {
getAllConfigs (env, screen, &(x11Screens[screen]));
}
}
#endif
#ifdef HEADLESS
void* getDefaultConfig(int screen) {
return NULL;
}
#else
AwtGraphicsConfigDataPtr
getDefaultConfig(int screen) {
ensureConfigsInited(NULL, screen);
return x11Screens[screen].defaultConfig;
}
#endif /* !HEADLESS */
/*
* Class: sun_awt_X11GraphicsEnvironment
@ -783,10 +757,8 @@ JNIEXPORT void JNICALL
Java_sun_awt_X11GraphicsEnvironment_initDisplay(JNIEnv *env, jobject this,
jboolean glxReq)
{
#ifndef HEADLESS
glxRequested = glxReq;
(void) awt_init_Display(env, this);
#endif /* !HEADLESS */
}
/*
@ -797,7 +769,6 @@ Java_sun_awt_X11GraphicsEnvironment_initDisplay(JNIEnv *env, jobject this,
JNIEXPORT jboolean JNICALL
Java_sun_awt_X11GraphicsEnvironment_initGLX(JNIEnv *env, jclass x11ge)
{
#ifndef HEADLESS
jboolean glxAvailable;
AWT_LOCK();
@ -805,9 +776,6 @@ Java_sun_awt_X11GraphicsEnvironment_initGLX(JNIEnv *env, jclass x11ge)
AWT_UNLOCK();
return glxAvailable;
#else
return JNI_FALSE;
#endif /* !HEADLESS */
}
/*
@ -818,11 +786,7 @@ Java_sun_awt_X11GraphicsEnvironment_initGLX(JNIEnv *env, jclass x11ge)
JNIEXPORT jint JNICALL
Java_sun_awt_X11GraphicsEnvironment_getNumScreens(JNIEnv *env, jobject this)
{
#ifdef HEADLESS
return (jint)0;
#else
return awt_numScreens;
#endif /* !HEADLESS */
}
/*
@ -833,11 +797,7 @@ Java_sun_awt_X11GraphicsEnvironment_getNumScreens(JNIEnv *env, jobject this)
JNIEXPORT jlong JNICALL
Java_sun_awt_X11GraphicsDevice_getDisplay(JNIEnv *env, jobject this)
{
#ifdef HEADLESS
return NULL;
#else
return ptr_to_jlong(awt_display);
#endif /* !HEADLESS */
}
#ifdef MITSHM
@ -964,11 +924,7 @@ JNIEXPORT jstring JNICALL
Java_sun_awt_X11GraphicsEnvironment_getDisplayString
(JNIEnv *env, jobject this)
{
#ifdef HEADLESS
return (jstring)NULL;
#else
return (*env)->NewStringUTF(env, DisplayString(awt_display));
#endif /* HEADLESS */
}
@ -981,12 +937,8 @@ JNIEXPORT jint JNICALL
Java_sun_awt_X11GraphicsDevice_getNumConfigs(
JNIEnv *env, jobject this, jint screen)
{
#ifdef HEADLESS
return (jint)0;
#else
ensureConfigsInited(env, screen);
return x11Screens[screen].numConfigs;
#endif /* !HEADLESS */
}
/*
@ -998,9 +950,6 @@ JNIEXPORT jint JNICALL
Java_sun_awt_X11GraphicsDevice_getConfigVisualId(
JNIEnv *env, jobject this, jint index, jint screen)
{
#ifdef HEADLESS
return (jint)0;
#else
int visNum;
ensureConfigsInited(env, screen);
@ -1009,7 +958,6 @@ JNIEnv *env, jobject this, jint index, jint screen)
} else {
return ((jint)x11Screens[screen].configs[index]->awt_visInfo.visualid);
}
#endif /* !HEADLESS */
}
/*
@ -1021,9 +969,6 @@ JNIEXPORT jint JNICALL
Java_sun_awt_X11GraphicsDevice_getConfigDepth(
JNIEnv *env, jobject this, jint index, jint screen)
{
#ifdef HEADLESS
return (jint)0;
#else
int visNum;
ensureConfigsInited(env, screen);
@ -1032,7 +977,6 @@ JNIEnv *env, jobject this, jint index, jint screen)
} else {
return ((jint)x11Screens[screen].configs[index]->awt_visInfo.depth);
}
#endif /* !HEADLESS */
}
/*
@ -1044,9 +988,6 @@ JNIEXPORT jint JNICALL
Java_sun_awt_X11GraphicsDevice_getConfigColormap(
JNIEnv *env, jobject this, jint index, jint screen)
{
#ifdef HEADLESS
return (jint)0;
#else
int visNum;
ensureConfigsInited(env, screen);
@ -1055,7 +996,6 @@ JNIEnv *env, jobject this, jint index, jint screen)
} else {
return ((jint)x11Screens[screen].configs[index]->awt_cmap);
}
#endif /* !HEADLESS */
}
/*
@ -1067,7 +1007,6 @@ JNIEXPORT void JNICALL
Java_sun_awt_X11GraphicsDevice_resetNativeData
(JNIEnv *env, jclass x11gd, jint screen)
{
#ifndef HEADLESS
/*
* Reset references to the various configs; the actual native config data
* will be free'd later by the Disposer mechanism when the Java-level
@ -1081,7 +1020,6 @@ Java_sun_awt_X11GraphicsDevice_resetNativeData
}
x11Screens[screen].defaultConfig = NULL;
x11Screens[screen].numConfigs = 0;
#endif /* !HEADLESS */
}
/*
@ -1093,7 +1031,6 @@ JNIEXPORT void JNICALL
Java_sun_awt_X11GraphicsConfig_dispose
(JNIEnv *env, jclass x11gc, jlong configData)
{
#ifndef HEADLESS
AwtGraphicsConfigDataPtr aData = (AwtGraphicsConfigDataPtr)
jlong_to_ptr(configData);
@ -1135,7 +1072,6 @@ Java_sun_awt_X11GraphicsConfig_dispose
}
free(aData);
#endif /* !HEADLESS */
}
/*
@ -1147,12 +1083,8 @@ JNIEXPORT jdouble JNICALL
Java_sun_awt_X11GraphicsConfig_getXResolution(
JNIEnv *env, jobject this, jint screen)
{
#ifdef HEADLESS
return (jdouble)0;
#else
return ((DisplayWidth(awt_display, screen) * 25.4) /
DisplayWidthMM(awt_display, screen));
#endif /* !HEADLESS */
}
/*
@ -1164,12 +1096,8 @@ JNIEXPORT jdouble JNICALL
Java_sun_awt_X11GraphicsConfig_getYResolution(
JNIEnv *env, jobject this, jint screen)
{
#ifdef HEADLESS
return (jdouble)0;
#else
return ((DisplayHeight(awt_display, screen) * 25.4) /
DisplayHeightMM(awt_display, screen));
#endif /* !HEADLESS */
}
@ -1182,16 +1110,12 @@ JNIEXPORT jint JNICALL
Java_sun_awt_X11GraphicsConfig_getNumColors(
JNIEnv *env, jobject this)
{
#ifdef HEADLESS
return (jint)0;
#else
AwtGraphicsConfigData *adata;
adata = (AwtGraphicsConfigData *) JNU_GetLongFieldAsPtr(env, this,
x11GraphicsConfigIDs.aData);
return adata->awt_num_colors;
#endif /* !HEADLESS */
}
/*
@ -1203,7 +1127,6 @@ JNIEXPORT void JNICALL
Java_sun_awt_X11GraphicsConfig_init(
JNIEnv *env, jobject this, jint visualNum, jint screen)
{
#ifndef HEADLESS
AwtGraphicsConfigData *adata = NULL;
AwtScreenData asd = x11Screens[screen];
int i, n;
@ -1244,11 +1167,8 @@ JNIEnv *env, jobject this, jint visualNum, jint screen)
(*env)->SetIntField(env, this, x11GraphicsConfigIDs.bitsPerPixel,
(jint)tempImage->bits_per_pixel);
XDestroyImage(tempImage);
#endif /* !HEADLESS */
}
/*
* Class: sun_awt_X11GraphicsConfig
* Method: makeColorModel
@ -1258,9 +1178,6 @@ JNIEXPORT jobject JNICALL
Java_sun_awt_X11GraphicsConfig_makeColorModel(
JNIEnv *env, jobject this)
{
#ifdef HEADLESS
return NULL;
#else
AwtGraphicsConfigData *adata;
jobject colorModel;
@ -1289,7 +1206,6 @@ JNIEnv *env, jobject this)
AWT_UNLOCK ();
return colorModel;
#endif /* !HEADLESS */
}
@ -1301,9 +1217,6 @@ JNIEnv *env, jobject this)
JNIEXPORT jobject JNICALL
Java_sun_awt_X11GraphicsConfig_pGetBounds(JNIEnv *env, jobject this, jint screen)
{
#ifdef HEADLESS
return NULL;
#else
jclass clazz;
jmethodID mid;
jobject bounds = NULL;
@ -1362,7 +1275,6 @@ Java_sun_awt_X11GraphicsConfig_pGetBounds(JNIEnv *env, jobject this, jint screen
}
}
return bounds;
#endif /* !HEADLESS */
}
/*
@ -1438,15 +1350,11 @@ JNIEXPORT jboolean JNICALL
Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable
(JNIEnv *env, jobject this, jlong configData)
{
#ifdef HEADLESS
return JNI_FALSE;
#else
AwtGraphicsConfigDataPtr aData = (AwtGraphicsConfigDataPtr)jlong_to_ptr(configData);
if (aData == NULL) {
return JNI_FALSE;
}
return aData->isTranslucencySupported ? JNI_TRUE : JNI_FALSE;
#endif
}
/*
@ -1457,9 +1365,6 @@ Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable
JNIEXPORT jboolean JNICALL
Java_sun_awt_X11GraphicsDevice_isDBESupported(JNIEnv *env, jobject this)
{
#ifdef HEADLESS
return JNI_FALSE;
#else
int opcode = 0, firstEvent = 0, firstError = 0;
jboolean ret;
@ -1468,7 +1373,6 @@ Java_sun_awt_X11GraphicsDevice_isDBESupported(JNIEnv *env, jobject this)
&opcode, &firstEvent, &firstError);
AWT_FLUSH_UNLOCK();
return ret;
#endif /* !HEADLESS */
}
/*
@ -1480,7 +1384,6 @@ JNIEXPORT void JNICALL
Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals(JNIEnv *env,
jobject this, jint screen)
{
#ifndef HEADLESS
jclass clazz;
jmethodID midAddVisual;
Window rootWindow;
@ -1515,7 +1418,6 @@ Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals(JNIEnv *env,
break;
}
}
#endif /* !HEADLESS */
}
/*
@ -1527,19 +1429,13 @@ JNIEXPORT jboolean JNICALL
Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama(JNIEnv *env,
jobject this)
{
#ifdef HEADLESS
return JNI_FALSE;
#else
return usingXinerama ? JNI_TRUE : JNI_FALSE;
#endif /* HEADLESS */
}
/**
* Begin DisplayMode/FullScreen support
*/
#ifndef HEADLESS
#ifndef NO_XRANDR
#define BIT_DEPTH_MULTI java_awt_DisplayMode_BIT_DEPTH_MULTI
@ -1777,7 +1673,6 @@ X11GD_SetFullscreenMode(Window win, jboolean enabled)
&event);
XSync(awt_display, False);
}
#endif /* !HEADLESS */
/*
* Class: sun_awt_X11GraphicsDevice
@ -1788,7 +1683,7 @@ JNIEXPORT jboolean JNICALL
Java_sun_awt_X11GraphicsDevice_initXrandrExtension
(JNIEnv *env, jclass x11gd)
{
#if defined(HEADLESS) || defined(NO_XRANDR)
#if defined(NO_XRANDR)
return JNI_FALSE;
#else
int opcode = 0, firstEvent = 0, firstError = 0;
@ -1803,7 +1698,7 @@ Java_sun_awt_X11GraphicsDevice_initXrandrExtension
AWT_FLUSH_UNLOCK();
return ret;
#endif /* HEADLESS */
#endif /* NO_XRANDR */
}
/*
@ -1815,7 +1710,7 @@ JNIEXPORT jobject JNICALL
Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode
(JNIEnv* env, jclass x11gd, jint screen)
{
#if defined(HEADLESS) || defined(NO_XRANDR)
#if defined(NO_XRANDR)
return NULL;
#else
XRRScreenConfiguration *config;
@ -1898,7 +1793,7 @@ Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode
AWT_FLUSH_UNLOCK();
return displayMode;
#endif /* HEADLESS */
#endif /* NO_XRANDR */
}
/*
@ -1911,7 +1806,7 @@ Java_sun_awt_X11GraphicsDevice_enumDisplayModes
(JNIEnv* env, jclass x11gd,
jint screen, jobject arrayList)
{
#if !defined(HEADLESS) && !defined(NO_XRANDR)
#if !defined(NO_XRANDR)
AWT_LOCK();
@ -1986,7 +1881,7 @@ ret1:
}
AWT_FLUSH_UNLOCK();
#endif /* !HEADLESS */
#endif /* !NO_XRANDR */
}
/*
@ -1999,7 +1894,7 @@ Java_sun_awt_X11GraphicsDevice_configDisplayMode
(JNIEnv* env, jclass x11gd,
jint screen, jint width, jint height, jint refreshRate)
{
#if !defined(HEADLESS) && !defined(NO_XRANDR)
#if !defined(NO_XRANDR)
jboolean success = JNI_FALSE;
XRRScreenConfiguration *config;
Drawable root;
@ -2069,7 +1964,7 @@ Java_sun_awt_X11GraphicsDevice_configDisplayMode
if (!success && !(*env)->ExceptionCheck(env)) {
JNU_ThrowInternalError(env, "Could not set display mode");
}
#endif /* !HEADLESS */
#endif /* !NO_XRANDR */
}
/*
@ -2082,14 +1977,12 @@ Java_sun_awt_X11GraphicsDevice_enterFullScreenExclusive
(JNIEnv* env, jclass x11gd,
jlong window)
{
#ifndef HEADLESS
Window win = (Window)window;
AWT_LOCK();
XSync(awt_display, False); /* ensures window is visible first */
X11GD_SetFullscreenMode(win, JNI_TRUE);
AWT_UNLOCK();
#endif /* !HEADLESS */
}
/*
@ -2102,13 +1995,11 @@ Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive
(JNIEnv* env, jclass x11gd,
jlong window)
{
#ifndef HEADLESS
Window win = (Window)window;
AWT_LOCK();
X11GD_SetFullscreenMode(win, JNI_FALSE);
AWT_UNLOCK();
#endif /* !HEADLESS */
}
/**

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include "java_awt_Insets.h"
JNIEXPORT void JNICALL

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include "jni_util.h"
struct MenuComponentIDs {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@ -32,11 +36,8 @@
#include <sizecalc.h>
#include "sun_awt_UNIXToolkit.h"
#ifndef HEADLESS
#include "awt.h"
#include "gtk_interface.h"
#endif /* !HEADLESS */
static jclass this_class = NULL;
static jmethodID icon_upcall_method = NULL;
@ -49,11 +50,7 @@ static jmethodID icon_upcall_method = NULL;
*/
JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_check_1gtk(JNIEnv *env, jclass klass, jint version) {
#ifndef HEADLESS
return (jboolean)gtk_check_version(version);
#else
return JNI_FALSE;
#endif /* !HEADLESS */
}
@ -65,11 +62,7 @@ Java_sun_awt_UNIXToolkit_check_1gtk(JNIEnv *env, jclass klass, jint version) {
JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_load_1gtk(JNIEnv *env, jclass klass, jint version,
jboolean verbose) {
#ifndef HEADLESS
return (jboolean)gtk_load(env, version, verbose);
#else
return JNI_FALSE;
#endif /* !HEADLESS */
}
@ -81,11 +74,7 @@ Java_sun_awt_UNIXToolkit_load_1gtk(JNIEnv *env, jclass klass, jint version,
JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_unload_1gtk(JNIEnv *env, jclass klass)
{
#ifndef HEADLESS
return (jboolean)gtk->unload();
#else
return JNI_FALSE;
#endif /* !HEADLESS */
}
jboolean init_method(JNIEnv *env, jobject this)
@ -111,7 +100,6 @@ JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_load_1gtk_1icon(JNIEnv *env, jobject this,
jstring filename)
{
#ifndef HEADLESS
int len;
jsize jlen;
char *filename_str = NULL;
@ -142,9 +130,6 @@ Java_sun_awt_UNIXToolkit_load_1gtk_1icon(JNIEnv *env, jobject this,
free(filename_str);
return result;
#else /* HEADLESS */
return JNI_FALSE;
#endif /* !HEADLESS */
}
/*
@ -159,7 +144,6 @@ Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
jint widget_type, jstring stock_id, jint icon_size,
jint text_direction, jstring detail)
{
#ifndef HEADLESS
int len;
jsize jlen;
char *stock_id_str = NULL;
@ -206,9 +190,6 @@ Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
free(detail_str);
return result;
#else /* HEADLESS */
return JNI_FALSE;
#endif /* !HEADLESS */
}
/*
@ -219,11 +200,9 @@ Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
JNIEXPORT void JNICALL
Java_sun_awt_UNIXToolkit_nativeSync(JNIEnv *env, jobject this)
{
#ifndef HEADLESS
AWT_LOCK();
XSync(awt_display, False);
AWT_UNLOCK();
#endif /* !HEADLESS */
}
/*
@ -275,9 +254,5 @@ Java_sun_awt_UNIXToolkit_gtkCheckVersionImpl(JNIEnv *env, jobject this,
JNIEXPORT jint JNICALL
Java_sun_awt_UNIXToolkit_get_1gtk_1version(JNIEnv *env, jclass klass)
{
#ifndef HEADLESS
return gtk ? gtk->version : GTK_ANY;
#else
return GTK_ANY;
#endif /* !HEADLESS */
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2020, 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
@ -22,11 +22,14 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#ifndef _CANVAS_H_
#define _CANVAS_H_
#ifndef HEADLESS
KeySym awt_getX11KeySym(jint awtKey);
#endif /* !HEADLESS */
#endif /* _CANVAS_H_ */

@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <dlfcn.h>
#include <setjmp.h>
#include <X11/Xlib.h>

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#ifndef _GTK2_INTERFACE_H
#define _GTK2_INTERFACE_H

@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <dlfcn.h>
#include <setjmp.h>
#include <X11/Xlib.h>

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#ifndef _GTK3_INTERFACE_H
#define _GTK3_INTERFACE_H

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <dlfcn.h>
#include <stdlib.h>
#include "jvm_md.h"

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#ifndef _GTK_INTERFACE_H
#define _GTK_INTERFACE_H

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -63,6 +63,10 @@ from The Open Group.
----------------------------------------------------------------------- **/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <stdio.h>
#include <stdlib.h>

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -63,6 +63,10 @@ from The Open Group.
-------------------------------------------------------------------- **/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#ifndef LIST_DEF
#define LIST_DEF

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -63,6 +63,10 @@ from The Open Group.
------------------------------------------------------------------------ **/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -63,6 +63,10 @@ from The Open Group.
------------------------------------------------------------------------ **/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
extern int GetMultiVisualRegions(
Display *, Window, int, int, unsigned int,
unsigned int, int *, int *, XVisualInfo **, int *,

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <jni.h>
#include <stdio.h>
#include <jni_util.h>

@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include "gtk_interface.h"
#include "com_sun_java_swing_plaf_gtk_GTKEngine.h"
#include <jni_util.h>

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <stdlib.h>
#include <stdio.h>
#include "gtk_interface.h"

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -70,6 +70,10 @@ from The Open Group.
*
******************************************************************************/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
typedef unsigned long Pixel;
/* This is the actual structure returned by the X server describing the

@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include "X11SurfaceData.h"
#include <jni.h>
#include <math.h>
@ -249,7 +253,6 @@ JNIEXPORT jboolean JNICALL
Java_sun_awt_X11GraphicsEnvironment_initXRender
(JNIEnv *env, jclass x11ge, jboolean verbose, jboolean ignoreLinuxVersion)
{
#ifndef HEADLESS
static jboolean xrenderAvailable = JNI_FALSE;
static jboolean firstTime = JNI_TRUE;
@ -267,9 +270,6 @@ Java_sun_awt_X11GraphicsEnvironment_initXRender
firstTime = JNI_FALSE;
}
return xrenderAvailable;
#else
return JNI_FALSE;
#endif /* !HEADLESS */
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include "GraphicsPrimitiveMgr.h"
#include "Region.h"
#include "Trace.h"
@ -43,20 +47,16 @@
#include <dlfcn.h>
#include <setjmp.h>
#ifndef HEADLESS
jfieldID pictID;
jfieldID xidID;
jfieldID blitMaskPMID;
jfieldID blitMaskPictID;
#endif /* !HEADLESS */
JNIEXPORT void JNICALL
Java_sun_java2d_xr_XRSurfaceData_initXRPicture(JNIEnv *env, jobject xsd,
jlong pXSData,
jint pictFormat)
{
#ifndef HEADLESS
X11SDOps *xsdo;
XRenderPictFormat *fmt;
@ -78,13 +78,11 @@ JNIEXPORT void JNICALL
(*env)->SetIntField (env, xsd, pictID, xsdo->xrPic);
(*env)->SetIntField (env, xsd, xidID, xsdo->drawable);
#endif /* !HEADLESS */
}
JNIEXPORT void JNICALL
Java_sun_java2d_xr_XRSurfaceData_initIDs(JNIEnv *env, jclass xsd)
{
#ifndef HEADLESS
J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initIDs");
pictID = (*env)->GetFieldID(env, xsd, "picture", "I");
@ -97,7 +95,6 @@ Java_sun_java2d_xr_XRSurfaceData_initIDs(JNIEnv *env, jclass xsd)
}
XShared_initIDs(env, JNI_FALSE);
#endif /* !HEADLESS */
}
@ -107,7 +104,6 @@ Java_sun_java2d_xr_XRSurfaceData_XRInitSurface(JNIEnv *env, jclass xsd,
jint width, jint height,
jlong drawable, jint pictFormat)
{
#ifndef HEADLESS
X11SDOps *xsdo;
J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initSurface");
@ -118,7 +114,6 @@ Java_sun_java2d_xr_XRSurfaceData_XRInitSurface(JNIEnv *env, jclass xsd,
}
XShared_initSurface(env, xsdo, depth, width, height, drawable);
#endif /* !HEADLESS */
}
@ -127,7 +122,6 @@ JNIEXPORT void JNICALL
Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture(JNIEnv *env, jobject xsd,
jlong pXSData)
{
#ifndef HEADLESS
X11SDOps *xsdo;
J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_freeXSDOPicture");
@ -141,5 +135,4 @@ Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture(JNIEnv *env, jobject xsd,
XRenderFreePicture(awt_display, xsdo->xrPic);
xsdo->xrPic = None;
}
#endif /* !HEADLESS */
}

@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
@ -70,12 +74,9 @@ struct ComponentIDs componentIDs;
struct MenuComponentIDs menuComponentIDs;
#ifndef HEADLESS
extern Display* awt_init_Display(JNIEnv *env, jobject this);
extern void freeNativeStringArray(char **array, jsize length);
extern char** stringArrayToNative(JNIEnv *env, jobjectArray array, jsize * ret_length);
#endif /* !HEADLESS */
/* This function gets called from the static initializer for FileDialog.java
to initialize the fieldIDs for fields that may be accessed from C */
@ -300,11 +301,7 @@ Java_java_awt_TextField_initIDs
}
JNIEXPORT jboolean JNICALL AWTIsHeadless() {
#ifdef HEADLESS
return JNI_TRUE;
#else
return JNI_FALSE;
#endif
}
JNIEXPORT void JNICALL Java_java_awt_Dialog_initIDs (JNIEnv *env, jclass cls)

@ -86,7 +86,6 @@ jfieldID graphicsConfigID;
extern jobject currentX11InputMethodInstance;
extern Boolean awt_x11inputmethod_lookupString(XKeyPressedEvent *, KeySym *);
Boolean awt_UseType4Patch = False;
/* how about HEADLESS */
Boolean awt_ServerDetected = False;
Boolean awt_XKBDetected = False;
Boolean awt_IsXsun = False;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include "awt.h"
#include "awt_util.h"
#include "jni.h"

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include "jni_util.h"
#include "gtk_interface.h"
#include "gnome_interface.h"

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include <dlfcn.h>
#include "jvm_md.h"
#include <setjmp.h>

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#ifndef AWT_TASKBAR_H
#define AWT_TASKBAR_H

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#include "gnome_interface.h"
GNOME_URL_SHOW_TYPE *gnome_url_show = NULL;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, 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
@ -23,6 +23,10 @@
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#ifndef _GNOME_INTERFACE_H
#define _GNOME_INTERFACE_H
#include "gtk_interface.h"