| Summary: | Activate event does not appear after Dialog close if Shell is non-visible | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Francis Upton IV <francisu> |
| Component: | SWT | Assignee: | Steve Northover <snorthov> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | Silenio_Quarti, snorthov, xixiyan |
| Version: | 3.4 | Keywords: | triaged |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Very interesting, however, we report activation as the operating system tells us. For example, on Windows, we use WM_ACTIVATE. It is unlikely that we with either ignore these events or send fake ones when a shell is not visible. |
Build ID: I20071213-1700 Steps To Reproduce: This snippet illustrates. It behaves the same way on Windows and GTK (3.4m4). My use case is this: I have automated tests which run with the shell set to be non-visible (because it's more convenient to allow me to work on the computer while the tests are running, and it it probably runs the tests faster because less work is required, and since there are many tests, this performance can make a difference). Sometimes these tests pop up a dialog, which generates an Activate event for the Dialog. This activate event causes the ActiveShellSourceProvider to signal a change in the source and thus change which commands are enabled. However, when the dialog is closed, normally another activate event would be given back to the original Shell and the commands would be properly reset for the active partition in the Shell. However, since the outer Shell is non-visible, the 2nd activate event never appears. One could argue that it shouldn't since the Shell is not really Activated (since it's not visible). But I'm not sure this entirely makes sense. If you made this argument, then you should get a deactivate event when the Shell is made non-visible. It's interesting that this snippet produces this output on GTK (Linux): before shell open after shell open set visible false before set visible false after before dialog open activate: Event {type=26 Shell {Shell} time=0 data=null x=0 y=0 width=0 height=0 detail=0} after dialog open deactivate: Event {type=27 Shell {Shell} time=0 data=null x=0 y=0 width=0 height=0 detail=0} activate: Event {type=26 Shell {Dialog} time=0 data=null x=0 y=0 width=0 height=0 detail=0} Why does the activate event appear only inside the call to dialog.open() (in the setVisible()? I think the Activate event should appear on the original Shell when the Dialog goes away regardless of the visibility state of the original Shell. This is related to bug 212312 More information: package org.eclipse.swt.snippets; /* * Shell Activate event does not appear when Dialog is closed and the Shell is * non-visible. */ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.*; public class ActivateEventMissing { public static void main(String[] args) { Display display = new Display(); display.addFilter(SWT.Activate, new Listener() { public void handleEvent(Event event) { System.out.println("activate: " + event); } }); display.addFilter(SWT.Deactivate, new Listener() { public void handleEvent(Event event) { System.out.println("deactivate: " + event); } }); Shell shell = new Shell(display); shell.setText("Shell"); shell.setSize(200, 200); System.out.println("before shell open"); shell.open(); System.out.println("after shell open"); System.out.println("set visible false before"); shell.setVisible(false); System.out.println("set visible false after"); Shell dialog = new Shell(shell); dialog.setText("Dialog"); dialog.setSize(200, 200); System.out.println("before dialog open"); dialog.open(); System.out.println("after dialog open"); // When dialog is closed no activate event while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }