Skip to content

Commit d8d9197

Browse files
committed
8242559: Clean the "libawt_xawt" library from code for headless mode
Reviewed-by: kizune
1 parent ff5f226 commit d8d9197

29 files changed

+149
-197
lines changed

src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c

Lines changed: 12 additions & 121 deletions
Large diffs are not rendered by default.

src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,10 @@
2323
* questions.
2424
*/
2525

26+
#ifdef HEADLESS
27+
#error This file should not be included in headless library
28+
#endif
29+
2630
#include "java_awt_Insets.h"
2731

2832
JNIEXPORT void JNICALL

src/java.desktop/unix/native/libawt_xawt/awt/awt_MenuComponent.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,10 @@
2323
* questions.
2424
*/
2525

26+
#ifdef HEADLESS
27+
#error This file should not be included in headless library
28+
#endif
29+
2630
#include "jni_util.h"
2731

2832
struct MenuComponentIDs {

src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,10 @@
2323
* questions.
2424
*/
2525

26+
#ifdef HEADLESS
27+
#error This file should not be included in headless library
28+
#endif
29+
2630
#include <stdlib.h>
2731
#include <string.h>
2832
#include <unistd.h>
@@ -32,11 +36,8 @@
3236
#include <sizecalc.h>
3337
#include "sun_awt_UNIXToolkit.h"
3438

35-
#ifndef HEADLESS
3639
#include "awt.h"
3740
#include "gtk_interface.h"
38-
#endif /* !HEADLESS */
39-
4041

4142
static jclass this_class = NULL;
4243
static jmethodID icon_upcall_method = NULL;
@@ -49,11 +50,7 @@ static jmethodID icon_upcall_method = NULL;
4950
*/
5051
JNIEXPORT jboolean JNICALL
5152
Java_sun_awt_UNIXToolkit_check_1gtk(JNIEnv *env, jclass klass, jint version) {
52-
#ifndef HEADLESS
5353
return (jboolean)gtk_check_version(version);
54-
#else
55-
return JNI_FALSE;
56-
#endif /* !HEADLESS */
5754
}
5855

5956

@@ -65,11 +62,7 @@ Java_sun_awt_UNIXToolkit_check_1gtk(JNIEnv *env, jclass klass, jint version) {
6562
JNIEXPORT jboolean JNICALL
6663
Java_sun_awt_UNIXToolkit_load_1gtk(JNIEnv *env, jclass klass, jint version,
6764
jboolean verbose) {
68-
#ifndef HEADLESS
6965
return (jboolean)gtk_load(env, version, verbose);
70-
#else
71-
return JNI_FALSE;
72-
#endif /* !HEADLESS */
7366
}
7467

7568

@@ -81,11 +74,7 @@ Java_sun_awt_UNIXToolkit_load_1gtk(JNIEnv *env, jclass klass, jint version,
8174
JNIEXPORT jboolean JNICALL
8275
Java_sun_awt_UNIXToolkit_unload_1gtk(JNIEnv *env, jclass klass)
8376
{
84-
#ifndef HEADLESS
8577
return (jboolean)gtk->unload();
86-
#else
87-
return JNI_FALSE;
88-
#endif /* !HEADLESS */
8978
}
9079

9180
jboolean init_method(JNIEnv *env, jobject this)
@@ -111,7 +100,6 @@ JNIEXPORT jboolean JNICALL
111100
Java_sun_awt_UNIXToolkit_load_1gtk_1icon(JNIEnv *env, jobject this,
112101
jstring filename)
113102
{
114-
#ifndef HEADLESS
115103
int len;
116104
jsize jlen;
117105
char *filename_str = NULL;
@@ -142,9 +130,6 @@ Java_sun_awt_UNIXToolkit_load_1gtk_1icon(JNIEnv *env, jobject this,
142130
free(filename_str);
143131

144132
return result;
145-
#else /* HEADLESS */
146-
return JNI_FALSE;
147-
#endif /* !HEADLESS */
148133
}
149134

150135
/*
@@ -159,7 +144,6 @@ Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
159144
jint widget_type, jstring stock_id, jint icon_size,
160145
jint text_direction, jstring detail)
161146
{
162-
#ifndef HEADLESS
163147
int len;
164148
jsize jlen;
165149
char *stock_id_str = NULL;
@@ -206,9 +190,6 @@ Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
206190
free(detail_str);
207191

208192
return result;
209-
#else /* HEADLESS */
210-
return JNI_FALSE;
211-
#endif /* !HEADLESS */
212193
}
213194

214195
/*
@@ -219,11 +200,9 @@ Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
219200
JNIEXPORT void JNICALL
220201
Java_sun_awt_UNIXToolkit_nativeSync(JNIEnv *env, jobject this)
221202
{
222-
#ifndef HEADLESS
223203
AWT_LOCK();
224204
XSync(awt_display, False);
225205
AWT_UNLOCK();
226-
#endif /* !HEADLESS */
227206
}
228207

229208
/*
@@ -275,9 +254,5 @@ Java_sun_awt_UNIXToolkit_gtkCheckVersionImpl(JNIEnv *env, jobject this,
275254
JNIEXPORT jint JNICALL
276255
Java_sun_awt_UNIXToolkit_get_1gtk_1version(JNIEnv *env, jclass klass)
277256
{
278-
#ifndef HEADLESS
279257
return gtk ? gtk->version : GTK_ANY;
280-
#else
281-
return GTK_ANY;
282-
#endif /* !HEADLESS */
283258
}

src/java.desktop/unix/native/libawt_xawt/awt/canvas.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,11 +22,14 @@
2222
* or visit www.oracle.com if you need additional information or have any
2323
* questions.
2424
*/
25+
26+
#ifdef HEADLESS
27+
#error This file should not be included in headless library
28+
#endif
29+
2530
#ifndef _CANVAS_H_
2631
#define _CANVAS_H_
27-
#ifndef HEADLESS
2832

2933
KeySym awt_getX11KeySym(jint awtKey);
3034

31-
#endif /* !HEADLESS */
3235
#endif /* _CANVAS_H_ */

src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
* or visit www.oracle.com if you need additional information or have any
2323
* questions.
2424
*/
25+
26+
#ifdef HEADLESS
27+
#error This file should not be included in headless library
28+
#endif
29+
2530
#include <dlfcn.h>
2631
#include <setjmp.h>
2732
#include <X11/Xlib.h>

src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,11 @@
2222
* or visit www.oracle.com if you need additional information or have any
2323
* questions.
2424
*/
25+
26+
#ifdef HEADLESS
27+
#error This file should not be included in headless library
28+
#endif
29+
2530
#ifndef _GTK2_INTERFACE_H
2631
#define _GTK2_INTERFACE_H
2732

src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
* or visit www.oracle.com if you need additional information or have any
2323
* questions.
2424
*/
25+
26+
#ifdef HEADLESS
27+
#error This file should not be included in headless library
28+
#endif
29+
2530
#include <dlfcn.h>
2631
#include <setjmp.h>
2732
#include <X11/Xlib.h>

src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,11 @@
2222
* or visit www.oracle.com if you need additional information or have any
2323
* questions.
2424
*/
25+
26+
#ifdef HEADLESS
27+
#error This file should not be included in headless library
28+
#endif
29+
2530
#ifndef _GTK3_INTERFACE_H
2631
#define _GTK3_INTERFACE_H
2732

src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,11 @@
2222
* or visit www.oracle.com if you need additional information or have any
2323
* questions.
2424
*/
25+
26+
#ifdef HEADLESS
27+
#error This file should not be included in headless library
28+
#endif
29+
2530
#include <dlfcn.h>
2631
#include <stdlib.h>
2732
#include "jvm_md.h"

0 commit comments

Comments
 (0)