85 private XWindowPeer ownerPeer; |
85 private XWindowPeer ownerPeer; |
86 |
86 |
87 // used for modal blocking to keep existing z-order |
87 // used for modal blocking to keep existing z-order |
88 protected XWindowPeer prevTransientFor, nextTransientFor; |
88 protected XWindowPeer prevTransientFor, nextTransientFor; |
89 // value of WM_TRANSIENT_FOR hint set on this window |
89 // value of WM_TRANSIENT_FOR hint set on this window |
90 private XWindowPeer curRealTransientFor; |
90 private XBaseWindow curRealTransientFor; |
91 |
91 |
92 private boolean grab = false; // Whether to do a grab during showing |
92 private boolean grab = false; // Whether to do a grab during showing |
93 |
93 |
94 private boolean isMapped = false; // Is this window mapped or not |
94 private boolean isMapped = false; // Is this window mapped or not |
95 private boolean mustControlStackPosition = false; // Am override-redirect not on top |
95 private boolean mustControlStackPosition = false; // Am override-redirect not on top |
1063 private void updateAlwaysOnTop() { |
1063 private void updateAlwaysOnTop() { |
1064 if (log.isLoggable(PlatformLogger.Level.FINE)) { |
1064 if (log.isLoggable(PlatformLogger.Level.FINE)) { |
1065 log.fine("Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop)); |
1065 log.fine("Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop)); |
1066 } |
1066 } |
1067 XWM.getWM().setLayer(this, |
1067 XWM.getWM().setLayer(this, |
1068 alwaysOnTop ? |
1068 alwaysOnTop ? |
1069 XLayerProtocol.LAYER_ALWAYS_ON_TOP : |
1069 XLayerProtocol.LAYER_ALWAYS_ON_TOP : |
1070 XLayerProtocol.LAYER_NORMAL); |
1070 XLayerProtocol.LAYER_NORMAL); |
1071 } |
1071 } |
1072 |
1072 |
1073 public void updateAlwaysOnTopState() { |
1073 public void updateAlwaysOnTopState() { |
1074 this.alwaysOnTop = ((Window) this.target).isAlwaysOnTop(); |
1074 this.alwaysOnTop = ((Window) this.target).isAlwaysOnTop(); |
|
1075 if (ownerPeer != null) { |
|
1076 XToolkit.awtLock(); |
|
1077 try { |
|
1078 restoreTransientFor(this); |
|
1079 applyWindowType(); |
|
1080 } |
|
1081 finally { |
|
1082 XToolkit.awtUnlock(); |
|
1083 } |
|
1084 } |
1075 updateAlwaysOnTop(); |
1085 updateAlwaysOnTop(); |
1076 } |
1086 } |
1077 |
1087 |
1078 boolean isLocationByPlatform() { |
1088 boolean isLocationByPlatform() { |
1079 return locationByPlatform; |
1089 return locationByPlatform; |
1113 updateFocusability(); |
1123 updateFocusability(); |
1114 promoteDefaultPosition(); |
1124 promoteDefaultPosition(); |
1115 if (!vis && warningWindow != null) { |
1125 if (!vis && warningWindow != null) { |
1116 warningWindow.setSecurityWarningVisible(false, false); |
1126 warningWindow.setSecurityWarningVisible(false, false); |
1117 } |
1127 } |
|
1128 boolean refreshChildsTransientFor = isVisible() != vis; |
1118 super.setVisible(vis); |
1129 super.setVisible(vis); |
|
1130 if (refreshChildsTransientFor) { |
|
1131 for (Window child : ((Window) target).getOwnedWindows()) { |
|
1132 XToolkit.awtLock(); |
|
1133 try { |
|
1134 if(!child.isLightweight() && child.isVisible()) { |
|
1135 ComponentPeer childPeer = AWTAccessor. |
|
1136 getComponentAccessor().getPeer(child); |
|
1137 if(childPeer instanceof XWindowPeer) { |
|
1138 XWindowPeer windowPeer = (XWindowPeer) childPeer; |
|
1139 restoreTransientFor(windowPeer); |
|
1140 windowPeer.applyWindowType(); |
|
1141 } |
|
1142 } |
|
1143 } |
|
1144 finally { |
|
1145 XToolkit.awtUnlock(); |
|
1146 } |
|
1147 } |
|
1148 } |
1119 if (!vis && !isWithdrawn()) { |
1149 if (!vis && !isWithdrawn()) { |
1120 // ICCCM, 4.1.4. Changing Window State: |
1150 // ICCCM, 4.1.4. Changing Window State: |
1121 // "Iconic -> Withdrawn - The client should unmap the window and follow it |
1151 // "Iconic -> Withdrawn - The client should unmap the window and follow it |
1122 // with a synthetic UnmapNotify event as described later in this section." |
1152 // with a synthetic UnmapNotify event as described later in this section." |
1123 // The same is true for Normal -> Withdrawn |
1153 // The same is true for Normal -> Withdrawn |
1642 } |
1672 } |
1643 if (updateChain) { |
1673 if (updateChain) { |
1644 window.prevTransientFor = transientForWindow; |
1674 window.prevTransientFor = transientForWindow; |
1645 transientForWindow.nextTransientFor = window; |
1675 transientForWindow.nextTransientFor = window; |
1646 } |
1676 } |
1647 if (window.curRealTransientFor == transientForWindow) { |
|
1648 return; |
|
1649 } |
|
1650 if (!allStates && (window.getWMState() != transientForWindow.getWMState())) { |
1677 if (!allStates && (window.getWMState() != transientForWindow.getWMState())) { |
1651 return; |
1678 return; |
1652 } |
1679 } |
1653 if (window.getScreenNumber() != transientForWindow.getScreenNumber()) { |
1680 if (window.getScreenNumber() != transientForWindow.getScreenNumber()) { |
1654 return; |
1681 return; |
1656 long bpw = window.getWindow(); |
1683 long bpw = window.getWindow(); |
1657 while (!XlibUtil.isToplevelWindow(bpw) && !XlibUtil.isXAWTToplevelWindow(bpw)) { |
1684 while (!XlibUtil.isToplevelWindow(bpw) && !XlibUtil.isXAWTToplevelWindow(bpw)) { |
1658 bpw = XlibUtil.getParentWindow(bpw); |
1685 bpw = XlibUtil.getParentWindow(bpw); |
1659 } |
1686 } |
1660 long tpw = transientForWindow.getWindow(); |
1687 long tpw = transientForWindow.getWindow(); |
1661 while (!XlibUtil.isToplevelWindow(tpw) && !XlibUtil.isXAWTToplevelWindow(tpw)) { |
1688 XBaseWindow parent = transientForWindow; |
|
1689 while (tpw != 0 && ((!XlibUtil.isToplevelWindow(tpw) && |
|
1690 !XlibUtil.isXAWTToplevelWindow(tpw)) || !parent.isVisible())) { |
1662 tpw = XlibUtil.getParentWindow(tpw); |
1691 tpw = XlibUtil.getParentWindow(tpw); |
|
1692 parent = XToolkit.windowToXWindow(tpw); |
1663 } |
1693 } |
1664 XlibWrapper.XSetTransientFor(XToolkit.getDisplay(), bpw, tpw); |
1694 XlibWrapper.XSetTransientFor(XToolkit.getDisplay(), bpw, tpw); |
1665 window.curRealTransientFor = transientForWindow; |
1695 window.curRealTransientFor = parent; |
1666 } |
1696 } |
1667 |
1697 |
1668 /* |
1698 /* |
1669 * This method does nothing if this window is not blocked by any modal dialog. |
1699 * This method does nothing if this window is not blocked by any modal dialog. |
1670 * For modal blocked windows this method looks up for the nearest |
1700 * For modal blocked windows this method looks up for the nearest |
1954 XAtom typeAtom = null; |
1984 XAtom typeAtom = null; |
1955 |
1985 |
1956 switch (getWindowType()) |
1986 switch (getWindowType()) |
1957 { |
1987 { |
1958 case NORMAL: |
1988 case NORMAL: |
1959 typeAtom = (ownerPeer == null) ? |
1989 typeAtom = curRealTransientFor == null ? |
1960 protocol.XA_NET_WM_WINDOW_TYPE_NORMAL : |
1990 protocol.XA_NET_WM_WINDOW_TYPE_NORMAL : |
1961 protocol.XA_NET_WM_WINDOW_TYPE_DIALOG; |
1991 protocol.XA_NET_WM_WINDOW_TYPE_DIALOG; |
1962 break; |
1992 break; |
1963 case UTILITY: |
1993 case UTILITY: |
1964 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY; |
1994 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY; |