Bug 575036

Summary: [GTK] Disabled image of ToolItem is not greyed out
Product: [Eclipse Project] Platform Reporter: Simeon Andreev <simeon.danailov.andreev>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: christian.dietrich.opensource, loskutov, sdamrong, sravankumarl
Version: 4.17Keywords: regression
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=564097
https://bugs.eclipse.org/bugs/show_bug.cgi?id=575033
https://bugs.eclipse.org/bugs/show_bug.cgi?id=575028
https://bugs.eclipse.org/bugs/show_bug.cgi?id=574938
Whiteboard:

Description Simeon Andreev CLA 2021-07-26 08:33:29 EDT
Snippet to reproduce with:

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.WRAP | SWT.RIGHT);

		Image icon1 = display.getSystemImage(SWT.ICON_QUESTION);
		ToolItem item3 = new ToolItem(toolBar, SWT.PUSH);
		item3.setText("disabled");
		Image icon3 = display.getSystemImage(SWT.ICON_WARNING);
		item3.setEnabled(false);
		item3.setDisabledImage(icon3);
		item3.setImage(icon1);

		toolBar.pack();

		shell.addListener(SWT.Resize, new Listener() {
			public void handleEvent(Event event) {
				Rectangle clientArea = shell.getClientArea();
				toolBar.setSize(toolBar.computeSize(clientArea.width, SWT.DEFAULT));
			}
		});

		shell.setSize(500, 100);
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		display.dispose();
	}

Observe that the disabled image is not greyed out, but was, e.g. in Eclipse 4.16.

Regression from bug 564097.
Comment 1 Andrey Loskutov CLA 2021-08-03 13:21:05 EDT
I've observed the effect of that in our application and in all cases that was a mistake to provide a "not disabled" icons as a disabled one and hope SWT will do something to make the icon look as disabled. 

Either one should not provide a disabled icon, or SWT should not mess up and apply "disabled" effect on already dedicated "disabled" icon.

I would close this as won't fix / invalid.
Comment 2 Simeon Andreev CLA 2021-08-04 04:43:36 EDT
Behaviour on Windows 10 is similar to what we currently see on SWT. Setting a disabled icon will not result in SWT greying out that icon. So no argument to be made for consistency across platforms, that now broke.