Bug 575492 - [GTK] Disabled toolbar icons are double size on hi-res screen (200% scaling)
Summary: [GTK] Disabled toolbar icons are double size on hi-res screen (200% scaling)
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.20   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-08-18 15:19 EDT by Phil Beauvoir CLA
Modified: 2022-08-21 11:09 EDT (History)
2 users (show)

See Also:


Attachments
Screenshot of enabled and disabled toolbar icons (13.68 KB, text/plain)
2021-08-18 15:19 EDT, Phil Beauvoir CLA
no flags Details
Screenshot of enabled and disabled toolbar icons (13.68 KB, image/png)
2021-08-18 15:21 EDT, Phil Beauvoir CLA
no flags Details
Test Project (94.46 KB, application/octet-stream)
2021-08-18 15:22 EDT, Phil Beauvoir CLA
no flags Details
Snippet to show disabled button image (819 bytes, text/plain)
2022-01-19 14:55 EST, Phil Beauvoir CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Beauvoir CLA 2021-08-18 15:19:32 EDT
Created attachment 286966 [details]
Screenshot of enabled and disabled toolbar icons

Eclipse I20210818-0600

Linux Mint at 200% scaling. This can be emulated on non hi-res screens by setting the Environment variable GDK_SCALE=2

If a toolbar action is disabled the default icon is twice as big.
Comment 1 Phil Beauvoir CLA 2021-08-18 15:21:38 EDT
Created attachment 286967 [details]
Screenshot of enabled and disabled toolbar icons

New screenshot.
Comment 2 Phil Beauvoir CLA 2021-08-18 15:22:39 EDT
Created attachment 286968 [details]
Test Project

Test RCP project demonstrating the problem.
Comment 3 Andrey Loskutov CLA 2021-08-19 10:53:21 EDT
Broken latest in 4.20, works in 4.15.

Standalone SWT snippet (shows wrong icon size with GDK_SCALE=2)

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

public class Snippet380 {

public static void main (String [] args) {
	Display display = new Display ();
	Shell shell = new Shell (display);
	shell.setText("Snippet 360");

	Image image = display.getSystemImage(SWT.ICON_WARNING);

	ToolBar bar = new ToolBar (shell, SWT.BORDER | SWT.FLAT);
	Rectangle clientArea = shell.getClientArea ();
	bar.setBounds (clientArea.x, clientArea.y, 300, 64);
	for (int i = 0; i < 2; i++) {
		ToolItem item = new ToolItem (bar, 0);
		item.setImage (image);
		if (i == 1) {
			item.setEnabled (false);
		}
	}

	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
}
}
Comment 4 Phil Beauvoir CLA 2022-01-19 14:42:05 EST
This also happens for SWT Buttons with an Image when the display is at 200% scale

Button = new Button()....
button.setImage(image);
button.setEnabled(true);

The image will be the wrong size
Comment 5 Phil Beauvoir CLA 2022-01-19 14:55:01 EST
Created attachment 287857 [details]
Snippet to show disabled button image

Snippet to show disabled button image
Comment 6 Phil Beauvoir CLA 2022-01-19 14:56:16 EST
(In reply to Phil Beauvoir from comment #4)
> This also happens for SWT Buttons with an Image when the display is at 200%
> scale
> 
> Button = new Button()....
> button.setImage(image);
> button.setEnabled(true);
> 
> The image will be the wrong size

That should be:

button.setEnabled(false);
Comment 7 Alexis Drogoul CLA 2022-08-21 10:50:39 EDT
The problem is still happening in Eclipse 2022-03 in a RCP product, only with disabled icons, and only in Linux (Ubuntu in that case). It can only be fixed when using ToolItems programmatically and forcing the disabled icon. But specifying the disabled icon to use in the plugin.xml does not help.
Comment 8 Phil Beauvoir CLA 2022-08-21 11:09:21 EDT
As SWT has moved to GitHub I opened an issue there:

https://github.com/eclipse-platform/eclipse.platform.swt/issues/315