| Summary: | Parent shell wrongly focused via Exposé (should activate primary modal child shell) | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Markus Keller <markus.kell.r> | ||||||
| Component: | SWT | Assignee: | Silenio Quarti <Silenio_Quarti> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | daniel_megert, gheorghe, kim.moir, Silenio_Quarti, skovatch | ||||||
| Version: | 3.7 | Flags: | gheorghe:
review+
|
||||||
| Target Milestone: | 3.7 RC1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Mac OS X | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Markus Keller
(In reply to comment #0) > HEAD Cocoa > > - Open a child shell with PRIMARY_MODAL (e.g. in ControlExample) > - Via Exposé, select the parent shell > => Parent shell gets activated, but keyboard interaction doesn't work > => Expected: Child shell should be active > > I would also expect that the child shell is shown as a separate window in > Exposé, at least if it's MODELESS. This is because we used NSWindow#addChildWindow to implement parent/child relationships. Setting a parent/child relationship groups the windows so they always appear together in Expose. Cocoa doesn't have the same window modality modes that Carbon does. I agree this could be better than it is right now. Having said that, we should be able to at least select the child modal shell like we do in Carbon. (In reply to comment #0) > HEAD Cocoa > > - Open a child shell with PRIMARY_MODAL (e.g. in ControlExample) > - Via Exposé, select the parent shell > => Parent shell gets activated, but keyboard interaction doesn't work > => Expected: Child shell should be active > > I would also expect that the child shell is shown as a separate window in > Exposé, at least if it's MODELESS. After more thought on this, I think this is only half-correct. Yes, the child shell should be shown as a separate window, but the parent shell should NOT be selectable via Expose, since it technically can't be selected. That's arguably the better behavior in Carbon, too, and would be the better fix for the problem because then we aren't trying to activate another window in the middle of handling an activate event. The entire concept of 'document modal' is not that common on the Mac -- I remember we had to implement it ourselves in the AWT because Cocoa doesn't really support it. I don't know how Cocoa-native the "Open" dialogs from TextEdit and from SWT are, but they are both modal and show the same behavior in Expose: Only the main window is visible in Expose, but when I click it, the "Open" dialog is activated. In contrast, TextEdit's modeless Find dialog is a separate window in Expose. BTW: If I have two open TextEdit documents and then open the "Open" dialog, I can change the z-order of the documents via Expose, but the documents still don't take focus. (In reply to comment #3) > I don't know how Cocoa-native the "Open" dialogs from TextEdit and from SWT > are, but they are both modal and show the same behavior in Expose: Only the > main window is visible in Expose, but when I click it, the "Open" dialog is > activated. Interesting... I see this too, but I find that surprising. The file dialog is modal, so it is pushed into a higher window level to ensure it is always above the document windows. But, that's the least of the problems right now, because.... > BTW: If I have two open TextEdit documents and then open the "Open" dialog, I > can change the z-order of the documents via Expose, but the documents still > don't take focus. In Cocoa, APPLICATION_MODAL (and probably SYSTEM_MODAL) are thoroughly wrong right now! If I have a collection of modeless Shells and then open a APPLICATION_MODAL shell on top of it I can still click on the modeless shell and bring it forward. It doesn't activate, but that shouldn't be possible. I will investigate this for RC1. Created attachment 195117 [details]
fix
This patch fixes the main problem (Parent shell gets activated, but keyboard interaction doesn't work).
>I would also expect that the child shell is shown as a separate window in
>Exposé, at least if it's MODELESS.
I do not think this is possible in Cocoa when there is a child/parent relationship. TextEdit's modeless find dialog works because it does have a parent window.
Releasing this patch to 3.7 RC1 and marking as fixed, since the main problem is addressed.
Created attachment 195142 [details]
snippet
Test failures in HEAD look like the modal.window.becomeKeyWindow(); should also be surrounded by the focus checking code used in the normal case Display display = this.display; display.keyWindow = view.window(); super.becomeKeyWindow(id, sel); display.checkFocus(); display.keyWindow = null; Is this the test failures you are talking about? http://fullmoon/downloads/drops/I20110509-1200/testresults/html/org.eclipse.swt.tests_macosx.cocoa.x86_5.0.html Yes. Here's the public link: http://download.eclipse.org/eclipse/downloads/drops/I20110509-1200/testresults/html/org.eclipse.swt.tests_macosx.cocoa.x86_5.0.html display.checkFocus(); also sends out events and stores the currentFocusControl, so my guess was that this is missing in the new code. (In reply to comment #11) > Yes. Here's the public link: > http://download.eclipse.org/eclipse/downloads/drops/I20110509-1200/testresults/html/org.eclipse.swt.tests_macosx.cocoa.x86_5.0.html > > display.checkFocus(); also sends out events and stores the currentFocusControl, > so my guess was that this is missing in the new code. I do not think this is the problem. The call to modal.window.becomeKeyWindow(); will come back to becomeKeyWindow (int /*long*/ id, int /*long*/ sel) for a different window (the modal dialog) and checkFocus() will run properly. I cannot reproduce the test failures on my machine (10.6). Kim, are the tests run on 10.6 or 10.5 now? Silenio, the tests are run on 10.6 now. An interesting point could be that the tests are run on a 64bit machine but with -d32 and the 32bit SWT. Or maybe it was just a Software Update dialog or a Screensaver that was stealing focus, or something else a young and wild machine likes to do... The SWT tests on the mac all passed in build I20110510-2000. Verified in I20110519-1138. |