1 /*******************************************************************************
2  * Copyright (c) 2000, 2016 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *    IBM Corporation - initial API
13  *    Adobe Systems, Inc. - initial implementation
14  *******************************************************************************/
15 
16 #include "swt.h"
17 #include "jawt_md.h"
18 
19 #define SWT_AWT_NATIVE(func) Java_org_eclipse_swt_awt_SWT_1AWT_##func
20 
21 #ifndef NO_initFrame
Java_org_eclipse_swt_awt_SWT_1AWT_initFrame(JNIEnv * env,jclass that,jlong handle,const char * className)22 JNIEXPORT jobject JNICALL Java_org_eclipse_swt_awt_SWT_1AWT_initFrame
23 	(JNIEnv *env, jclass that, jlong handle, const char *className)
24 {
25 	jobject object;
26 	jmethodID constructor;
27 
28 	jclass cls = (*env)->FindClass(env, "sun/lwawt/macosx/CViewEmbeddedFrame");
29 	if (NULL == cls) return NULL;
30 	constructor = (*env)->GetMethodID(env, cls, "<init>", "(J)V");
31 	object = (*env)->NewObject(env, cls, constructor, handle);
32 	return object;
33 }
34 #endif
35 
36 #ifndef NO_validateWithBounds
Java_org_eclipse_swt_awt_SWT_1AWT_validateWithBounds(JNIEnv * env,jclass that,jobject frame,jint x,jint y,jint w,jint h)37 JNIEXPORT void JNICALL Java_org_eclipse_swt_awt_SWT_1AWT_validateWithBounds
38 (JNIEnv *env, jclass that, jobject frame, jint x,jint y,jint w,jint h)
39 {
40     jclass cls = (*env)->FindClass(env, "sun/lwawt/macosx/CViewEmbeddedFrame");
41     if (NULL == cls) return;
42     jmethodID midInit = (*env)->GetMethodID(env, cls, "validateWithBounds", "(IIII)V");
43     (*env)->CallVoidMethod(env, frame, midInit, x,y,w,h);
44 }
45 #endif
46 
47 #ifndef NO_synthesizeWindowActivation
Java_org_eclipse_swt_awt_SWT_1AWT_synthesizeWindowActivation(JNIEnv * env,jclass that,jobject frame,jboolean doActivate)48 JNIEXPORT void JNICALL Java_org_eclipse_swt_awt_SWT_1AWT_synthesizeWindowActivation
49 (JNIEnv *env, jclass that, jobject frame, jboolean doActivate)
50 {
51     jclass cls = (*env)->FindClass(env, "sun/lwawt/macosx/CViewEmbeddedFrame");
52     if (NULL == cls) return;
53     jmethodID midInit = (*env)->GetMethodID(env, cls, "synthesizeWindowActivation", "(Z)V");
54     (*env)->CallVoidMethod(env, frame, midInit, doActivate);
55 }
56 #endif
57 
58