1007 */ 1008 window.xSetVisible(false); 1009 XToolkit.XSync(); 1010 window.xSetVisible(true); 1011 } 1012 } 1013 1014 /* 1015 * Make specified shell resizable. 1016 */ 1017 static void setShellResizable(XDecoratedPeer window) { 1018 if (insLog.isLoggable(PlatformLogger.Level.FINE)) { 1019 insLog.fine("Setting shell resizable " + window); 1020 } 1021 XToolkit.awtLock(); 1022 try { 1023 Rectangle shellBounds = window.getShellBounds(); 1024 shellBounds.translate(-window.currentInsets.left, -window.currentInsets.top); 1025 window.updateSizeHints(window.getDimensions()); 1026 requestWMExtents(window.getWindow()); 1027 XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), window.getShell(), 1028 shellBounds.x, shellBounds.y, shellBounds.width, shellBounds.height); 1029 /* REMINDER: will need to revisit when setExtendedStateBounds is added */ 1030 //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced. 1031 //We need to update frame's minimum size, not to reset it 1032 removeSizeHints(window, XUtilConstants.PMaxSize); 1033 window.updateMinimumSize(); 1034 1035 /* Restore decorations */ 1036 setShellDecor(window); 1037 } finally { 1038 XToolkit.awtUnlock(); 1039 } 1040 } 1041 1042 /* 1043 * Make specified shell non-resizable. 1044 * If justChangeSize is false, update decorations as well. 1045 * @param shellBounds bounds of the shell window 1046 */ 1047 static void setShellNotResizable(XDecoratedPeer window, WindowDimensions newDimensions, Rectangle shellBounds, 1048 boolean justChangeSize) 1049 { 1050 if (insLog.isLoggable(PlatformLogger.Level.FINE)) { 1051 insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions + 1052 ", shellBounds " + shellBounds +", just change size: " + justChangeSize); 1053 } 1054 XToolkit.awtLock(); 1055 try { 1056 /* Fix min/max size hints at the specified values */ 1057 if (!shellBounds.isEmpty()) { 1058 window.updateSizeHints(newDimensions); 1059 requestWMExtents(window.getWindow()); 1060 XToolkit.XSync(); 1061 XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), window.getShell(), 1062 shellBounds.x, shellBounds.y, shellBounds.width, shellBounds.height); 1063 } 1064 if (!justChangeSize) { /* update decorations */ 1065 setShellDecor(window); 1066 } 1067 } finally { 1068 XToolkit.awtUnlock(); 1069 } 1070 } 1071 1072 /*****************************************************************************\ 1073 * Protocols support 1074 */ 1075 private HashMap<Class<?>, Collection<?>> protocolsMap = new HashMap<Class<?>, Collection<?>>(); 1076 /** 1077 * Returns all protocols supporting given protocol interface 1078 */ 1079 <T> Collection<T> getProtocols(Class<T> protocolInterface) { 1080 @SuppressWarnings("unchecked") 1081 Collection<T> res = (Collection<T>) protocolsMap.get(protocolInterface); 1082 if (res != null) { 1684 * rest of the code is happily unaware about border 1685 * widths and inner/outer distinction, so for the time 1686 * being, just ignore it. 1687 */ 1688 if (insLog.isLoggable(PlatformLogger.Level.FINEST)) { 1689 insLog.finest("Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}", 1690 lwinAttr, pattr, parent, window); 1691 } 1692 correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(), 1693 lwinAttr.get_x() + lwinAttr.get_border_width(), 1694 pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()), 1695 pattr.get_width() - (lwinAttr.get_x() + lwinAttr.get_width() + 2*lwinAttr.get_border_width())); 1696 break; 1697 } /* default */ 1698 } /* switch (runningWM) */ 1699 } finally { 1700 lwinAttr.dispose(); 1701 pattr.dispose(); 1702 } 1703 } 1704 if (storedInsets.get(win.getClass()) == null) { 1705 storedInsets.put(win.getClass(), correctWM); 1706 } 1707 return correctWM; 1708 } 1709 boolean isDesktopWindow( long w ) { 1710 if (g_net_protocol != null) { 1711 XAtomList wtype = XAtom.get("_NET_WM_WINDOW_TYPE").getAtomListPropertyList( w ); 1712 return wtype.contains( XAtom.get("_NET_WM_WINDOW_TYPE_DESKTOP") ); 1713 } else { 1714 return false; 1715 } 1716 } 1717 1718 public XNETProtocol getNETProtocol() { 1719 return g_net_protocol; 1720 } 1721 1722 /** 1723 * Sets _NET_WN_ICON property on the window using the arrays of | 1007 */ 1008 window.xSetVisible(false); 1009 XToolkit.XSync(); 1010 window.xSetVisible(true); 1011 } 1012 } 1013 1014 /* 1015 * Make specified shell resizable. 1016 */ 1017 static void setShellResizable(XDecoratedPeer window) { 1018 if (insLog.isLoggable(PlatformLogger.Level.FINE)) { 1019 insLog.fine("Setting shell resizable " + window); 1020 } 1021 XToolkit.awtLock(); 1022 try { 1023 Rectangle shellBounds = window.getShellBounds(); 1024 shellBounds.translate(-window.currentInsets.left, -window.currentInsets.top); 1025 window.updateSizeHints(window.getDimensions()); 1026 requestWMExtents(window.getWindow()); 1027 XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), 1028 window.getShell(), 1029 window.scaleUp(shellBounds.x), 1030 window.scaleUp(shellBounds.y), 1031 window.scaleUp(shellBounds.width), 1032 window.scaleUp(shellBounds.height)); 1033 /* REMINDER: will need to revisit when setExtendedStateBounds is added */ 1034 //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced. 1035 //We need to update frame's minimum size, not to reset it 1036 removeSizeHints(window, XUtilConstants.PMaxSize); 1037 window.updateMinimumSize(); 1038 1039 /* Restore decorations */ 1040 setShellDecor(window); 1041 } finally { 1042 XToolkit.awtUnlock(); 1043 } 1044 } 1045 1046 /* 1047 * Make specified shell non-resizable. 1048 * If justChangeSize is false, update decorations as well. 1049 * @param shellBounds bounds of the shell window 1050 */ 1051 static void setShellNotResizable(XDecoratedPeer window, WindowDimensions newDimensions, Rectangle shellBounds, 1052 boolean justChangeSize) 1053 { 1054 if (insLog.isLoggable(PlatformLogger.Level.FINE)) { 1055 insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions + 1056 ", shellBounds " + shellBounds +", just change size: " + justChangeSize); 1057 } 1058 XToolkit.awtLock(); 1059 try { 1060 /* Fix min/max size hints at the specified values */ 1061 if (!shellBounds.isEmpty()) { 1062 window.updateSizeHints(newDimensions); 1063 requestWMExtents(window.getWindow()); 1064 XToolkit.XSync(); 1065 XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), 1066 window.getShell(), 1067 window.scaleUp(shellBounds.x), 1068 window.scaleUp(shellBounds.y), 1069 window.scaleUp(shellBounds.width), 1070 window.scaleUp(shellBounds.height)); 1071 } 1072 if (!justChangeSize) { /* update decorations */ 1073 setShellDecor(window); 1074 } 1075 } finally { 1076 XToolkit.awtUnlock(); 1077 } 1078 } 1079 1080 /*****************************************************************************\ 1081 * Protocols support 1082 */ 1083 private HashMap<Class<?>, Collection<?>> protocolsMap = new HashMap<Class<?>, Collection<?>>(); 1084 /** 1085 * Returns all protocols supporting given protocol interface 1086 */ 1087 <T> Collection<T> getProtocols(Class<T> protocolInterface) { 1088 @SuppressWarnings("unchecked") 1089 Collection<T> res = (Collection<T>) protocolsMap.get(protocolInterface); 1090 if (res != null) { 1692 * rest of the code is happily unaware about border 1693 * widths and inner/outer distinction, so for the time 1694 * being, just ignore it. 1695 */ 1696 if (insLog.isLoggable(PlatformLogger.Level.FINEST)) { 1697 insLog.finest("Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}", 1698 lwinAttr, pattr, parent, window); 1699 } 1700 correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(), 1701 lwinAttr.get_x() + lwinAttr.get_border_width(), 1702 pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()), 1703 pattr.get_width() - (lwinAttr.get_x() + lwinAttr.get_width() + 2*lwinAttr.get_border_width())); 1704 break; 1705 } /* default */ 1706 } /* switch (runningWM) */ 1707 } finally { 1708 lwinAttr.dispose(); 1709 pattr.dispose(); 1710 } 1711 } 1712 1713 correctWM.top = win.scaleUp(correctWM.top); 1714 correctWM.bottom = win.scaleUp(correctWM.bottom); 1715 correctWM.left = win.scaleUp(correctWM.left); 1716 correctWM.right = win.scaleUp(correctWM.right); 1717 1718 if (storedInsets.get(win.getClass()) == null) { 1719 storedInsets.put(win.getClass(), correctWM); 1720 } 1721 return correctWM; 1722 } 1723 boolean isDesktopWindow( long w ) { 1724 if (g_net_protocol != null) { 1725 XAtomList wtype = XAtom.get("_NET_WM_WINDOW_TYPE").getAtomListPropertyList( w ); 1726 return wtype.contains( XAtom.get("_NET_WM_WINDOW_TYPE_DESKTOP") ); 1727 } else { 1728 return false; 1729 } 1730 } 1731 1732 public XNETProtocol getNETProtocol() { 1733 return g_net_protocol; 1734 } 1735 1736 /** 1737 * Sets _NET_WN_ICON property on the window using the arrays of |