Bug 568771 - [GTK] Disabled icon not being rendering properly
Summary: [GTK] Disabled icon not being rendering properly
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.17   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.18 M3   Edit
Assignee: Soraphol (Paul) Damrongpiriyapong CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-11-12 16:05 EST by Kevin O CLA
Modified: 2021-08-05 08:14 EDT (History)
5 users (show)

See Also:


Attachments
eclipse_4.17-disabled_icons_not_gray (17.91 KB, image/png)
2020-11-12 16:05 EST, Kevin O CLA
no flags Details
eclipse_4.16-disabled_icons_gray (13.11 KB, image/png)
2020-11-12 16:05 EST, Kevin O CLA
no flags Details
Test Project (71.92 KB, application/octet-stream)
2020-11-16 14:27 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 Kevin O CLA 2020-11-12 16:05:03 EST
Created attachment 284751 [details]
eclipse_4.17-disabled_icons_not_gray

We have an RCP application. In 4.16, on RHEL 7, disabled icons are properly rendered in gray. We updated to 4.17, and disabled icons are not properly rendered in gray.

Beside changing the Eclipse version, Java, the O/S, etc. are all the same.

This lack of gray rendering is not seen on Windows 10 nor MacOS. It is limited to RHEL 7.

This lack of proper rendering is an impediment for UX.

Please let me know what additional information would be helpful in understanding the issue.

Some O/S information:
$ cat /etc/redhat-release 
Red Hat Enterprise Linux Workstation release 7.8 (Maipo)

$ rpm -q gtk3
gtk3-3.22.30-5.el7.x86_64


Some Eclipse info:
java.specification.vendor=Oracle Corporation
java.specification.version=11
java.vendor=AdoptOpenJDK
java.vendor.url=https://adoptopenjdk.net/
java.vendor.url.bug=https://github.com/AdoptOpenJDK/openjdk-support/issues
java.vendor.version=AdoptOpenJDK
java.version=11.0.8
java.version.date=2020-07-14

org.eclipse.swt.internal.deviceZoom=100
org.eclipse.swt.internal.gdk.backend=x11
org.eclipse.swt.internal.gtk.theme=Adwaita
org.eclipse.swt.internal.gtk.version=3.22.30
Comment 1 Kevin O CLA 2020-11-12 16:05:56 EST
Created attachment 284752 [details]
eclipse_4.16-disabled_icons_gray

Attachment showing 4.16 on RHEL 7 rendering disabled icons as expected
Comment 2 Soraphol (Paul) Damrongpiriyapong CLA 2020-11-12 17:00:11 EST
Hello, I'm having a hard time reproducing this. I have downloaded the latest 4.17 Eclipse and the icons in the toolbar seems to be grayed as usual. If you could provide a reproduction snippet that would be great. 

If not, could you please tell me how you are setting the icons to be disabled? I'm guessing just a call to ToolItem.setEnabled(false)
Comment 3 Andrey Loskutov CLA 2020-11-12 17:05:16 EST
It would be good to have a standalone example project demonstrating the problem.
Could you also please try 4.18 latest I-Build?
Comment 4 Phil Beauvoir CLA 2020-11-16 14:27:55 EST
Created attachment 284777 [details]
Test Project

I've attached a test project based on the Eclipse RCP app template.

In plugin.xml I added a Command, a ToolBar item and a Handler class which returns false for isEnabled().

When launched on Windows and Mac the toolbar item is disabled, but on Linux it is disabled.
Comment 5 Phil Beauvoir CLA 2020-11-16 14:29:35 EST
(In reply to Phil Beauvoir from comment #4)
> Created attachment 284777 [details]
> Test Project
> 
> I've attached a test project based on the Eclipse RCP app template.
> 
> In plugin.xml I added a Command, a ToolBar item and a Handler class which
> returns false for isEnabled().
> 
> When launched on Windows and Mac the toolbar item is disabled, but on Linux
> it is disabled.

I mean:

When launched on Windows and Mac the toolbar item is correctly disabled, but on Linux it is enabled.
Comment 6 Eclipse Genie CLA 2020-11-17 12:42:50 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172381
Comment 7 Andrey Loskutov CLA 2020-11-17 13:47:38 EST
According to Paul, regression is from bug 564097, patch https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/165440/.
Comment 9 Soraphol (Paul) Damrongpiriyapong CLA 2020-11-19 16:38:29 EST
Verified.

Eclipse SDK
Version: 2020-12 (4.18)
Build id: I20201118-1800
OS: Linux, v.5.8.18-300.fc33.x86_64, x86_64 / gtk 3.24.23
Java version: 11.0.9
Comment 10 Simeon Andreev CLA 2021-07-26 06:47:51 EDT
The fix here doesn't work if image is set after the disable call. E.g.:

public class ToolBarExamples {
  Display display = new Display();
  Shell shell = new Shell(display);

  ToolBar toolBar;
  
  public ToolBarExamples() {
	toolBar = new ToolBar(shell, SWT.FLAT | SWT.WRAP | SWT.RIGHT);
    
    ToolItem item1 = new ToolItem(toolBar, SWT.PUSH);
    item1.setText("enabled");
	Image icon1 = new Image(shell.getDisplay(), "/home/sandreev/tmp/testicon.png");
    item1.setImage(icon1);

    ToolItem item2 = new ToolItem(toolBar, SWT.PUSH);
    item2.setText("enabled");
    Image icon2 = new Image(shell.getDisplay(), "/home/sandreev/tmp/testicon.png");
    item2.setEnabled(false);
    item2.setImage(icon2);

    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();
    //textUser.forceFocus();

    // Set up the event loop.
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        // If no more entries in event queue
        display.sleep();
      }
    }

    display.dispose();
  }

  public static void main(String[] args) {
    new ToolBarExamples();
  }
}

So I guess from Eclipse POV the fix probably works. From SWT POV it doesn't.
Comment 11 Andrey Loskutov CLA 2021-07-26 06:55:15 EDT
(In reply to Simeon Andreev from comment #10)
> The fix here doesn't work if image is set after the disable call.

Please create new bug for this issue.