Community
Participate
Working Groups
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.
Created attachment 286967 [details] Screenshot of enabled and disabled toolbar icons New screenshot.
Created attachment 286968 [details] Test Project Test RCP project demonstrating the problem.
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 (); } }
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
Created attachment 287857 [details] Snippet to show disabled button image Snippet to show disabled button image
(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);
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.
As SWT has moved to GitHub I opened an issue there: https://github.com/eclipse-platform/eclipse.platform.swt/issues/315