--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Wed Mar 15 20:42:55 2017 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Wed Mar 15 11:14:23 2017 -0700
@@ -785,7 +785,9 @@
PrintService pservice = getPrintService();
PageFormat pageFrmAttrib = attributeToPageFormat(pservice,
attributes);
+ setParentWindowID(attributes);
PageFormat page = pageDialog(pageFrmAttrib);
+ clearParentWindowID();
// If user cancels the dialog, pageDialog() will return the original
// page object and as per spec, we should return null in that case.
@@ -828,6 +830,9 @@
int x = gcBounds.x+50;
int y = gcBounds.y+50;
ServiceDialog pageDialog;
+ if (onTop != null) {
+ attributes.add(onTop);
+ }
if (w instanceof Frame) {
pageDialog = new ServiceDialog(gc, x, y, service,
DocFlavor.SERVICE_FORMATTED.PAGEABLE,
@@ -837,6 +842,7 @@
DocFlavor.SERVICE_FORMATTED.PAGEABLE,
attributes, (Dialog)w);
}
+
Rectangle dlgBounds = pageDialog.getBounds();
// if portion of dialog is not within the gc boundary
@@ -923,7 +929,9 @@
}
+ setParentWindowID(attributes);
boolean ret = printDialog();
+ clearParentWindowID();
this.attributes = attributes;
return ret;
@@ -2539,4 +2547,26 @@
return new String(out_chars, 0, pos);
}
}
+
+ private DialogOnTop onTop = null;
+
+ private long parentWindowID = 0L;
+
+ /* Called from native code */
+ private long getParentWindowID() {
+ return parentWindowID;
+ }
+
+ private void clearParentWindowID() {
+ parentWindowID = 0L;
+ onTop = null;
+ }
+
+ private void setParentWindowID(PrintRequestAttributeSet attrs) {
+ parentWindowID = 0L;
+ onTop = (DialogOnTop)attrs.get(DialogOnTop.class);
+ if (onTop != null) {
+ parentWindowID = onTop.getID();
+ }
+ }
}