[OpenJDK 2D-Dev] [9] RFR: JDK-6529030, , Java Printing: Print range > Selection gets enabled

Phil Race philip.race at oracle.com
Tue Apr 12 23:22:58 UTC 2016


Hi,

My reading  here :
https://msdn.microsoft.com/en-us/library/windows/desktop/ms646843%28v=vs.85%29.aspx

of the meaning of PD_NOSELECTION is that it disables the SELECTION radio 
button such
that the user *cannot* select it.

Is that true ? If so this seems like it cannot be the right fix for this 
issue
and I am not sure why getSelectAttrib() would want to return that.
Perhaps we never in practice return PD_NOSELECTION ?

I am also unsure what it means to set flags to  PD_NOSELECTION | 
PD_SELECTION
as the windows docs don't tell me enough.

Maybe what we want is just that we do not cause PD_SELECTION to be set
rather than setting PD_NOSELECTION.

But to decide what to do I need to know the real effect of PD_NOSELECTION.

BTW about the test: you should make sure that the instructions are
valid on OS X and Linux ..

-phil.

On 04/06/2016 03:09 AM, prasanta sadhukhan wrote:
> Hi All,
>
> Please review a fix for jdk9.
> Bug: https://bugs.openjdk.java.net/browse/JDK-6529030
> webrev: http://cr.openjdk.java.net/~psadhukhan/6529030/webrev.00/
>
> The issue was when using java.awt.print.PrinterJob instance more then 
> once, Selection radio button in Print dialog gets enabled from 2nd 
> instance even though we are printing "All" pages
> however Selection radio button is disabled in the first instance.
> This is seen in windows.
>
> This is because initially when windows initialized the print dialog, 
> it calls InitPrintDialog() which calls getSelectAttrib() to find out 
> which selection attribute user has selected.
> getSelectAttrib() returns PD_NOSELECTION as SunPageSelection.class was 
> not added to attribute.
> So, in InitPrintDialog() we set PRINTDLG flags to PD_NOSELECTION. So, 
> we see "Selection " radio button is disabled in 1st instance of print 
> dialog.
> Now, when user presses "OK", windows native code calls 
> setNativeAttributes() and adds SunPageSelection.class to the attribute 
> with SunPageSelection.ALL or SunPageSelection.RANGE.
>
> When 2nd print dialog is shown, InitPrintDialog() will again call 
> getSelectAttrib() which will now return 
> SunPageSelection.ALL/SunPageSelection.RANGE which will be set to 
> PRINTDLG flag but
> we are not disabling Selection radio button, so in 2nd instance, 
> Selection radio button gets enabled.
>
> Fix was to check if PD_SELECTION attribute is selected by user, if not 
> , sets PRINTDLG flag with PD_NOSELECTION.
>
> I have checked 8151590 and 8061267 works correctly with this patch.
>
> Regards
> Prasanta




More information about the 2d-dev mailing list