Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 560284

Summary: [win32][Dark theme] Table header delimiters color is bad for dark theme
Product: [Eclipse Project] Platform Reporter: Alexandr Miloslavskiy <alexandr.miloslavskiy>
Component: SWTAssignee: Alexandr Miloslavskiy <alexandr.miloslavskiy>
Status: VERIFIED FIXED QA Contact: Niraj Modi <niraj.modi>
Severity: normal    
Priority: P3 CC: alexandr.miloslavskiy, Lars.Vogel, nikita, niraj.modi, ts-swt
Version: 4.14   
Target Milestone: 4.16 M3   
Hardware: PC   
OS: Windows 10   
See Also: https://git.eclipse.org/r/157923
https://bugs.eclipse.org/bugs/show_bug.cgi?id=517003
https://bugs.eclipse.org/bugs/show_bug.cgi?id=518676
https://bugs.eclipse.org/bugs/show_bug.cgi?id=576614
Whiteboard:
Bug Depends on:    
Bug Blocks: 562193    
Attachments:
Description Flags
Screenshot of test snippet for Win10
none
Eclipse (old)
none
Eclipse (with patch) none

Description Alexandr Miloslavskiy CLA 2020-02-18 11:38:16 EST
It's too bright - for example, for me it's (0xF0, 0xF0, 0xF0)
Comment 1 Alexandr Miloslavskiy CLA 2020-02-18 11:58:24 EST
I will provide a patch soon.
Comment 2 Eclipse Genie CLA 2020-02-18 12:33:50 EST
New Gerrit change created: https://git.eclipse.org/r/157923
Comment 3 Thomas Singer CLA 2020-02-26 11:27:07 EST
Nikita, I would prefer to have all used colors configurable by the user - that is the whole point of theming. The current algorithms can be used as a fall-back if such special colors are not configured.
Comment 4 Alexandr Miloslavskiy CLA 2020-02-27 10:50:16 EST
Thanks for your suggestion regarding 'getSlightlyDifferentColor'. Indeed, this looks reasonable, both in dark and light (in light, explicit .setHeaderBackground() is needed to trigger custom drawing).

However, our UI designed told me that he wants to configure a precise color that he selected. After thinking, I believe that it's a perfectly good idea to provide as many tunable knobs as possible.

I think in some of our previous discussions, you already complained about the state of Windows theming. But this complain goes down exactly to the lack of tunable knobs! So when we want to change a tiny detail, we often have to owner-draw everything instead. On the other hand, there's GTK, where I really like how theming was designed as a cornerstone, and as a result every tiny detail can be customized via CSS.

Therefore, I think I will split the patch into two:
1) Improve default baseline. This will probably use your suggestion.
2) Also add a tunable knob to override that default.

While studying your suggestion, I found that the code actually contains a problem since Bug 517003: if you look carefully, the line of code highlighted by you and the one I modified actually paint exactly the same pixels, but with different colors! That is, "your" line has no effect.

I then started looking into this and discovered that it's a whole bunch of connected problems. I have submitted a new version of the patch with an updated test snippet that shows them:
* With owner drawing, non-header column separators disappear.
* With 'Table lines', Windows draws 2px non-header column delimiters,
  but only 1px header delimiters. This looks like a Windows bug for
  'Explorer' theme Table.
* With 'Dark', non-header lines are misaligned with header lines.
  It seems that Windows actually paints _two_ non-header lines, but one is
  not visible with light background.
* With 'Table lines' and 'Dark', there are two badly misaligned non-header lines
  Maybe that's another Windows bug for 'Explorer' theme Table.
  
I'll try to defeat some of them, unless that takes too much time.
Comment 5 Alexandr Miloslavskiy CLA 2020-02-27 10:53:29 EST
The previous comment is a reply to Nikita Nemkin's code review.
Comment 6 Alexandr Miloslavskiy CLA 2020-02-27 11:03:11 EST
Created attachment 281956 [details]
Screenshot of test snippet for Win10

High zoom (4x or more) is recommended to see various problems with column lines.
Comment 7 Alexandr Miloslavskiy CLA 2020-05-13 17:10:48 EDT
Created attachment 282827 [details]
Eclipse (old)
Comment 8 Alexandr Miloslavskiy CLA 2020-05-13 17:11:08 EDT
Created attachment 282828 [details]
Eclipse (with patch)
Comment 9 Alexandr Miloslavskiy CLA 2020-05-13 17:18:44 EDT
Eclipse should refrain from using Table.setLinesVisible() in dark theme, because the lines are too bright.
Comment 10 Niraj Modi CLA 2020-05-15 12:48:28 EDT
Changes merged to master via:
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=fdad775eff1272fde91253a01f85ee57d35b3ec6

Resolving now. Thanks!
Comment 11 Niraj Modi CLA 2020-05-20 07:12:19 EDT
Verified using Build id: I20200518-2220 on Win10.
Comment 12 Niraj Modi CLA 2020-05-20 07:12:53 EDT
Details on how to disable this feature:
On Windows 10 all the dark theme tweaks, including the Table header delimiters color can be disabled using the org.eclipse.swt.internal.win32.disableCustomThemeTweaks Java property. For Example. add this VM argument in eclipse.ini or on the command line after -vmargs:
-Dorg.eclipse.swt.internal.win32.disableCustomThemeTweaks=true