| Summary: | [GTK] display.getActiveShell() does not return active shell | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Anatoly Spektor <spektor.anatoly> |
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ericwill, gautier.desaintmartinlacaze, xixiyan |
| Version: | 4.3 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 340067 | ||
I can reproduce this issue. This is not a bug, the snippet is calling display.getActiveShell before shell is active, so it will always be null. Changing it to something like
shell.addMouseMoveListener(e -> {
System.out.println(display.getActiveShell() == shell);
});
gives the correct result.
|
To reproduce this error here is the snippet: import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class ShellTest { public static void main (String [] args) { Display display = new Display(); Shell shell = new Shell(display); shell.open(); System.out.println(display.getActiveShell() == shell); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }