Project: SWT
Bug 39236 Completely different behaviour for creating a shell with a parent versus calling setParent
Reported: 2003-06-23 12:34:48 | Status: resolved fixed

Launch the folowing example. Note that the shell in red is located at (10,10) relative to the display rather than to its parent shell. Click in the red shell which will trigger the setParent call (to the same parent as it already had). Suddenly the red shell becomes an MDI shell (rather than a dialog) and it moves with the parent shell and is positioned relative to the parent shell. public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); final Shell s = new Shell(shell); s.setBackground(display.getSystemColor(SWT.COLOR_RED)); s.addMouseListener(new MouseAdapter() { public void mouseDown(org.eclipse.swt.events.MouseEvent e) { s.setParent(shell); } }); shell.open(); s.setBounds(10, 10, 100, 100); s.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java