Bug 574412 - [content asssist] Selection unfocused background color on windows is not prominent
Summary: [content asssist] Selection unfocused background color on windows is not prom...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.21   Edit
Hardware: PC Windows 10
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 577093 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-06-23 08:25 EDT by Gayan Perera CLA
Modified: 2022-03-27 10:00 EDT (History)
3 users (show)

See Also:


Attachments
When no focus (35.63 KB, image/png)
2021-06-23 08:25 EDT, Gayan Perera CLA
no flags Details
When focused (37.46 KB, image/png)
2021-06-23 08:26 EDT, Gayan Perera CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gayan Perera CLA 2021-06-23 08:25:13 EDT
Selection unfocused background color on windows is not prominent. This is really hurts with content assist popup when the popup is not focused by tabbing in or clicking it.
Comment 1 Gayan Perera CLA 2021-06-23 08:25:47 EDT
Created attachment 286667 [details]
When no focus
Comment 2 Gayan Perera CLA 2021-06-23 08:26:03 EDT
Created attachment 286668 [details]
When focused
Comment 3 Gayan Perera CLA 2021-07-04 06:59:44 EDT
Hi All, What if we focus the content assist popup on editor focused by default ? like the outline popups. I think most of the editors like Java, generic editor use the platform support for providing the content assist popup right ?
Comment 4 Gayan Perera CLA 2021-07-04 13:55:34 EDT
(In reply to Gayan Perera from comment #3)
> Hi All, What if we focus the content assist popup on editor focused by
> default ? like the outline popups. I think most of the editors like Java,
> generic editor use the platform support for providing the content assist
> popup right ?

This will not work since if we focus we will loose the ability to filter content assist by typing.
Comment 5 Gayan Perera CLA 2021-07-04 14:40:32 EDT
For mac i tested that we can change the unfocused selection color regardless what OS says, so if we can use a way to override this only for content assist table that will solve the dark selection background.

Looking at Win32 code, can't we do something similar inside
CDDS_SUBITEMPREPAINT method ? may be use the focused selection color same as i explained above ?


For GTK, i'm not really sure i perfectly understand the code, but looking at the end of rendererRender, we ask GTK to render according to GTK theme, so i suggest we flip the GTK_CELL_RENDERER_* flags to in this overridden scenario we get the focused theme color.

I can try to fix this, but the problem is building the SWT jars to test them, of course i have access to linux and mac which i can do build, but Windows is the problem ? Is there a way i can build all jars on may be Mac or Linux using docker containers ?
Comment 6 Rolf Theunissen CLA 2021-07-05 04:26:53 EDT
There are two issues here:
1) the default unfocused selection in windows dark is impossible to see (also Bug 564960)
2) mimicking a focused selection in the content assistant (on all platforms for all themes) even if it is not focused.

I am not sure if option 2 gives a good user experience: Visually it is hard to see if the content assistant window has focus or not, though the behavior is different in the two cases, e.g. try using left-right arrows.

W.r.t building jars, why not launch a run-time instance from your Eclipse workspace? No need to build jars to quickly test your code.
Comment 7 Gayan Perera CLA 2021-07-05 11:14:18 EDT
@Rolf i tried to change the code i mention through decompiler but it did worked out on windows 10 as I thought. And flipping explore theme flag gave me the while gradient selection color again. So i think this cannot be fixed from swt right ? Like try to use a custom selection color ?

I tried the same in mac widget and it worked as expected, which means we can even use a custom selection color. 

On windows is there any additional win32 calls that can be used while keeping backward compatibility?
Comment 8 Gayan Perera CLA 2021-07-05 16:57:42 EDT
@Rolf I figured out how to patch win32 code. Will submit so e screenshots tomorrow. I wonder whether we can use the focus rect to identify focus and may be use a style similar to HIDE_SELECTION to only have this feature for popups like content assist. 

WDYT ?
Comment 9 Rolf Theunissen CLA 2021-07-06 02:19:31 EDT
I don't have sufficient knowledge of the SWT implementation myself, all I know is that there are some issues here.

The best way to review your changes is to send a Gerrit with the changes. To provision (set-up) your development environment, I suggest you to use the Oomph method. Then you have your full IDE + Git + dependencies setup in a few clicks, be sure to select the SWT project.

For guides:
https://wiki.eclipse.org/Platform/How_to_Contribute
https://wiki.eclipse.org/Platform_UI/How_to_Contribute/Oomph
https://www.vogella.com/tutorials/EclipsePlatformDevelopment/article.html
Comment 10 Rolf Theunissen CLA 2021-08-11 01:15:17 EDT
Dark theme support provided by the Windows API is still very brittle and only partly official API.

W.r.t. the color of the focused selection, the blueish selection color is the default selection color provided by windows for tables, for trees it provides the gray selection color. This difference is already noticed in Bug 566280, I will push a Gerrit for that soon, but I don't have time to test the impact.

W.r.t the color of the unfocused selection, both on tree and table windows uses a dark selection. This selection is visible in Windows File explorer. Eclipse chose to have less dark background, on this background the selection is not visible. There are two options here:
1. Change the background to be more dark, like Explorer does: See Gerrit in Bug 564960
2. Customize the selection color, e.g. custom/owner drawing it, preferably allow it to be customized with CSS too.
Comment 11 Rolf Theunissen CLA 2021-11-09 08:13:50 EST
*** Bug 577093 has been marked as a duplicate of this bug. ***
Comment 12 Gayan Perera CLA 2022-03-27 10:00:26 EDT
(In reply to Rolf Theunissen from comment #10)
> Dark theme support provided by the Windows API is still very brittle and
> only partly official API.
> 
> 
> W.r.t the color of the unfocused selection, both on tree and table windows
> uses a dark selection. This selection is visible in Windows File explorer.
> Eclipse chose to have less dark background, on this background the selection
> is not visible. There are two options here:
> 1. Change the background to be more dark, like Explorer does: See Gerrit in
> Bug 564960
> 2. Customize the selection color, e.g. custom/owner drawing it, preferably
> allow it to be customized with CSS too.

I think if we want developers to build their own themes, provided that eclipse already supports it, i think we should go for configurability. But we did have owner drawing support before which cause some issues in content assist which my self has reported as well. So may be we should see if we can just override the OS painting happening in SWT and use owner drawing these component areas.