Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321595 - SWT.Settings listener not notified on Ubuntu
Summary: SWT.Settings listener not notified on Ubuntu
Status: RESOLVED NOT_ECLIPSE
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 313530
  Show dependency tree
 
Reported: 2010-08-03 10:09 EDT by Deepak Azad CLA
Modified: 2010-08-03 15:32 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2010-08-03 10:09:37 EDT
Build id  I20100802-1800
We have the following listener in org.eclipse.jface.internal.text.html.HTMLPrinter. This listener works on WinXp but not on Ubuntu 9.04 (gtk version 2.16.1-0), when the OS tooltip colors are changed.

       private static void installColorUpdater(final Display display) {
		display.addListener(SWT.Settings, new Listener() {
			public void handleEvent(Event event) {
				cacheColors(display); //breakpoint here
			}
		});
	}

Steps:
- New Workspace
- Import > Plugin & fragments > Project with source folders > select 'org.eclipse.jface.text'
- Set a breakpoint in the handleEvent method
- Debug as Eclipse Application
- Change OS toolip color
WinXP: Display Properties > Appearance > Advanced > Select 'Tooltip' in the Item dropdown and change a color.
Ubuntu: System Settings > Appearance > Colors > goto Colors tab > Change Tooltip Text or Toolip Background colors
=> Breakpoint hit for Win but not for Ubuntu
=> As a result, for the color changes to take effect you have to restart Eclipse on Ubuntu but not on Win (Bug 313530)

I should also mention that this worked on another Suse Linux machine (gtk2-2.18.9-0.5.1), though I do not know why.
Comment 1 Lakshmi P Shanmugam CLA 2010-08-03 11:10:38 EDT
I have Ubuntu (gtk 2.18) and SWT.Settings listener works for me.
Can you try out this SWT snippet and see if it works on your machine?

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

public class Settings_Snippet {
public static void main(String [] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	final Label label = new Label(shell, SWT.WRAP);
	label.setText("tooltip color");
	Color color = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
	label.setBackground(color);
	
	display.addListener(SWT.Settings, new Listener() {
		public void handleEvent(Event event) {
			Color color = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
			label.setBackground(color);
		}
	});

	shell.setSize(200, 200);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}}
Comment 2 Deepak Azad CLA 2010-08-03 11:48:21 EDT
(In reply to comment #1)
> I have Ubuntu (gtk 2.18) and SWT.Settings listener works for me.
> Can you try out this SWT snippet and see if it works on your machine?
Nope, the snippet doesn't work. 
(Maybe this is important, I am using KUbuntu(KDE) )
Comment 3 Markus Keller CLA 2010-08-03 12:10:40 EDT
> (Maybe this is important, I am using KUbuntu(KDE) )

Does it also fail in other GTK applications, e.g. on the file name tab in gedit?
Comment 4 Deepak Azad CLA 2010-08-03 15:32:58 EDT
(In reply to comment #3)
> > (Maybe this is important, I am using KUbuntu(KDE) )
> 
> Does it also fail in other GTK applications, e.g. on the file name tab in
> gedit?
Yup, it fails with other GTK applications as well. I tried with Firefox, and even here restart is required for the color changes to take effect.

Closing as NOT_ECLIPSE.