mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-12 22:26:56 -04:00
More awt_xawt stubs
This commit is contained in:
parent
32992619e9
commit
6e065198d2
@ -26,6 +26,12 @@ LOCAL_MODULE := awt_xawt
|
||||
# LOCAL_CFLAGS += -DHEADLESS
|
||||
LOCAL_SRC_FILES := \
|
||||
xawt_fake.c \
|
||||
awt_GraphicsEnv.c
|
||||
awt_AWTEvent.c \
|
||||
awt_Event.c \
|
||||
awt_GraphicsEnv.c \
|
||||
awt_InputMethod.c \
|
||||
awt_Insets.c \
|
||||
awt_Robot.c \
|
||||
awt_UNIXToolkit.c
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
71
app/src/main/jni/awt_xawt/awt_AWTEvent.c
Normal file
71
app/src/main/jni/awt_xawt/awt_AWTEvent.c
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2014, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* Implements the native code for the java.awt.AWTEvent class
|
||||
* and all of the classes in the java.awt.event package.
|
||||
*
|
||||
* THIS FILE DOES NOT IMPLEMENT ANY OF THE OBSOLETE java.awt.Event
|
||||
* CLASS. SEE awt_Event.[ch] FOR THAT CLASS' IMPLEMENTATION.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
/*
|
||||
struct AWTEventIDs awtEventIDs;
|
||||
struct InputEventIDs inputEventIDs;
|
||||
struct KeyEventIDs keyEventIDs;
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_AWTEvent_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
/*
|
||||
CHECK_NULL(awtEventIDs.bdata = (*env)->GetFieldID(env, cls, "bdata", "[B"));
|
||||
CHECK_NULL(awtEventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z"));
|
||||
CHECK_NULL(awtEventIDs.id = (*env)->GetFieldID(env, cls, "id", "I"));
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_event_InputEvent_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
CHECK_NULL(inputEventIDs.modifiers = (*env)->GetFieldID(env, cls, "modifiers", "I"));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_event_KeyEvent_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
/*
|
||||
CHECK_NULL(keyEventIDs.keyCode = (*env)->GetFieldID(env, cls, "keyCode", "I"));
|
||||
CHECK_NULL(keyEventIDs.keyChar = (*env)->GetFieldID(env, cls, "keyChar", "C"));
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self,
|
||||
jobject newSource)
|
||||
{
|
||||
|
||||
}
|
55
app/src/main/jni/awt_xawt/awt_Event.c
Normal file
55
app/src/main/jni/awt_xawt/awt_Event.c
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2001, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/***
|
||||
*** THIS IMPLEMENTS ONLY THE OBSOLETE java.awt.Event CLASS! SEE
|
||||
*** awt_AWTEvent.[ch] FOR THE NEWER EVENT CLASSES.
|
||||
***
|
||||
***/
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
/*
|
||||
#ifdef HEADLESS
|
||||
#error This file should not be included in headless library
|
||||
#endif
|
||||
|
||||
#include "java_awt_Event.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "awt_Event.h"
|
||||
|
||||
struct EventIDs eventIDs;
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_Event_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
/*
|
||||
CHECK_NULL(eventIDs.data = (*env)->GetFieldID(env, cls, "data", "J"));
|
||||
CHECK_NULL(eventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z"));
|
||||
CHECK_NULL(eventIDs.id = (*env)->GetFieldID(env, cls, "id", "I"));
|
||||
*/
|
||||
}
|
350
app/src/main/jni/awt_xawt/awt_InputMethod.c
Normal file
350
app/src/main/jni/awt_xawt/awt_InputMethod.c
Normal file
@ -0,0 +1,350 @@
|
||||
#include <jni.h>
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethod
|
||||
* Method: initIDs
|
||||
* Signature: ()V
|
||||
*/
|
||||
|
||||
/* This function gets called from the static initializer for
|
||||
X11InputMethod.java
|
||||
to initialize the fieldIDs for fields that may be accessed from C */
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11InputMethod_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
// x11InputMethodIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J");
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_openXIMNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong display)
|
||||
{
|
||||
/*
|
||||
Bool registered;
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
dpy = (Display *)jlong_to_ptr(display);
|
||||
|
||||
/* Use IMInstantiate call back only on Linux, as there is a bug in Solaris
|
||||
(4768335)
|
||||
* /
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,
|
||||
NULL, (XIDProc)OpenXIMCallback, NULL);
|
||||
if (!registered) {
|
||||
/* directly call openXIM callback * /
|
||||
#endif
|
||||
OpenXIMCallback(dpy, NULL, NULL);
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
}
|
||||
#endif
|
||||
|
||||
AWT_UNLOCK();
|
||||
*/
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_createXICNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong window)
|
||||
{
|
||||
/*
|
||||
X11InputMethodData *pX11IMData;
|
||||
jobject globalRef;
|
||||
XIC ic;
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
if (!window) {
|
||||
JNU_ThrowNullPointerException(env, "NullPointerException");
|
||||
AWT_UNLOCK();
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
pX11IMData = (X11InputMethodData *) calloc(1, sizeof(X11InputMethodData));
|
||||
if (pX11IMData == NULL) {
|
||||
THROW_OUT_OF_MEMORY_ERROR();
|
||||
AWT_UNLOCK();
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
globalRef = (*env)->NewGlobalRef(env, this);
|
||||
pX11IMData->x11inputmethod = globalRef;
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
pX11IMData->statusWindow = NULL;
|
||||
#endif /* __linux__ || MACOSX * /
|
||||
|
||||
pX11IMData->lookup_buf = 0;
|
||||
pX11IMData->lookup_buf_len = 0;
|
||||
|
||||
if (createXIC(env, pX11IMData, (Window)window) == False) {
|
||||
destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData);
|
||||
pX11IMData = (X11InputMethodData *) NULL;
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
goto finally;
|
||||
}
|
||||
}
|
||||
|
||||
setX11InputMethodData(env, this, pX11IMData);
|
||||
|
||||
finally:
|
||||
AWT_UNLOCK();
|
||||
return (pX11IMData != NULL);
|
||||
*/
|
||||
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
|
||||
jobject this,
|
||||
jlong w,
|
||||
jboolean req,
|
||||
jboolean active)
|
||||
{
|
||||
/*
|
||||
X11InputMethodData *pX11IMData;
|
||||
AWT_LOCK();
|
||||
pX11IMData = getX11InputMethodData(env, this);
|
||||
if (pX11IMData == NULL) {
|
||||
AWT_UNLOCK();
|
||||
return;
|
||||
}
|
||||
|
||||
if (req) {
|
||||
if (!w) {
|
||||
AWT_UNLOCK();
|
||||
return;
|
||||
}
|
||||
pX11IMData->current_ic = active ?
|
||||
pX11IMData->ic_active : pX11IMData->ic_passive;
|
||||
/*
|
||||
* On Solaris2.6, setXICWindowFocus() has to be invoked
|
||||
* before setting focus.
|
||||
* /
|
||||
setXICWindowFocus(pX11IMData->current_ic, w);
|
||||
setXICFocus(pX11IMData->current_ic, req);
|
||||
currentX11InputMethodInstance = pX11IMData->x11inputmethod;
|
||||
currentFocusWindow = w;
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on)
|
||||
onoffStatusWindow(pX11IMData, w, True);
|
||||
#endif
|
||||
} else {
|
||||
currentX11InputMethodInstance = NULL;
|
||||
currentFocusWindow = 0;
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
onoffStatusWindow(pX11IMData, 0, False);
|
||||
if (pX11IMData->current_ic != NULL)
|
||||
#endif
|
||||
setXICFocus(pX11IMData->current_ic, req);
|
||||
|
||||
pX11IMData->current_ic = (XIC)0;
|
||||
}
|
||||
|
||||
XFlush(dpy);
|
||||
AWT_UNLOCK();
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11InputMethod_turnoffStatusWindow(JNIEnv *env,
|
||||
jobject this)
|
||||
{
|
||||
/*
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
X11InputMethodData *pX11IMData;
|
||||
StatusWindow *statusWindow;
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
if (NULL == currentX11InputMethodInstance
|
||||
|| !isX11InputMethodGRefInList(currentX11InputMethodInstance)
|
||||
|| NULL == (pX11IMData = getX11InputMethodData(env,currentX11InputMethodInstance))
|
||||
|| NULL == (statusWindow = pX11IMData->statusWindow)
|
||||
|| !statusWindow->on ){
|
||||
AWT_UNLOCK();
|
||||
return;
|
||||
}
|
||||
onoffStatusWindow(pX11IMData, 0, False);
|
||||
|
||||
AWT_UNLOCK();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11InputMethod_disposeXIC(JNIEnv *env,
|
||||
jobject this)
|
||||
{
|
||||
/*
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
|
||||
AWT_LOCK();
|
||||
pX11IMData = getX11InputMethodData(env, this);
|
||||
if (pX11IMData == NULL) {
|
||||
AWT_UNLOCK();
|
||||
return;
|
||||
}
|
||||
|
||||
setX11InputMethodData(env, this, NULL);
|
||||
|
||||
if (pX11IMData->x11inputmethod == currentX11InputMethodInstance) {
|
||||
currentX11InputMethodInstance = NULL;
|
||||
currentFocusWindow = 0;
|
||||
}
|
||||
destroyX11InputMethodData(env, pX11IMData);
|
||||
AWT_UNLOCK();
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_sun_awt_X11InputMethod_resetXIC(JNIEnv *env,
|
||||
jobject this)
|
||||
{
|
||||
jstring jText = (jstring)0;
|
||||
/*
|
||||
X11InputMethodData *pX11IMData;
|
||||
char *xText = NULL;
|
||||
|
||||
AWT_LOCK();
|
||||
pX11IMData = getX11InputMethodData(env, this);
|
||||
if (pX11IMData == NULL) {
|
||||
AWT_UNLOCK();
|
||||
return jText;
|
||||
}
|
||||
|
||||
if (pX11IMData->current_ic)
|
||||
xText = XmbResetIC(pX11IMData->current_ic);
|
||||
else {
|
||||
/*
|
||||
* If there is no reference to the current XIC, try to reset both XICs.
|
||||
* /
|
||||
xText = XmbResetIC(pX11IMData->ic_active);
|
||||
/*it may also means that the real client component does
|
||||
not have focus -- has been deactivated... its xic should
|
||||
not have the focus, bug#4284651 showes reset XIC for htt
|
||||
may bring the focus back, so de-focus it again.
|
||||
* /
|
||||
setXICFocus(pX11IMData->ic_active, FALSE);
|
||||
if (pX11IMData->ic_active != pX11IMData->ic_passive) {
|
||||
char *tmpText = XmbResetIC(pX11IMData->ic_passive);
|
||||
setXICFocus(pX11IMData->ic_passive, FALSE);
|
||||
if (xText == (char *)NULL && tmpText)
|
||||
xText = tmpText;
|
||||
}
|
||||
|
||||
}
|
||||
if (xText != NULL) {
|
||||
jText = JNU_NewStringPlatform(env, (const char *)xText);
|
||||
XFree((void *)xText);
|
||||
}
|
||||
|
||||
AWT_UNLOCK();
|
||||
return jText;
|
||||
*/
|
||||
|
||||
return jText;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethod
|
||||
* Method: setCompositionEnabledNative
|
||||
* Signature: (ZJ)V
|
||||
*
|
||||
* This method tries to set the XNPreeditState attribute associated with the current
|
||||
* XIC to the passed in 'enable' state.
|
||||
*
|
||||
* Return JNI_TRUE if XNPreeditState attribute is successfully changed to the
|
||||
* 'enable' state; Otherwise, if XSetICValues fails to set this attribute,
|
||||
* java.lang.UnsupportedOperationException will be thrown. JNI_FALSE is returned if this
|
||||
* method fails due to other reasons.
|
||||
*
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethod_setCompositionEnabledNative
|
||||
(JNIEnv *env, jobject this, jboolean enable)
|
||||
{
|
||||
/*
|
||||
X11InputMethodData *pX11IMData;
|
||||
char * ret = NULL;
|
||||
|
||||
AWT_LOCK();
|
||||
pX11IMData = getX11InputMethodData(env, this);
|
||||
|
||||
if ((pX11IMData == NULL) || (pX11IMData->current_ic == NULL)) {
|
||||
AWT_UNLOCK();
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
ret = XSetICValues(pX11IMData->current_ic, XNPreeditState,
|
||||
(enable ? XIMPreeditEnable : XIMPreeditDisable), NULL);
|
||||
AWT_UNLOCK();
|
||||
|
||||
if ((ret != 0) && (strcmp(ret, XNPreeditState) == 0)) {
|
||||
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "");
|
||||
}
|
||||
|
||||
return (jboolean)(ret == 0);
|
||||
*/
|
||||
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethod
|
||||
* Method: isCompositionEnabledNative
|
||||
* Signature: (J)Z
|
||||
*
|
||||
* This method tries to get the XNPreeditState attribute associated with the current XIC.
|
||||
*
|
||||
* Return JNI_TRUE if the XNPreeditState is successfully retrieved. Otherwise, if
|
||||
* XGetICValues fails to get this attribute, java.lang.UnsupportedOperationException
|
||||
* will be thrown. JNI_FALSE is returned if this method fails due to other reasons.
|
||||
*
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethod_isCompositionEnabledNative
|
||||
(JNIEnv *env, jobject this)
|
||||
{
|
||||
/*
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
char * ret = NULL;
|
||||
XIMPreeditState state;
|
||||
|
||||
AWT_LOCK();
|
||||
pX11IMData = getX11InputMethodData(env, this);
|
||||
|
||||
if ((pX11IMData == NULL) || (pX11IMData->current_ic == NULL)) {
|
||||
AWT_UNLOCK();
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
ret = XGetICValues(pX11IMData->current_ic, XNPreeditState, &state, NULL);
|
||||
AWT_UNLOCK();
|
||||
|
||||
if ((ret != 0) && (strcmp(ret, XNPreeditState) == 0)) {
|
||||
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
return (jboolean)(state == XIMPreeditEnable);
|
||||
*/
|
||||
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow
|
||||
(JNIEnv *env, jobject this, jlong window)
|
||||
{
|
||||
/*
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
AWT_LOCK();
|
||||
adjustStatusWindow(window);
|
||||
AWT_UNLOCK();
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
44
app/src/main/jni/awt_xawt/awt_Insets.c
Normal file
44
app/src/main/jni/awt_xawt/awt_Insets.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2014, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* 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 "java_awt_Insets.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "awt_Insets.h"
|
||||
|
||||
struct InsetsIDs insetsIDs;
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_awt_Insets_initIDs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
/*
|
||||
CHECK_NULL(insetsIDs.top = (*env)->GetFieldID(env, cls, "top", "I"));
|
||||
CHECK_NULL(insetsIDs.bottom = (*env)->GetFieldID(env, cls, "bottom", "I"));
|
||||
CHECK_NULL(insetsIDs.left = (*env)->GetFieldID(env, cls, "left", "I"));
|
||||
CHECK_NULL(insetsIDs.right = (*env)->GetFieldID(env, cls, "right", "I"));
|
||||
*/
|
||||
}
|
324
app/src/main/jni/awt_xawt/awt_Robot.c
Normal file
324
app/src/main/jni/awt_xawt/awt_Robot.c
Normal file
@ -0,0 +1,324 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2017, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* 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 "jvm_md.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "awt_p.h"
|
||||
#include "awt_GraphicsEnv.h"
|
||||
#define XK_MISCELLANY
|
||||
#include <X11/keysymdef.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/extensions/xtestext1.h>
|
||||
#include <X11/extensions/XTest.h>
|
||||
#include <X11/extensions/XInput.h>
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <jni.h>
|
||||
#include <sizecalc.h>
|
||||
#include "robot_common.h"
|
||||
#include "canvas.h"
|
||||
#include "wsutils.h"
|
||||
#include "list.h"
|
||||
#include "multiVis.h"
|
||||
#include "gtk_interface.h"
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#if defined(__linux__) || defined(MACOSX)
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
static Bool (*compositeQueryExtension) (Display*, int*, int*);
|
||||
static Status (*compositeQueryVersion) (Display*, int*, int*);
|
||||
static Window (*compositeGetOverlayWindow) (Display *, Window);
|
||||
|
||||
extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
|
||||
|
||||
static jint * masks;
|
||||
static jint num_buttons;
|
||||
*/
|
||||
|
||||
// TODO Implement if need
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
// this should be called from XRobotPeer constructor
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons, jintArray buttonDownMasks)
|
||||
{
|
||||
/*
|
||||
int32_t xtestAvailable;
|
||||
jint *tmp;
|
||||
int i;
|
||||
|
||||
DTRACE_PRINTLN("RobotPeer: setup()");
|
||||
|
||||
num_buttons = numberOfButtons;
|
||||
tmp = (*env)->GetIntArrayElements(env, buttonDownMasks, JNI_FALSE);
|
||||
CHECK_NULL(tmp);
|
||||
|
||||
masks = (jint *)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), num_buttons);
|
||||
if (masks == (jint *) NULL) {
|
||||
(*env)->ExceptionClear(env);
|
||||
(*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
|
||||
JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < num_buttons; i++) {
|
||||
masks[i] = tmp[i];
|
||||
}
|
||||
(*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
|
||||
|
||||
AWT_LOCK();
|
||||
xtestAvailable = isXTestAvailable();
|
||||
DTRACE_PRINTLN1("RobotPeer: XTest available = %d", xtestAvailable);
|
||||
if (!xtestAvailable) {
|
||||
JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2");
|
||||
}
|
||||
|
||||
AWT_UNLOCK();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
|
||||
jclass cls,
|
||||
jobject xgc,
|
||||
jint jx,
|
||||
jint jy,
|
||||
jint jwidth,
|
||||
jint jheight,
|
||||
jintArray pixelArray,
|
||||
jboolean useGtk) {
|
||||
/*
|
||||
XImage *image;
|
||||
jint *ary; /* Array of jints for sending pixel values back
|
||||
* to parent process.
|
||||
* /
|
||||
Window rootWindow;
|
||||
XWindowAttributes attr;
|
||||
AwtGraphicsConfigDataPtr adata;
|
||||
|
||||
DTRACE_PRINTLN6("RobotPeer: getRGBPixelsImpl(%lx, %d, %d, %d, %d, %x)", xgc, jx, jy, jwidth, jheight, pixelArray);
|
||||
|
||||
if (jwidth <= 0 || jheight <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, xgc, x11GraphicsConfigIDs.aData);
|
||||
DASSERT(adata != NULL);
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
rootWindow = XRootWindow(awt_display, adata->awt_visInfo.screen);
|
||||
|
||||
if (!useGtk) {
|
||||
if (hasXCompositeOverlayExtension(awt_display) &&
|
||||
isXCompositeDisplay(awt_display, adata->awt_visInfo.screen))
|
||||
{
|
||||
rootWindow = compositeGetOverlayWindow(awt_display, rootWindow);
|
||||
}
|
||||
}
|
||||
|
||||
if (!XGetWindowAttributes(awt_display, rootWindow, &attr)
|
||||
|| jx + jwidth <= attr.x
|
||||
|| attr.x + attr.width <= jx
|
||||
|| jy + jheight <= attr.y
|
||||
|| attr.y + attr.height <= jy) {
|
||||
|
||||
AWT_UNLOCK();
|
||||
return; // Does not intersect with root window
|
||||
}
|
||||
|
||||
gboolean gtk_failed = TRUE;
|
||||
jint _x, _y;
|
||||
|
||||
jint x = MAX(jx, attr.x);
|
||||
jint y = MAX(jy, attr.y);
|
||||
jint width = MIN(jx + jwidth, attr.x + attr.width) - x;
|
||||
jint height = MIN(jy + jheight, attr.y + attr.height) - y;
|
||||
|
||||
int dx = attr.x > jx ? attr.x - jx : 0;
|
||||
int dy = attr.y > jy ? attr.y - jy : 0;
|
||||
|
||||
int index;
|
||||
|
||||
if (useGtk) {
|
||||
gtk->gdk_threads_enter();
|
||||
gtk_failed = gtk->get_drawable_data(env, pixelArray, x, y, width,
|
||||
height, jwidth, dx, dy, 1);
|
||||
gtk->gdk_threads_leave();
|
||||
}
|
||||
|
||||
if (gtk_failed) {
|
||||
image = getWindowImage(awt_display, rootWindow, x, y, width, height);
|
||||
|
||||
ary = (*env)->GetPrimitiveArrayCritical(env, pixelArray, NULL);
|
||||
|
||||
if (!ary) {
|
||||
XDestroyImage(image);
|
||||
AWT_UNLOCK();
|
||||
return;
|
||||
}
|
||||
|
||||
/* convert to Java ARGB pixels * /
|
||||
for (_y = 0; _y < height; _y++) {
|
||||
for (_x = 0; _x < width; _x++) {
|
||||
jint pixel = (jint) XGetPixel(image, _x, _y);
|
||||
/* Note ignore upper
|
||||
* 32-bits on 64-bit
|
||||
* OSes.
|
||||
* /
|
||||
pixel |= 0xff000000; /* alpha - full opacity * /
|
||||
|
||||
index = (_y + dy) * jwidth + (_x + dx);
|
||||
ary[index] = pixel;
|
||||
}
|
||||
}
|
||||
|
||||
XDestroyImage(image);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, pixelArray, ary, 0);
|
||||
}
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_keyPressImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint keycode) {
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
DTRACE_PRINTLN1("RobotPeer: keyPressImpl(%i)", keycode);
|
||||
/*
|
||||
XTestFakeKeyEvent(awt_display,
|
||||
XKeysymToKeycode(awt_display, awt_getX11KeySym(keycode)),
|
||||
True,
|
||||
CurrentTime);
|
||||
|
||||
XSync(awt_display, False);
|
||||
*/
|
||||
AWT_UNLOCK();
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_keyReleaseImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint keycode) {
|
||||
AWT_LOCK();
|
||||
|
||||
DTRACE_PRINTLN1("RobotPeer: keyReleaseImpl(%i)", keycode);
|
||||
/*
|
||||
XTestFakeKeyEvent(awt_display,
|
||||
XKeysymToKeycode(awt_display, awt_getX11KeySym(keycode)),
|
||||
False,
|
||||
CurrentTime);
|
||||
|
||||
XSync(awt_display, False);
|
||||
*/
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_mouseMoveImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jobject xgc,
|
||||
jint root_x,
|
||||
jint root_y) {
|
||||
/*
|
||||
AwtGraphicsConfigDataPtr adata;
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
DTRACE_PRINTLN3("RobotPeer: mouseMoveImpl(%lx, %i, %i)", xgc, root_x, root_y);
|
||||
|
||||
adata = (AwtGraphicsConfigDataPtr) JNU_GetLongFieldAsPtr(env, xgc, x11GraphicsConfigIDs.aData);
|
||||
DASSERT(adata != NULL);
|
||||
|
||||
XWarpPointer(awt_display, None, XRootWindow(awt_display, adata->awt_visInfo.screen), 0, 0, 0, 0, root_x, root_y);
|
||||
XSync(awt_display, False);
|
||||
|
||||
AWT_UNLOCK();
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_mousePressImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint buttonMask) {
|
||||
// mouseAction(env, cls, buttonMask, True);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint buttonMask) {
|
||||
// mouseAction(env, cls, buttonMask, False);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_mouseWheelImpl (JNIEnv *env,
|
||||
jclass cls,
|
||||
jint wheelAmt) {
|
||||
/* Mouse wheel is implemented as a button press of button 4 and 5, so it */
|
||||
/* probably could have been hacked into robot_mouseButtonEvent, but it's */
|
||||
/* cleaner to give it its own command type, in case the implementation */
|
||||
/* needs to be changed later. -bchristi, 6/20/01 */
|
||||
|
||||
/*
|
||||
int32_t repeat = abs(wheelAmt);
|
||||
int32_t button = wheelAmt < 0 ? 4 : 5; // wheel up: button 4
|
||||
// wheel down: button 5
|
||||
int32_t loopIdx;
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
DTRACE_PRINTLN1("RobotPeer: mouseWheelImpl(%i)", wheelAmt);
|
||||
|
||||
for (loopIdx = 0; loopIdx < repeat; loopIdx++) { // do nothing for
|
||||
// wheelAmt == 0
|
||||
XTestFakeButtonEvent(awt_display, button, True, CurrentTime);
|
||||
XTestFakeButtonEvent(awt_display, button, False, CurrentTime);
|
||||
}
|
||||
XSync(awt_display, False);
|
||||
|
||||
AWT_UNLOCK();
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_X11_XRobotPeer_loadNativeLibraries (JNIEnv *env, jclass cls) {
|
||||
// initXCompositeFunctions();
|
||||
}
|
285
app/src/main/jni/awt_xawt/awt_UNIXToolkit.c
Normal file
285
app/src/main/jni/awt_xawt/awt_UNIXToolkit.c
Normal file
@ -0,0 +1,285 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2016, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* 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"
|
||||
|
||||
#define HEADLESS
|
||||
|
||||
#ifndef HEADLESS
|
||||
#include "awt.h"
|
||||
#include "gtk_interface.h"
|
||||
#endif /* !HEADLESS */
|
||||
|
||||
|
||||
static jclass this_class = NULL;
|
||||
static jmethodID icon_upcall_method = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* 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
|
||||
* Method: load_gtk
|
||||
* 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) {
|
||||
this_class = (*env)->NewGlobalRef(env,
|
||||
(*env)->GetObjectClass(env, this));
|
||||
icon_upcall_method = (*env)->GetMethodID(env, this_class,
|
||||
"loadIconCallback", "([BIIIIIZ)V");
|
||||
CHECK_NULL_RETURN(icon_upcall_method, JNI_FALSE);
|
||||
}
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: load_gtk_icon
|
||||
* Signature: (Ljava/lang/String)Z
|
||||
*
|
||||
* This method assumes that GTK libs are present.
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_UNIXToolkit_load_1gtk_1icon(JNIEnv *env, jobject this,
|
||||
jstring filename)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
int len;
|
||||
char *filename_str = NULL;
|
||||
GError **error = NULL;
|
||||
|
||||
if (filename == NULL)
|
||||
{
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
len = (*env)->GetStringUTFLength(env, filename);
|
||||
filename_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
|
||||
sizeof(char), len + 1);
|
||||
if (filename_str == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
if (!init_method(env, this) ) {
|
||||
free(filename_str);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(*env)->GetStringUTFRegion(env, filename, 0, len, filename_str);
|
||||
jboolean result = gtk->get_file_icon_data(env, filename_str, error,
|
||||
icon_upcall_method, this);
|
||||
|
||||
/* 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
|
||||
* Signature: (ILjava/lang/String;IILjava/lang/String;)Z
|
||||
*
|
||||
* This method assumes that GTK libs are present.
|
||||
*/
|
||||
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;
|
||||
char *stock_id_str = NULL;
|
||||
char *detail_str = NULL;
|
||||
|
||||
if (stock_id == NULL)
|
||||
{
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
len = (*env)->GetStringUTFLength(env, stock_id);
|
||||
stock_id_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
|
||||
sizeof(char), len + 1);
|
||||
if (stock_id_str == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(*env)->GetStringUTFRegion(env, stock_id, 0, len, stock_id_str);
|
||||
|
||||
/* Detail isn't required so check for NULL. */
|
||||
if (detail != NULL)
|
||||
{
|
||||
len = (*env)->GetStringUTFLength(env, detail);
|
||||
detail_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
|
||||
sizeof(char), len + 1);
|
||||
if (detail_str == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(*env)->GetStringUTFRegion(env, detail, 0, len, detail_str);
|
||||
}
|
||||
|
||||
if (!init_method(env, this) ) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
jboolean result = gtk->get_icon_data(env, widget_type, stock_id_str,
|
||||
icon_size, text_direction, detail_str,
|
||||
icon_upcall_method, this);
|
||||
|
||||
/* Release the strings we've allocated. */
|
||||
free(stock_id_str);
|
||||
if (detail_str != NULL)
|
||||
{
|
||||
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
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_SunToolkit_closeSplashScreen(JNIEnv *env, jclass cls)
|
||||
{
|
||||
typedef void (*SplashClose_t)();
|
||||
SplashClose_t splashClose;
|
||||
void* hSplashLib = dlopen(0, RTLD_LAZY);
|
||||
if (!hSplashLib) {
|
||||
return;
|
||||
}
|
||||
splashClose = (SplashClose_t)dlsym(hSplashLib,
|
||||
"SplashClose");
|
||||
if (splashClose) {
|
||||
splashClose();
|
||||
}
|
||||
dlclose(hSplashLib);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: gtkCheckVersionImpl
|
||||
* Signature: (III)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_UNIXToolkit_gtkCheckVersionImpl(JNIEnv *env, jobject this,
|
||||
jint major, jint minor, jint micro)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
ret = gtk->gtk_check_version(major, minor, micro);
|
||||
if (ret == NULL) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_UNIXToolkit
|
||||
* Method: get_gtk_version
|
||||
* 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 */
|
||||
}
|
||||
|
||||
#undef HEADLESS
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include <jni.h>
|
||||
|
||||
JNIEXPORT void JNICALL Java_java_awt_AWTEvent_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_java_awt_event_InputEvent_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_java_awt_event_KeyEvent_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_java_awt_Event_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_java_awt_Insets_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_java_awt_FileDialog_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_java_awt_Component_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_java_awt_Container_initIDs(JNIEnv *env, jclass cls) {}
|
||||
@ -23,4 +18,4 @@ JNIEXPORT void JNICALL Java_java_awt_TextField_initIDs(JNIEnv *env, jclass cls)
|
||||
JNIEXPORT void JNICALL Java_java_awt_Dialog_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_java_awt_KeyboardFocusManager_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_java_awt_TrayIcon_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XWindow_initIDs(JNIEnv *env, jclass cls) {}
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11_XWindow_initIDs(JNIEnv *env, jclass cls) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user