src/java.desktop/unix/classes/sun/awt/X11/XDialogPeer.java

Print this page




 100         return d;
 101     }
 102 
 103     int getFunctions() {
 104         int f = super.getFunctions();
 105         // remove minimize and maximize functions for dialogs
 106         if ((f & MWMConstants.MWM_FUNC_ALL) != 0) {
 107             f |= (MWMConstants.MWM_FUNC_MINIMIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
 108         } else {
 109             f &= ~(MWMConstants.MWM_FUNC_MINIMIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
 110         }
 111         return f;
 112     }
 113 
 114     public void blockWindows(java.util.List<Window> toBlock) {
 115         Vector<XWindowPeer> javaToplevels = null;
 116         XToolkit.awtLock();
 117         try {
 118             javaToplevels = XWindowPeer.collectJavaToplevels();
 119             for (Window w : toBlock) {
 120                 XWindowPeer wp = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
 121                 if (wp != null) {
 122                     wp.setModalBlocked((Dialog)target, true, javaToplevels);
 123                 }
 124             }
 125         } finally {
 126             XToolkit.awtUnlock();
 127         }
 128     }
 129 
 130     /*
 131      * WARNING: don't call client code in this method!
 132      *
 133      * The check is performed before the dialog is shown.
 134      * The focused window can't be blocked at the time it's focused.
 135      * Thus we don't have to perform any transitive (a blocker of a blocker) checks.
 136      */
 137     boolean isFocusedWindowModalBlocker() {
 138         Window focusedWindow = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow();
 139         XWindowPeer focusedWindowPeer = null;
 140 
 141         if (focusedWindow != null) {
 142             focusedWindowPeer = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(focusedWindow);
 143         } else {
 144             /*
 145              * For the case when a potential blocked window is not yet focused
 146              * on the Java level (e.g. it's just been mapped) we're asking for the
 147              * focused window on the native level.
 148              */
 149             focusedWindowPeer = getNativeFocusedWindowPeer();
 150         }
 151         synchronized (getStateLock()) {
 152             if (focusedWindowPeer != null && focusedWindowPeer.modalBlocker == target) {
 153                 return true;
 154             }
 155         }
 156         return super.isFocusedWindowModalBlocker();
 157     }
 158 }


 100         return d;
 101     }
 102 
 103     int getFunctions() {
 104         int f = super.getFunctions();
 105         // remove minimize and maximize functions for dialogs
 106         if ((f & MWMConstants.MWM_FUNC_ALL) != 0) {
 107             f |= (MWMConstants.MWM_FUNC_MINIMIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
 108         } else {
 109             f &= ~(MWMConstants.MWM_FUNC_MINIMIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
 110         }
 111         return f;
 112     }
 113 
 114     public void blockWindows(java.util.List<Window> toBlock) {
 115         Vector<XWindowPeer> javaToplevels = null;
 116         XToolkit.awtLock();
 117         try {
 118             javaToplevels = XWindowPeer.collectJavaToplevels();
 119             for (Window w : toBlock) {
 120                 XWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
 121                 if (wp != null) {
 122                     wp.setModalBlocked((Dialog)target, true, javaToplevels);
 123                 }
 124             }
 125         } finally {
 126             XToolkit.awtUnlock();
 127         }
 128     }
 129 
 130     /*
 131      * WARNING: don't call client code in this method!
 132      *
 133      * The check is performed before the dialog is shown.
 134      * The focused window can't be blocked at the time it's focused.
 135      * Thus we don't have to perform any transitive (a blocker of a blocker) checks.
 136      */
 137     boolean isFocusedWindowModalBlocker() {
 138         Window focusedWindow = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow();
 139         XWindowPeer focusedWindowPeer = null;
 140 
 141         if (focusedWindow != null) {
 142             focusedWindowPeer = AWTAccessor.getComponentAccessor().getPeer(focusedWindow);
 143         } else {
 144             /*
 145              * For the case when a potential blocked window is not yet focused
 146              * on the Java level (e.g. it's just been mapped) we're asking for the
 147              * focused window on the native level.
 148              */
 149             focusedWindowPeer = getNativeFocusedWindowPeer();
 150         }
 151         synchronized (getStateLock()) {
 152             if (focusedWindowPeer != null && focusedWindowPeer.modalBlocker == target) {
 153                 return true;
 154             }
 155         }
 156         return super.isFocusedWindowModalBlocker();
 157     }
 158 }