< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Window.cpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1996, 2015, 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) 1996, 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
*** 162,171 **** --- 162,176 ---- jint screen; jfloat scaleX; jfloat scaleY; }; + struct OverrideHandle { + jobject frame; + HWND handle; + }; + /************************************************************************ * AwtWindow fields */ jfieldID AwtWindow::warningStringID;
*** 240,249 **** --- 245,255 ---- fullScreenExclusiveModeState = FALSE; m_winSizeMove = FALSE; prevScaleRec.screen = -1; prevScaleRec.scaleX = -1.0f; prevScaleRec.scaleY = -1.0f; + m_overridenHwnd = NULL; } AwtWindow::~AwtWindow() { if (warningString != NULL) {
*** 2569,2578 **** --- 2575,2602 ---- env->DeleteGlobalRef(self); delete rfs; } + void AwtWindow::_OverrideHandle(void *param) + { + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + + OverrideHandle* oh = (OverrideHandle *) param; + jobject self = oh->frame; + AwtWindow *f = NULL; + + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + f = (AwtWindow *)pData; + f->OverrideHWnd(oh->handle); + ret: + env->DeleteGlobalRef(self); + + delete oh; + } + /* * This is AwtWindow-specific function that is not intended for reusing */ HICON CreateIconFromRaster(JNIEnv* env, jintArray iconRaster, jint w, jint h) {
*** 3947,3952 **** --- 3971,3997 ---- AwtToolkit::GetInstance().InvokeFunction(AwtWindow::_WindowDPIChange, ss); // global refs and ss are deleted in _WindowDPIChange CATCH_BAD_ALLOC; } + + /* + * Class: sun_awt_windows_WLightweightFramePeer + * Method: overrideNativeHandle + * Signature: (J)V + */ + JNIEXPORT void JNICALL Java_sun_awt_windows_WLightweightFramePeer_overrideNativeHandle + (JNIEnv *env, jobject self, jlong hwnd) + { + TRY; + + OverrideHandle *oh = new OverrideHandle; + oh->frame = env->NewGlobalRef(self); + oh->handle = (HWND) hwnd; + + AwtToolkit::GetInstance().SyncCall(AwtFrame::_OverrideHandle, oh); + // global ref and oh are deleted in _OverrideHandle() + + CATCH_BAD_ALLOC; + } + } /* extern "C" */
< prev index next >