< prev index next >
src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2004, 2019, 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
--- 1,7 ----
/*
! * 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,44 ****
* 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.
*/
#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;
--- 21,45 ----
* 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"
#include "awt.h"
#include "gtk_interface.h"
static jclass this_class = NULL;
static jmethodID icon_upcall_method = NULL;
*** 47,61 ****
* 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
--- 48,58 ----
*** 63,93 ****
* 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) {
--- 60,81 ----
*** 109,119 ****
*/
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;
--- 97,106 ----
*** 140,152 ****
/* 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
--- 127,136 ----
*** 157,167 ****
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;
--- 141,150 ----
*** 204,231 ****
/* 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
--- 187,209 ----
*** 273,283 ****
* 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 */
}
--- 251,257 ----
< prev index next >