src/solaris/classes/sun/awt/X11/XDialogPeer.java

Print this page


   1 /*
   2  * Copyright (c) 2002, 2008, 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


  30 import java.awt.event.*;
  31 import sun.awt.AWTAccessor;
  32 
  33 import sun.awt.*;
  34 
  35 class XDialogPeer extends XDecoratedPeer implements DialogPeer {
  36 
  37     private Boolean undecorated;
  38 
  39     XDialogPeer(Dialog target) {
  40         super(target);
  41     }
  42 
  43     public void preInit(XCreateWindowParams params) {
  44         super.preInit(params);
  45 
  46         Dialog target = (Dialog)(this.target);
  47         undecorated = Boolean.valueOf(target.isUndecorated());
  48         winAttr.nativeDecor = !target.isUndecorated();
  49         if (winAttr.nativeDecor) {
  50             winAttr.decorations = winAttr.AWT_DECOR_ALL;
  51         } else {
  52             winAttr.decorations = winAttr.AWT_DECOR_NONE;
  53         }
  54         winAttr.functions = MWMConstants.MWM_FUNC_ALL;
  55         winAttr.isResizable =  true; //target.isResizable();
  56         winAttr.initialResizability =  target.isResizable();
  57         winAttr.title = target.getTitle();
  58         winAttr.initialState = XWindowAttributesData.NORMAL;
  59     }
  60 
  61     public void setVisible(boolean vis) {
  62         XToolkit.awtLock();
  63         try {
  64             Dialog target = (Dialog)this.target;
  65             if (vis) {
  66                 if (target.getModalityType() != Dialog.ModalityType.MODELESS) {
  67                     if (!isModalBlocked()) {
  68                         XBaseWindow.ungrabInput();
  69                     }
  70                 }
  71             } else {
  72                 restoreTransientFor(this);


   1 /*
   2  * Copyright (c) 2002, 2014, 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


  30 import java.awt.event.*;
  31 import sun.awt.AWTAccessor;
  32 
  33 import sun.awt.*;
  34 
  35 class XDialogPeer extends XDecoratedPeer implements DialogPeer {
  36 
  37     private Boolean undecorated;
  38 
  39     XDialogPeer(Dialog target) {
  40         super(target);
  41     }
  42 
  43     public void preInit(XCreateWindowParams params) {
  44         super.preInit(params);
  45 
  46         Dialog target = (Dialog)(this.target);
  47         undecorated = Boolean.valueOf(target.isUndecorated());
  48         winAttr.nativeDecor = !target.isUndecorated();
  49         if (winAttr.nativeDecor) {
  50             winAttr.decorations = XWindowAttributesData.AWT_DECOR_ALL;
  51         } else {
  52             winAttr.decorations = XWindowAttributesData.AWT_DECOR_NONE;
  53         }
  54         winAttr.functions = MWMConstants.MWM_FUNC_ALL;
  55         winAttr.isResizable =  true; //target.isResizable();
  56         winAttr.initialResizability =  target.isResizable();
  57         winAttr.title = target.getTitle();
  58         winAttr.initialState = XWindowAttributesData.NORMAL;
  59     }
  60 
  61     public void setVisible(boolean vis) {
  62         XToolkit.awtLock();
  63         try {
  64             Dialog target = (Dialog)this.target;
  65             if (vis) {
  66                 if (target.getModalityType() != Dialog.ModalityType.MODELESS) {
  67                     if (!isModalBlocked()) {
  68                         XBaseWindow.ungrabInput();
  69                     }
  70                 }
  71             } else {
  72                 restoreTransientFor(this);