< prev index next >
src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c
Print this page
@@ -1,7 +1,7 @@
/*
- * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -21,24 +21,25 @@
* 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.
*/
+#ifdef HEADLESS
+ #error This file should not be included in headless library
+#endif
+
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dlfcn.h>
#include <jni.h>
#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;
@@ -47,15 +48,11 @@
* Method: check_gtk
* Signature: (I)Z
*/
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 */
}
/*
* Class: sun_awt_UNIXToolkit
@@ -63,31 +60,22 @@
* Signature: (I)Z
*/
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 */
}
-
/*
* Class: sun_awt_UNIXToolkit
* Method: unload_gtk
* Signature: ()Z
*/
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)
{
if (this_class == NULL) {
@@ -109,11 +97,10 @@
*/
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;
GError **error = NULL;
@@ -140,13 +127,10 @@
/* Release the strings we've allocated. */
free(filename_str);
return result;
-#else /* HEADLESS */
- return JNI_FALSE;
-#endif /* !HEADLESS */
}
/*
* Class: sun_awt_UNIXToolkit
* Method: load_stock_icon
@@ -157,11 +141,10 @@
JNIEXPORT jboolean JNICALL
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;
char *detail_str = NULL;
jboolean result = JNI_FALSE;
@@ -204,28 +187,23 @@
/* Release the strings we've allocated. */
free(stock_id_str);
free(detail_str);
return result;
-#else /* HEADLESS */
- return JNI_FALSE;
-#endif /* !HEADLESS */
}
/*
* Class: sun_awt_UNIXToolkit
* Method: nativeSync
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_sun_awt_UNIXToolkit_nativeSync(JNIEnv *env, jobject this)
{
-#ifndef HEADLESS
AWT_LOCK();
XSync(awt_display, False);
AWT_UNLOCK();
-#endif /* !HEADLESS */
}
/*
* Class: sun_awt_SunToolkit
* Method: closeSplashScreen
@@ -273,11 +251,7 @@
* Signature: ()I
*/
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 */
}
< prev index next >