1045
1046 return ret;
1047 }
1048
1049 private static boolean isDesktopWindow( long wi ) {
1050 return XWM.getWM().isDesktopWindow( wi );
1051 }
1052
1053 private void updateAlwaysOnTop() {
1054 if (log.isLoggable(PlatformLogger.Level.FINE)) {
1055 log.fine("Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop));
1056 }
1057 XWM.getWM().setLayer(this,
1058 alwaysOnTop ?
1059 XLayerProtocol.LAYER_ALWAYS_ON_TOP :
1060 XLayerProtocol.LAYER_NORMAL);
1061 }
1062
1063 public void updateAlwaysOnTopState() {
1064 this.alwaysOnTop = ((Window) this.target).isAlwaysOnTop();
1065 updateAlwaysOnTop();
1066 }
1067
1068 boolean isLocationByPlatform() {
1069 return locationByPlatform;
1070 }
1071
1072 private void promoteDefaultPosition() {
1073 this.locationByPlatform = ((Window)target).isLocationByPlatform();
1074 if (locationByPlatform) {
1075 XToolkit.awtLock();
1076 try {
1077 Rectangle bounds = getBounds();
1078 XSizeHints hints = getHints();
1079 setSizeHints(hints.get_flags() & ~(XUtilConstants.USPosition | XUtilConstants.PPosition),
1080 bounds.x, bounds.y, bounds.width, bounds.height);
1081 } finally {
1082 XToolkit.awtUnlock();
1083 }
1084 }
1630 if ((window == null) || (transientForWindow == null)) {
1631 return;
1632 }
1633 if (updateChain) {
1634 window.prevTransientFor = transientForWindow;
1635 transientForWindow.nextTransientFor = window;
1636 }
1637 if (window.curRealTransientFor == transientForWindow) {
1638 return;
1639 }
1640 if (!allStates && (window.getWMState() != transientForWindow.getWMState())) {
1641 return;
1642 }
1643 if (window.getScreenNumber() != transientForWindow.getScreenNumber()) {
1644 return;
1645 }
1646 long bpw = window.getWindow();
1647 while (!XlibUtil.isToplevelWindow(bpw) && !XlibUtil.isXAWTToplevelWindow(bpw)) {
1648 bpw = XlibUtil.getParentWindow(bpw);
1649 }
1650 long tpw = transientForWindow.getWindow();
1651 while (!XlibUtil.isToplevelWindow(tpw) && !XlibUtil.isXAWTToplevelWindow(tpw)) {
1652 tpw = XlibUtil.getParentWindow(tpw);
1653 }
1654 XlibWrapper.XSetTransientFor(XToolkit.getDisplay(), bpw, tpw);
1655 window.curRealTransientFor = transientForWindow;
1656 }
1657
1658 /*
1659 * This method does nothing if this window is not blocked by any modal dialog.
1660 * For modal blocked windows this method looks up for the nearest
1661 * prevTransiendFor window that is in the same state (Normal/Iconified/Withdrawn)
1662 * as this one and makes this window transient for it. The same operation is
1663 * performed for nextTransientFor window.
1664 * Values of prevTransientFor and nextTransientFor fields are not changed.
1665 */
1666 void updateTransientFor() {
1667 int state = getWMState();
1668 XWindowPeer p = prevTransientFor;
1669 while ((p != null) && ((p.getWMState() != state) || (p.getScreenNumber() != getScreenNumber()))) {
1929 }
1930
1931 // This method is to be overriden in XDecoratedPeer.
1932 void setActualFocusedWindow(XWindowPeer actualFocusedWindow) {
1933 }
1934
1935 /**
1936 * Applies the current window type.
1937 */
1938 private void applyWindowType() {
1939 XNETProtocol protocol = XWM.getWM().getNETProtocol();
1940 if (protocol == null) {
1941 return;
1942 }
1943
1944 XAtom typeAtom = null;
1945
1946 switch (getWindowType())
1947 {
1948 case NORMAL:
1949 typeAtom = (ownerPeer == null) ?
1950 protocol.XA_NET_WM_WINDOW_TYPE_NORMAL :
1951 protocol.XA_NET_WM_WINDOW_TYPE_DIALOG;
1952 break;
1953 case UTILITY:
1954 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY;
1955 break;
1956 case POPUP:
1957 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_POPUP_MENU;
1958 break;
1959 }
1960
1961 if (typeAtom != null) {
1962 XAtomList wtype = new XAtomList();
1963 wtype.add(typeAtom);
1964 protocol.XA_NET_WM_WINDOW_TYPE.
1965 setAtomListProperty(getWindow(), wtype);
1966 } else {
1967 protocol.XA_NET_WM_WINDOW_TYPE.
1968 DeleteProperty(getWindow());
1969 }
|
1045
1046 return ret;
1047 }
1048
1049 private static boolean isDesktopWindow( long wi ) {
1050 return XWM.getWM().isDesktopWindow( wi );
1051 }
1052
1053 private void updateAlwaysOnTop() {
1054 if (log.isLoggable(PlatformLogger.Level.FINE)) {
1055 log.fine("Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop));
1056 }
1057 XWM.getWM().setLayer(this,
1058 alwaysOnTop ?
1059 XLayerProtocol.LAYER_ALWAYS_ON_TOP :
1060 XLayerProtocol.LAYER_NORMAL);
1061 }
1062
1063 public void updateAlwaysOnTopState() {
1064 this.alwaysOnTop = ((Window) this.target).isAlwaysOnTop();
1065 if (ownerPeer != null) {
1066 XToolkit.awtLock();
1067 try {
1068 applyWindowType();
1069 restoreTransientFor(this);
1070 }
1071 finally {
1072 XToolkit.awtUnlock();
1073 }
1074 }
1075 updateAlwaysOnTop();
1076 }
1077
1078 boolean isLocationByPlatform() {
1079 return locationByPlatform;
1080 }
1081
1082 private void promoteDefaultPosition() {
1083 this.locationByPlatform = ((Window)target).isLocationByPlatform();
1084 if (locationByPlatform) {
1085 XToolkit.awtLock();
1086 try {
1087 Rectangle bounds = getBounds();
1088 XSizeHints hints = getHints();
1089 setSizeHints(hints.get_flags() & ~(XUtilConstants.USPosition | XUtilConstants.PPosition),
1090 bounds.x, bounds.y, bounds.width, bounds.height);
1091 } finally {
1092 XToolkit.awtUnlock();
1093 }
1094 }
1640 if ((window == null) || (transientForWindow == null)) {
1641 return;
1642 }
1643 if (updateChain) {
1644 window.prevTransientFor = transientForWindow;
1645 transientForWindow.nextTransientFor = window;
1646 }
1647 if (window.curRealTransientFor == transientForWindow) {
1648 return;
1649 }
1650 if (!allStates && (window.getWMState() != transientForWindow.getWMState())) {
1651 return;
1652 }
1653 if (window.getScreenNumber() != transientForWindow.getScreenNumber()) {
1654 return;
1655 }
1656 long bpw = window.getWindow();
1657 while (!XlibUtil.isToplevelWindow(bpw) && !XlibUtil.isXAWTToplevelWindow(bpw)) {
1658 bpw = XlibUtil.getParentWindow(bpw);
1659 }
1660 if (!transientForWindow.isVisible()) {
1661 XlibWrapper.XSetTransientFor(XToolkit.getDisplay(), bpw, XToolkit.getDefaultRootWindow());
1662 window.curRealTransientFor = null;
1663 return;
1664 }
1665 long tpw = transientForWindow.getWindow();
1666 while (!XlibUtil.isToplevelWindow(tpw) && !XlibUtil.isXAWTToplevelWindow(tpw)) {
1667 tpw = XlibUtil.getParentWindow(tpw);
1668 }
1669 XlibWrapper.XSetTransientFor(XToolkit.getDisplay(), bpw, tpw);
1670 window.curRealTransientFor = transientForWindow;
1671 }
1672
1673 /*
1674 * This method does nothing if this window is not blocked by any modal dialog.
1675 * For modal blocked windows this method looks up for the nearest
1676 * prevTransiendFor window that is in the same state (Normal/Iconified/Withdrawn)
1677 * as this one and makes this window transient for it. The same operation is
1678 * performed for nextTransientFor window.
1679 * Values of prevTransientFor and nextTransientFor fields are not changed.
1680 */
1681 void updateTransientFor() {
1682 int state = getWMState();
1683 XWindowPeer p = prevTransientFor;
1684 while ((p != null) && ((p.getWMState() != state) || (p.getScreenNumber() != getScreenNumber()))) {
1944 }
1945
1946 // This method is to be overriden in XDecoratedPeer.
1947 void setActualFocusedWindow(XWindowPeer actualFocusedWindow) {
1948 }
1949
1950 /**
1951 * Applies the current window type.
1952 */
1953 private void applyWindowType() {
1954 XNETProtocol protocol = XWM.getWM().getNETProtocol();
1955 if (protocol == null) {
1956 return;
1957 }
1958
1959 XAtom typeAtom = null;
1960
1961 switch (getWindowType())
1962 {
1963 case NORMAL:
1964 typeAtom = ownerPeer == null || !ownerPeer.isVisible() ?
1965 protocol.XA_NET_WM_WINDOW_TYPE_NORMAL :
1966 protocol.XA_NET_WM_WINDOW_TYPE_DIALOG;
1967 break;
1968 case UTILITY:
1969 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY;
1970 break;
1971 case POPUP:
1972 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_POPUP_MENU;
1973 break;
1974 }
1975
1976 if (typeAtom != null) {
1977 XAtomList wtype = new XAtomList();
1978 wtype.add(typeAtom);
1979 protocol.XA_NET_WM_WINDOW_TYPE.
1980 setAtomListProperty(getWindow(), wtype);
1981 } else {
1982 protocol.XA_NET_WM_WINDOW_TYPE.
1983 DeleteProperty(getWindow());
1984 }
|