Bug 301461 - TrayItem and ToolTip bug on Ubuntu
Summary: TrayItem and ToolTip bug on Ubuntu
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2010-02-01 15:59 EST by Sébastien CLA
Modified: 2018-05-15 16:47 EDT (History)
4 users (show)

See Also:


Attachments
Screenshot (12.51 KB, image/jpeg)
2010-02-01 15:59 EST, Sébastien CLA
no flags Details

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