Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8242559: Clean the "libawt_xawt" library from code for headless mode
Reviewed-by: kizune
  • Loading branch information
mrserb committed Oct 23, 2020
1 parent ff5f226 commit d8d9197
Show file tree
Hide file tree
Showing 29 changed files with 149 additions and 197 deletions.
133 changes: 12 additions & 121 deletions src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.c
@@ -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
Expand All @@ -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
Expand Down
@@ -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
Expand All @@ -23,6 +23,10 @@
* questions.
*/

#ifdef HEADLESS
#error This file should not be included in headless library
#endif

#include "jni_util.h"

struct MenuComponentIDs {
Expand Down
35 changes: 5 additions & 30 deletions src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c
@@ -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
Expand All @@ -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>
Expand All @@ -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;
Expand All @@ -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 */
}


Expand All @@ -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 */
}


Expand All @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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 */
}

/*
Expand All @@ -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;
Expand Down Expand Up @@ -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 */
}

/*
Expand All @@ -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 */
}

/*
Expand Down Expand Up @@ -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 */
}
9 changes: 6 additions & 3 deletions src/java.desktop/unix/native/libawt_xawt/awt/canvas.h
@@ -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
Expand All @@ -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_ */
5 changes: 5 additions & 0 deletions src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c
Expand Up @@ -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>
Expand Down
@@ -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
Expand All @@ -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

Expand Down
5 changes: 5 additions & 0 deletions src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c
Expand Up @@ -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>
Expand Down
@@ -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
Expand All @@ -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

Expand Down
7 changes: 6 additions & 1 deletion src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.c
@@ -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
Expand All @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.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
Expand All @@ -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

Expand Down
6 changes: 5 additions & 1 deletion src/java.desktop/unix/native/libawt_xawt/awt/list.c
@@ -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
Expand Down Expand Up @@ -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>

Expand Down
6 changes: 5 additions & 1 deletion src/java.desktop/unix/native/libawt_xawt/awt/list.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
Expand Down Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c
@@ -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
Expand Down Expand Up @@ -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>
Expand Down
6 changes: 5 additions & 1 deletion src/java.desktop/unix/native/libawt_xawt/awt/multiVis.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
Expand Down Expand Up @@ -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 *,
Expand Down
@@ -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
Expand All @@ -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>
Expand Down
Expand Up @@ -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>
Expand Down

1 comment on commit d8d9197

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on d8d9197 Oct 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.