Bug 575563 - Close button disappears on empty Project Explorer
Summary: Close button disappears on empty Project Explorer
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.21   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.21 RC2   Edit
Assignee: Rolf Theunissen CLA
QA Contact: Niraj Modi CLA
URL:
Whiteboard:
Keywords: regression
Depends on: 501491
Blocks:
  Show dependency tree
 
Reported: 2021-08-23 03:50 EDT by Rolf Theunissen CLA
Modified: 2021-09-03 06:15 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 Rolf Theunissen CLA 2021-08-23 03:50:38 EDT
On windows
1. Start with a empty project explorer or package explorer (e.g. a new workspace)
2. Select the explorer tab
3. Notice that the close icon disappeared. Also notice that the text is selected with a thin line box, on my other tabs that doesn't happen.

When a project exists in the workspace, the close icon does not disappear anymore (nor does the thin line box show up).
Comment 1 Lars Vogel CLA 2021-08-23 07:03:43 EDT
Looks like the gc foreground color is changed by the calling code for this case to Color {255, 255, 255, 255}.

We may have to fix the color which is used for drawing the close button.
Comment 2 Lars Vogel CLA 2021-08-23 07:26:25 EDT
Rolf, I see you provided a more advanced patch for the close drawing for 575398. Can you extract your color setting part and provide a Gerrit for this bug?
Comment 3 Rolf Theunissen CLA 2021-08-23 07:30:59 EDT
(In reply to Lars Vogel from comment #2)
> Rolf, I see you provided a more advanced patch for the close drawing for
> 575398. Can you extract your color setting part and provide a Gerrit for
> this bug?

The color in that change is rather hard coded, manually picked the color of the quick access button. There should be consent on which color to pick here, either hard-coded or some selected from the theme.
Comment 4 Lars Vogel CLA 2021-08-23 09:57:40 EDT
(In reply to Rolf Theunissen from comment #3)
> (In reply to Lars Vogel from comment #2)
> > Rolf, I see you provided a more advanced patch for the close drawing for
> > 575398. Can you extract your color setting part and provide a Gerrit for
> > this bug?
> 
> The color in that change is rather hard coded, manually picked the color of
> the quick access button. There should be consent on which color to pick
> here, either hard-coded or some selected from the theme.

I like it.
Comment 5 Rolf Theunissen CLA 2021-08-23 10:33:56 EDT
The root cause of the white color in the foreground is this snippet:

CTabFolderRenderer line 1471:

  // draw a Focus rectangle
  if (parent.isFocusControl()) {
    Display display = parent.getDisplay();
    if (parent.simple || parent.single) {
      gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
      gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
      gc.drawFocus(xDraw-1, textY-1, extent.x+2, extent.y+2);
    } else {
      gc.setForeground(display.getSystemColor(BUTTON_BORDER));
      gc.drawLine(xDraw, textY+extent.y+1, xDraw+extent.x+1, textY+extent.y+1);
    }
  }

This code is hardly ever triggered, because the tabfolder is not often the focus control. Only on second activation of the tabfolder tab it becomes active.

Should the gc be reset? Or shouldn't we assume any colors while drawing the close icon?
Comment 6 Eclipse Genie CLA 2021-08-23 11:06:10 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184322
Comment 8 Niraj Modi CLA 2021-08-24 02:22:53 EDT
(In reply to Eclipse Genie from comment #7)
> Gerrit change
> https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184322 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=388d9cce23751ce2bc6c618b01ed6efc3cad29fa

Thanks Rolf for the fix, resolving now.
Comment 9 Niraj Modi CLA 2021-08-25 02:59:04 EDT
Verified in Build id: I20210824-1800 on Win10
Comment 10 Lars Vogel CLA 2021-08-26 06:24:01 EDT
With this change the dark theme on Linux is dark instead of gray which looks broken to me.
Comment 11 Lars Vogel CLA 2021-08-26 06:26:07 EDT
If I revert 388d9cce23751ce2bc6c618b01ed6efc3cad29fa the x is light again in the dark theme. 

Rolf / Niraj, was the intention here to make the close dark in the dark theme?
Comment 12 Eclipse Genie CLA 2021-08-26 06:36:14 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184446
Comment 13 Rolf Theunissen CLA 2021-08-26 06:54:05 EDT
(In reply to Lars Vogel from comment #11)
> If I revert 388d9cce23751ce2bc6c618b01ed6efc3cad29fa the x is light again in
> the dark theme. 
> 
> Rolf / Niraj, was the intention here to make the close dark in the dark
> theme?

On windows, this color is a gray that works well in the light and the dark theme. Very close to the original hard coded color, and personally I would try to avoid any hard coded color. Therefore picked this one, but of course cannot validate it on all platforms.
Comment 14 Lars Vogel CLA 2021-08-26 07:28:06 EDT
(In reply to Rolf Theunissen from comment #13)
> (In reply to Lars Vogel from comment #11)
> > If I revert 388d9cce23751ce2bc6c618b01ed6efc3cad29fa the x is light again in
> > the dark theme. 
> > 
> > Rolf / Niraj, was the intention here to make the close dark in the dark
> > theme?
> 
> On windows, this color is a gray that works well in the light and the dark
> theme. Very close to the original hard coded color, and personally I would
> try to avoid any hard coded color. Therefore picked this one, but of course
> cannot validate it on all platforms.

Windows uses Color {105, 105, 105, 255} both in the light and dark theme. I updated the Gerrit to use this color so that is also looks good on Ubuntu. Please have a quick look.
Comment 16 Lars Vogel CLA 2021-08-30 03:24:45 EDT
Verified under Linux with

Eclipse SDK
Version: 2021-09 (4.21)
Build id: I20210829-1800
OS: Linux, v.5.11.0-31-generic, x86_64 / gtk 3.24.25
Java vendor: AdoptOpenJDK
Java runtime version: 16.0.1+9
Java version: 16.0.1

and looks good in dark and light theme.

Thanks a lot Rolf, Thomas and Niraj.
Comment 17 Lars Vogel CLA 2021-09-01 03:01:36 EDT
Also verified under Windows Eclipse SDK
Version: 2021-09 (4.21)
Build id: I20210831-1800
OS: Windows 10, v.10.0, x86_64 / win32
Java vendor: Eclipse Foundation
Java runtime version: 16.0.2+7
Java version: 16.0.2