< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 100 {
 101     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 102 
 103     jobject target = NULL;
 104     AwtDialog* dialog = NULL;
 105 
 106     try {
 107         if (env->EnsureLocalCapacity(2) < 0) {
 108             return NULL;
 109         }
 110 
 111         PDATA pData;
 112         AwtWindow* awtParent = NULL;
 113         HWND hwndParent = NULL;
 114         target = env->GetObjectField(peer, AwtObject::targetID);
 115         JNI_CHECK_NULL_GOTO(target, "null target", done);
 116 
 117         if (parent != NULL) {
 118             JNI_CHECK_PEER_GOTO(parent, done);
 119             awtParent = (AwtWindow *)(JNI_GET_PDATA(parent));
 120             hwndParent = awtParent->GetHWnd();

 121         } else {
 122             // There is no way to prevent a parentless dialog from showing on
 123             //  the taskbar other than to specify an invisible parent and set
 124             //  WS_POPUP style for the dialog. Using toolkit window here. That
 125             //  will also excludes the dialog from appearing in window list while
 126             //  ALT+TAB'ing
 127             // From the other point, it may be confusing when the dialog without
 128             //  an owner is missing on the toolbar. So, do not set any fake
 129             //  parent window here.
 130 //            hwndParent = AwtToolkit::GetInstance().GetHWnd();
 131         }
 132         dialog = new AwtDialog();
 133 
 134         {
 135             int colorId = COLOR_3DFACE;
 136             DWORD style = WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN;
 137             if (hwndParent != NULL) {
 138                 style |= WS_POPUP;
 139             }
 140             style &= ~(WS_MINIMIZEBOX|WS_MAXIMIZEBOX);


   1 /*
   2  * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 100 {
 101     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 102 
 103     jobject target = NULL;
 104     AwtDialog* dialog = NULL;
 105 
 106     try {
 107         if (env->EnsureLocalCapacity(2) < 0) {
 108             return NULL;
 109         }
 110 
 111         PDATA pData;
 112         AwtWindow* awtParent = NULL;
 113         HWND hwndParent = NULL;
 114         target = env->GetObjectField(peer, AwtObject::targetID);
 115         JNI_CHECK_NULL_GOTO(target, "null target", done);
 116 
 117         if (parent != NULL) {
 118             JNI_CHECK_PEER_GOTO(parent, done);
 119             awtParent = (AwtWindow *)(JNI_GET_PDATA(parent));
 120             HWND oHWnd = awtParent->GetOverriddenHWnd();
 121             hwndParent = oHWnd ? oHWnd : awtParent->GetHWnd();
 122         } else {
 123             // There is no way to prevent a parentless dialog from showing on
 124             //  the taskbar other than to specify an invisible parent and set
 125             //  WS_POPUP style for the dialog. Using toolkit window here. That
 126             //  will also excludes the dialog from appearing in window list while
 127             //  ALT+TAB'ing
 128             // From the other point, it may be confusing when the dialog without
 129             //  an owner is missing on the toolbar. So, do not set any fake
 130             //  parent window here.
 131 //            hwndParent = AwtToolkit::GetInstance().GetHWnd();
 132         }
 133         dialog = new AwtDialog();
 134 
 135         {
 136             int colorId = COLOR_3DFACE;
 137             DWORD style = WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN;
 138             if (hwndParent != NULL) {
 139                 style |= WS_POPUP;
 140             }
 141             style &= ~(WS_MINIMIZEBOX|WS_MAXIMIZEBOX);


< prev index next >