Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322137

Summary: SWT.ON_TOP shells do not stay above all applications
Product: [Eclipse Project] Platform Reporter: Silenio Quarti <Silenio_Quarti>
Component: SWTAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, raji
Version: 3.6Flags: eclipse.felipe: review+
Target Milestone: 3.6.1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
fix none

Description Silenio Quarti CLA 2010-08-09 09:59:36 EDT
The SWT.ON_TOP shell in the snippet below goes behind other windows when the application looses focus

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;


public class OnTopIssue {
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setText("main");
	shell.setLayout(new GridLayout(1, false));
	shell.setBounds(100, 100, 200, 200);

	Shell onTop = new Shell(display, SWT.SHELL_TRIM | SWT.ON_TOP);
	onTop.setText("ontop");
	onTop.setBounds(130, 130, 200, 200);
	Button button = new Button(onTop, SWT.PUSH);
	button.setText("Push");
	button.pack();
	onTop.open();

	Shell s = new Shell(onTop, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); //works
//	Shell s = new Shell(onTop, SWT.DIALOG_TRIM); //works
//	Shell s = new Shell(SWT.DIALOG_TRIM); //fails on Windows, Cocoa, Carbon
	s.setBounds(150, 150, 200, 200);
	s.setText("dialog");
	Button button1 = new Button(s, SWT.PUSH);
	button1.setText("Push");
	button1.pack();
	s.open();

	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
}
Comment 1 Silenio Quarti CLA 2010-08-09 10:03:15 EDT
Created attachment 176154 [details]
fix
Comment 2 Silenio Quarti CLA 2010-08-09 10:05:07 EDT
Felipe, please review for 3.6.1
Comment 3 Silenio Quarti CLA 2010-08-09 14:30:02 EDT
Fix released to HEAD and R3_6_maintenance.