--- old/src/java.desktop/unix/classes/sun/print/IPPPrintService.java 2018-06-05 12:26:19.960041763 -0700 +++ new/src/java.desktop/unix/classes/sun/print/IPPPrintService.java 2018-06-05 12:26:19.716041772 -0700 @@ -25,6 +25,8 @@ package sun.print; +import java.awt.GraphicsEnvironment; +import java.awt.Toolkit; import javax.print.attribute.*; import javax.print.attribute.standard.*; import javax.print.DocFlavor; @@ -1071,6 +1073,11 @@ catList.add(PrinterResolution.class); } + if (GraphicsEnvironment.isHeadless() == false) { + catList.add(DialogOwner.class); + catList.add(DialogTypeSelection.class); + } + supportedCats = new Class[catList.size()]; catList.toArray(supportedCats); Class[] copyCats = new Class[supportedCats.length]; @@ -1392,10 +1399,38 @@ } } return false; - } if (attr.getCategory() == PrinterResolution.class) { + } else if (attr.getCategory() == PrinterResolution.class) { if (attr instanceof PrinterResolution) { return isSupportedResolution((PrinterResolution)attr); } + } else if (attr.getCategory() == DialogOwner.class) { + DialogOwner owner = (DialogOwner)attr; + // ID not supported on any dialog type on Unix platforms. + if (DialogOwnerAccessor.getID(owner) != 0) { + return false; + } + // On Mac we have no control over the native dialog. + DialogTypeSelection dst = (attributes == null) ? null : + (DialogTypeSelection)attributes.get(DialogTypeSelection.class); + if (PrintServiceLookupProvider.isMac() && + dst == DialogTypeSelection.NATIVE) { + return false; + } + // The other case is always a Swing dialog on all Unix platforms. + // So we only need to check that the toolkit supports + // always on top. + if (owner.getOwner() != null) { + return true; + } else { + return Toolkit.getDefaultToolkit().isAlwaysOnTopSupported(); + } + } else if (attr.getCategory() == DialogTypeSelection.class) { + if (PrintServiceLookupProvider.isMac()) { + return true; + } else { + DialogTypeSelection dst = (DialogTypeSelection)attr; + return attr == DialogTypeSelection.COMMON; + } } return true; }