Bug 574484

Summary: [gtk3][win32][dark] Background color for selected item in tree wrong for owner-drawn items
Product: [Eclipse Project] Platform Reporter: Thomas Wolf <twolf>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.20   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=574434
Whiteboard:
Attachments:
Description Flags
Screenshot from Eclipse 2021-06, gtk3, dark mode none

Description Thomas Wolf CLA 2021-06-27 06:52:51 EDT
Created attachment 286691 [details]
Screenshot from Eclipse 2021-06, gtk3, dark mode

See attachment. Screenshot from

  Eclipse IDE for Java Developers (includes Incubating components)

  Version: 2021-06 (4.20.0)
  Build id: 20210612-2011

  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

Eclipse is set to dark mode via the Eclipse preferences; system theme is the stock Adwaita (light).

The "M" is owner-drawn (see [1] for the code). It uses event.gc.getBackgroundColor() to fill the background of the "M". That rectangle is drawn with the selection color *of the light theme*. The selection color for the dark theme is a clearly different blue (and a lighter or brighter one at that).

In the default light mode, the background color matches the selection color.

I don't know where this selection color for tree items is defined, but I would expect the GC for a PaintEvent to be set to the correct color.

[1] https://git.eclipse.org/r/c/egit/egit/+/182394/4/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java#b164
Comment 1 Thomas Wolf CLA 2021-06-27 06:55:10 EDT
See also bug 574434 for a similar problem on win32 (but there SWT only).
Comment 2 Thomas Wolf CLA 2021-06-27 07:03:07 EDT
This problem does _not_ occur when running an Eclipse Neon.3 in dark mode.

So perhaps the color in event.gc.getBackground() is correct, but the brighter blue used for drawing the label is wrong?
Comment 3 Thomas Wolf CLA 2021-06-29 13:36:28 EDT
(In reply to Thomas Wolf from comment #1)
> See also bug 574434 for a similar problem on win32 (but there SWT only).

Actually, the background color of a selected tree item as reported by event.gc.getBackground() in an SWT.PaintEvent not changing with the theme also occurs on win32. So this issue here

* is not platform-specific; occurs on gtk3 and on win32. (Didn't see it on
  cocoa, though.)
* is different from bug 574434, which is win32-specific and which is about
  that background color not matching the actual background color used for
  the tree item. (In light or dark mode.)