RFR: 8185429: [macos] After the dialog is closed, there is no window become active. [v2]

Alisen Chung duke at openjdk.java.net
Fri Oct 15 17:08:49 UTC 2021


On Fri, 15 Oct 2021 11:28:32 GMT, Dmitry Markov <dmarkov at openjdk.org> wrote:

>> I wasn't able to find when or where the dialog ever becomes active, and I actually think now that it never does become active window. I checked Apple's documentation on NSPrintPanel and turns out that it doesn't even inherit from NSPanel nor NSWindow so it can never become a key window (active status). Looks like it should be safe to not check for active status because a print dialog popup should block all other windows in the application anyway, so it will always be "active" window.
>> 
>> https://developer.apple.com/documentation/appkit/nsprintpanel?language=objc
>> 
>> This is also the case for page setup and NSPageLayout.
>> 
>> https://developer.apple.com/documentation/appkit/nspagelayout?language=objc
>
> Possible way to test whether the blocker window was active before setBlocked(false) call is to store the information about the blocker when the window is blocked, (i.e. during setBlocked(true) call). Once the window is unblocked you need to check that the blocker was the previous focus owner.
> 
> As for nativePushNSWindowToFront() call it does not work properly for the case when we have a hierarchy of windows. So I would recommend replacing nativePushNSWindowToFront() with orderAboveSiblings().

I'm still not able to see when the blocker isActive() is true
Here is some debug outputs when calling setModalBlocked(true) and setModalBlocked(false). In both cases Dialog.isActive() is false. Is there maybe another place where it's true?

`LWWindowPeer setModalBlocked setBlocked: true
LWWindowPeer setModalBlocked blocker: 
sun.lwawt.macosx.CPrinterPageDialog[dialog0,0,-2,80x28,APPLICATION_MODAL,title=]
LWWindowPeer setModalBlocked blocker isActive: false

2021-10-15 09:57:31.447 java[34690:12425514] createDefaultNSPrintInfo
2021-10-15 09:57:31.452 java[34690:12425514] runPageSetup

CPrinterDialogPeer printerDialog isActive: false
Dialog modalHide blocker isActive: false
Dialog modalHide blocker hasFocus: false
Dialog modalHide blocker isFocusOwner: false

LWWindowPeer setModalBlocked setBlocked: false
LWWindowPeer setModalBlocked blocker: sun.lwawt.macosx.CPrinterPageDialog[dialog0,0,25,80x28,APPLICATION_MODAL,title=]
LWWindowPeer setModalBlocked blocker isActive: false`

-------------

PR: https://git.openjdk.java.net/jdk/pull/5884



More information about the client-libs-dev mailing list