Hi Phil,

On 3/24/2016 4:39 AM, Philip Race wrote:


On 3/23/16, 4:02 AM, prasanta sadhukhan wrote:
Hi Phil,

Please review a fix for jdk9
Bug: https://bugs.openjdk.java.net/browse/JDK-8061258

Gosh, it appears I submitted that bug 18 months ago although
I don't remember how I came across the problem.

I need to understand the fix better and it doesn't help that I don't understand this line :-
} else if (selectID == 3) {
Yes, this is wrong. I was thinking selectID ==3 was for PD_SELECTION but it was not.
Anyways, I have rectified this and updated the webrev:
http://cr.openjdk.java.net/~psadhukhan/8061258/webrev.01/

where the else part handles both

PD_SELECTION or PD_NOSELECTION I tested with JobAttributes.setDefaultSelection(ALL/RANGE/SELECTION) and also without defaultselection and all are working fine.

Regards
Prasanta
SelectID is set from a single flag bit .. so it will never be 3, at least not anywhere I can find. What case is that supposed to be covering ? -phil.

webrev :http://cr.openjdk.java.net/~psadhukhan/8061258/webrev.00/

When user attempts to pre-populate the native dialog with copies and page ranges by calling
 PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        aset.add(new Copies(2));
        aset.add(new PageRanges(3,4));
the print dialog does not reflect the user-defined setting.

This is because osx native code was calling getNumberOfPages() from OpenBook.java which was returning UNKNOWN_NUMBER_OF_PAGES (-1). Since getNumberOfPages() returned -1, osx always selected NSPrintAllPages or All Radio button.

I fixed it by removing this call to getNumberOfPages() and rely on getMinPage/getMaxPage() as was done in windows (awt_PrintControl.cpp:AwtPrintControl::InitPrintDialog) to select which radio button to be selected. If fromPage > minPage or toPage < maxPage, it means user has selected page ranges so PageRange radio button is to be selected else "All" radio button to be selected.

Regards
Prasanta

Reply via email to