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

Bug 301461

Summary: TrayItem and ToolTip bug on Ubuntu
Product: [Eclipse Project] Platform Reporter: Sébastien <Seb33300>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: ericwill, pinnamur, remy.suen, Seb33300
Version: 3.6Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Screenshot none

Description Sébastien CLA 2010-02-01 15:59:21 EST
Created attachment 157841 [details]
Screenshot

Problem posted here : http://www.eclipse.org/forums/index.php?t=msg&th=161745&start=0&

Hello,

I have 2 problems with TrayItem on Ubuntu.

I make a function to create a TrayItem. When the user click on the TrayItem, it disappear. Then it's possible to recreate it, and etc..

But for each creation, destruction of the TrayIcon, a small white space is added...


The second problem is that I placed a ToolTip message juste after the TrayItem creation, and the tooltip is not placed at the right place...

There 2 problems appear only on Ubuntu.

This bug seems to still be in SWT 3.6M5


[code]
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
import org.eclipse.swt.widgets.ToolTip;
import org.eclipse.swt.widgets.Shell;
 
public void createTray() {
	final Display displayTray = new Display();
	final Shell shellTray = new Shell(displayTray);
	final Tray tray = displayTray.getSystemTray();
	final ToolTip tipTray = new ToolTip(shellTray, SWT.BALLOON | SWT.ICON_INFORMATION);
	tipTray.setText("Tray Title");
 
	if (tray != null) {
		final TrayItem item = new TrayItem(tray, SWT.NONE);
		item.setToolTipText("Tooltip Title");
		item.setImage(new Image(displayTray, getClass().getResourceAsStream("/projet/icon.png")));
		item.setToolTip(tipTray);
		item.setVisible(true);
		tipTray.setMessage("Tooltip Text...");
		// Fait disparaitre l'icône lorsque on clic dessus
		item.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				shellTray.dispose();
			}
		});
	}else{
		// Tray icon not possible
	}
 
	tipTray.setVisible(true);
 
	while (!shellTray.isDisposed()) {
		if (!displayTray.readAndDispatch())
			displayTray.sleep();
	}
 
	displayTray.dispose();
}
[/code]
Comment 1 Praveen CLA 2010-02-01 22:18:32 EST
Which version of Ubuntu/GTK you are using ?
I am not able to reproduce the reported scenario on Ubuntu9.04 (having GTKv2.16). When the trayItem is disposed, the remaining tray items are aligned properly without leaving any white spaces.
GTK doesnot display the tooltip at the right place unless SWT handles a few dispatch events either through shell.open(), or main loop is the started. So, I can display the toolTip correctly if I set it's visibility to true either after the shell is opened, or in any listener code.
Comment 2 Eric Williams CLA 2018-05-15 16:47:06 EDT
Closing as per comment 1 and there was no follow up.