Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322137 - SWT.ON_TOP shells do not stay above all applications
Summary: SWT.ON_TOP shells do not stay above all applications
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.6.1   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-09 09:59 EDT by Silenio Quarti CLA
Modified: 2010-08-09 14:30 EDT (History)
2 users (show)

See Also:
eclipse.felipe: review+


Attachments
fix (2.17 KB, patch)
2010-08-09 10:03 EDT, Silenio Quarti CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.