< prev index next >

src/java.desktop/share/classes/sun/print/RasterPrinterJob.java

Print this page

        

@@ -783,11 +783,13 @@
         // Check for native, note that default dialog is COMMON.
         if (dlg == DialogTypeSelection.NATIVE) {
             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.
             if (page == pageFrmAttrib) {
                 return null;

@@ -921,11 +923,13 @@
 
             } catch (PrinterException e) {
 
             }
 
+            setParentWindowID(attributes);
             boolean ret = printDialog();
+            clearParentWindowID();
             this.attributes = attributes;
             return ret;
 
         }
 

@@ -2537,6 +2541,25 @@
             return s; // no need to make a new String.
         } else {
             return new String(out_chars, 0, pos);
         }
     }
+
+    private long parentWindowID = 0L; 
+
+    /* Called from native code */
+    private long getParentWindowID() {
+        return parentWindowID;
+    }
+
+    private void clearParentWindowID() {
+        parentWindowID = 0L;
+    }
+
+    private void setParentWindowID(PrintRequestAttributeSet attrs) {
+        parentWindowID = 0L;
+        DialogOnTop onTop = (DialogOnTop)attrs.get(DialogOnTop.class);
+        if (onTop != null) {
+            parentWindowID = onTop.getID();
+        }            
+    }
 }
< prev index next >