--- old/make/mapfiles/libawt/mapfile-mawt-vers 2016-08-01 15:07:18.000000000 +0300 +++ new/make/mapfiles/libawt/mapfile-mawt-vers 2016-08-01 15:07:18.000000000 +0300 @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2001, 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 @@ -238,6 +238,10 @@ awt_GetDrawingSurface; awt_FreeDrawingSurface; awt_GetComponent; + awt_CreateEmbeddedFrame; + awt_SetBounds; + awt_SynthesizeWindowActivation; + X11SurfaceData_GetOps; getDefaultConfig; --- old/make/mapfiles/libawt/mapfile-vers-linux 2016-08-01 15:07:18.000000000 +0300 +++ new/make/mapfiles/libawt/mapfile-vers-linux 2016-08-01 15:07:18.000000000 +0300 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 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 @@ -264,6 +264,10 @@ awt_GetDrawingSurface; awt_FreeDrawingSurface; awt_GetComponent; + awt_CreateEmbeddedFrame; + awt_SetBounds; + awt_SynthesizeWindowActivation; + X11SurfaceData_GetOps; getDefaultConfig; --- old/make/mapfiles/libawt_xawt/mapfile-vers 2016-08-01 15:07:19.000000000 +0300 +++ new/make/mapfiles/libawt_xawt/mapfile-vers 2016-08-01 15:07:19.000000000 +0300 @@ -458,6 +458,9 @@ awt_Unlock; awt_Lock; awt_GetComponent; + awt_CreateEmbeddedFrame; + awt_SetBounds; + awt_SynthesizeWindowActivation; #XAWT entry point for CDE Java_sun_awt_motif_XsessionWMcommand; --- old/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m 2016-08-01 15:07:20.000000000 +0300 +++ new/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m 2016-08-01 15:07:20.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -27,6 +27,8 @@ #import "AWTSurfaceLayers.h" +#import "jni_util.h" + JNIEXPORT JAWT_DrawingSurfaceInfo* JNICALL awt_DrawingSurface_GetDrawingSurfaceInfo (JAWT_DrawingSurface* ds) { @@ -130,3 +132,47 @@ // TODO: implement return NULL; } + +// EmbeddedFrame support + +static char *const embeddedClassName = "sun/lwawt/macosx/CViewEmbeddedFrame"; + +JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame +(JNIEnv* env, void* platformInfo) +{ + static jmethodID mid = NULL; + static jclass cls; + if (mid == NULL) { + cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL_RETURN(cls, NULL); + mid = (*env)->GetMethodID(env, cls, "", "(J)V"); + CHECK_NULL_RETURN(mid, NULL); + } + return (*env)->NewObject(env, cls, mid, platformInfo); +} + +JNIEXPORT void JNICALL awt_SetBounds +(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "setBoundsPrivate", "(IIII)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, x, y, w, h); +} + +JNIEXPORT void JNICALL awt_SynthesizeWindowActivation +(JNIEnv *env, jobject embeddedFrame, jboolean doActivate) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "synthesizeWindowActivation", "(Z)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, doActivate); +} --- old/src/java.desktop/macosx/native/libjawt/jawt.m 2016-08-01 15:07:20.000000000 +0300 +++ new/src/java.desktop/macosx/native/libjawt/jawt.m 2016-08-01 15:07:20.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -46,8 +46,9 @@ return JNI_FALSE; } - if (awt->version != (JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER) && - awt->version != JAWT_VERSION_1_7) + if (awt->version != (JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER) + && awt->version != JAWT_VERSION_1_7 + && awt->version != JAWT_VERSION_9) { return JNI_FALSE; } @@ -58,6 +59,11 @@ awt->Lock = awt_Lock; awt->Unlock = awt_Unlock; awt->GetComponent = awt_GetComponent; + if (awt->version >= JAWT_VERSION_9) { + awt->CreateEmbeddedFrame = awt_CreateEmbeddedFrame; + awt->SetBounds = awt_SetBounds; + awt->SynthesizeWindowActivation = awt_SynthesizeWindowActivation; + } } return JNI_TRUE; --- old/src/java.desktop/share/native/include/jawt.h 2016-08-01 15:07:21.000000000 +0300 +++ new/src/java.desktop/share/native/include/jawt.h 2016-08-01 15:07:21.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -33,7 +33,7 @@ #endif /* - * AWT native interface (new in JDK 1.3) + * AWT native interface. * * The AWT native interface allows a native C or C++ application a means * by which to access native structures in AWT. This is to facilitate moving @@ -279,6 +279,49 @@ */ jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); + /** + * Since 9 + * Creates a java.awt.Frame placed in a native container. Container is + * referenced by the native platform handle. For example on Windows this + * corresponds to an HWND. For other platforms, see the appropriate + * machine-dependent header file for a description. The reference returned + * by this function is a local reference that is only valid in this + * environment. This function returns a NULL reference if no frame could be + * creates with matching platform information. + */ + jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo); + + /** + * Since 9 + * Moves and resize the embedded frame. The new location of the top-left + * corner is specified by x and y parameters relative to the native parent + * component. The new size is specified by width and height. + * + * The embedded frame should be created by CreateEmbeddedFrame() method, or + * this function will not have any effect. + * + * setLocation() and setBounds() for EmbeddedFrame really don't move it + * within the native parent. These methods always put embedded frame to + * (0, 0) for backward compatibility. To allow moving embedded frames + * this method was introduced, and it work just the same way as + * setLocation() and setBounds() for usual, non-embedded components. + * + * Using usual get/setLocation() and get/setBounds() together with this new + * method is not recommended. + */ + void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame, + jint x, jint y, jint w, jint h); + /** + * Since 9 + * Synthesize native message to activate or deactivate EmbeddedFrame window + * depending on the value of parameter doActivate, if "true" activates the + * window; otherwise, deactivates the window. + * + * The embedded frame should be created by CreateEmbeddedFrame() method, or + * this function will not have any effect. + */ + void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env, + jobject embeddedFrame, jboolean doActivate); } JAWT; /* @@ -291,6 +334,7 @@ #define JAWT_VERSION_1_3 0x00010003 #define JAWT_VERSION_1_4 0x00010004 #define JAWT_VERSION_1_7 0x00010007 +#define JAWT_VERSION_9 0x00010009 #ifdef __cplusplus } /* extern "C" */ --- old/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h 2016-08-01 15:07:22.000000000 +0300 +++ new/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h 2016-08-01 15:07:21.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -28,7 +28,6 @@ #include #include -#include _JNI_IMPORT_OR_EXPORT_ JAWT_DrawingSurface* JNICALL awt_GetDrawingSurface(JNIEnv* env, jobject target); @@ -45,4 +44,14 @@ _JNI_IMPORT_OR_EXPORT_ jobject JNICALL awt_GetComponent(JNIEnv* env, void* platformInfo); +_JNI_IMPORT_OR_EXPORT_ jobject JNICALL + awt_CreateEmbeddedFrame(JNIEnv* env, void* platformInfo); + +_JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SetBounds(JNIEnv *env, jobject embeddedFrame, jint x, jint y, + jint w, jint h); + +_JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SynthesizeWindowActivation(JNIEnv *env, jobject embeddedFrame, + jboolean doActivate); #endif /* !_AWT_DRAWING_SURFACE_H_ */ --- old/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c 2016-08-01 15:07:22.000000000 +0300 +++ new/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c 2016-08-01 15:07:22.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -383,3 +383,48 @@ return target; } + +// EmbeddedFrame support + +static char *const embeddedClassName = "sun/awt/X11/XEmbeddedFrame"; + +JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame +(JNIEnv* env, void* platformInfo) +{ + static jmethodID mid = NULL; + static jclass cls; + if (mid == NULL) { + cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL_RETURN(cls, NULL); + mid = (*env)->GetMethodID(env, cls, "", "(JZ)V"); + CHECK_NULL_RETURN(mid, NULL); + } + return (*env)->NewObject(env, cls, mid, platformInfo, JNI_TRUE); +} + + +JNIEXPORT void JNICALL awt_SetBounds +(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "setBoundsPrivate", "(IIII)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, x, y, w, h); +} + +JNIEXPORT void JNICALL awt_SynthesizeWindowActivation +(JNIEnv *env, jobject embeddedFrame, jboolean doActivate) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "synthesizeWindowActivation", "(Z)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, doActivate); +} --- old/src/java.desktop/unix/native/libjawt/jawt.c 2016-08-01 15:07:23.000000000 +0300 +++ new/src/java.desktop/unix/native/libjawt/jawt.c 2016-08-01 15:07:23.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -49,7 +49,8 @@ if (awt->version != JAWT_VERSION_1_3 && awt->version != JAWT_VERSION_1_4 - && awt->version != JAWT_VERSION_1_7) { + && awt->version != JAWT_VERSION_1_7 + && awt->version != JAWT_VERSION_9) { return JNI_FALSE; } @@ -59,6 +60,11 @@ awt->Lock = awt_Lock; awt->Unlock = awt_Unlock; awt->GetComponent = awt_GetComponent; + if (awt->version >= JAWT_VERSION_9) { + awt->CreateEmbeddedFrame = awt_CreateEmbeddedFrame; + awt->SetBounds = awt_SetBounds; + awt->SynthesizeWindowActivation = awt_SynthesizeWindowActivation; + } } return JNI_TRUE; --- old/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp 2016-08-01 15:07:24.000000000 +0300 +++ new/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp 2016-08-01 15:07:23.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -272,3 +272,47 @@ { // Do nothing on Windows } + +// EmbeddedFrame support + +static char *const embeddedClassName = "sun/awt/windows/WEmbeddedFrame"; + +JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame +(JNIEnv* env, void* platformInfo) +{ + static jmethodID mid = NULL; + static jclass cls; + if (mid == NULL) { + cls = env->FindClass(embeddedClassName); + CHECK_NULL_RETURN(cls, NULL); + mid = env->GetMethodID(cls, "", "(J)V"); + CHECK_NULL_RETURN(mid, NULL); + } + return env->NewObject(cls, mid, platformInfo); +} + +JNIEXPORT void JNICALL awt_SetBounds +(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = env->FindClass(embeddedClassName); + CHECK_NULL(cls); + mid = env->GetMethodID(cls, "setBoundsPrivate", "(IIII)V"); + CHECK_NULL(mid); + } + env->CallVoidMethod(embeddedFrame, mid, x, y, w, h); +} + +JNIEXPORT void JNICALL awt_SynthesizeWindowActivation +(JNIEnv *env, jobject embeddedFrame, jboolean doActivate) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = env->FindClass(embeddedClassName); + CHECK_NULL(cls); + mid = env->GetMethodID(cls, "synthesizeWindowActivation", "(Z)V"); + CHECK_NULL(mid); + } + env->CallVoidMethod(embeddedFrame, mid, doActivate); +} --- old/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h 2016-08-01 15:07:24.000000000 +0300 +++ new/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h 2016-08-01 15:07:24.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -162,6 +162,16 @@ jobject JNICALL DSGetComponent( JNIEnv* env, void* platformInfo); + _JNI_IMPORT_OR_EXPORT_ jobject JNICALL + awt_CreateEmbeddedFrame(JNIEnv* env, void* platformInfo); + + _JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SetBounds(JNIEnv *env, jobject embeddedFrame, jint x, + jint y, jint w, jint h); + + _JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SynthesizeWindowActivation(JNIEnv *env, jobject embeddedFrame, + jboolean doActivate); #ifdef __cplusplus } /* extern "C" */ #endif --- old/src/java.desktop/windows/native/libjawt/jawt.cpp 2016-08-01 15:07:25.000000000 +0300 +++ new/src/java.desktop/windows/native/libjawt/jawt.cpp 2016-08-01 15:07:25.000000000 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -46,7 +46,9 @@ } if (awt->version != JAWT_VERSION_1_3 - && awt->version != JAWT_VERSION_1_4) { + && awt->version != JAWT_VERSION_1_4 + && awt->version != JAWT_VERSION_1_7 + && awt->version != JAWT_VERSION_9) { return JNI_FALSE; } @@ -56,6 +58,11 @@ awt->Lock = DSLockAWT; awt->Unlock = DSUnlockAWT; awt->GetComponent = DSGetComponent; + if (awt->version >= JAWT_VERSION_9) { + awt->CreateEmbeddedFrame = awt_CreateEmbeddedFrame; + awt->SetBounds = awt_SetBounds; + awt->SynthesizeWindowActivation = awt_SynthesizeWindowActivation; + } } return JNI_TRUE;