-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep theme coloring of cells in FocusCellOwnerDrawHighlighter #1689
Keep theme coloring of cells in FocusCellOwnerDrawHighlighter #1689
Conversation
The JavaDoc of the class says:
Does your change now no longer highlight the current selected cell? |
Test Results 918 files + 1 918 suites +1 47m 33s ⏱️ + 9m 44s For more details on these failures, see this check. Results for commit cbf9737. ± Comparison against base commit 5bd3301. ♻️ This comment has been updated with latest results. |
The cell is still highlighted, see the screenshot. The problem was that the rest of the row should be colored as if it wasn't selected. This was done by setting the background to
Yes, good point. The problem is that the table rows are displayed in black and a very dark grey in alternating order. And as said, |
The problem is that the color for table row is never set, neither in the light mode nor in the dark mode. So the default color of the viewer is used, which is just a pure white:
So if possible the best solution would be to set the color into the viewer row, but as said, the alternating color must be followed and I cannot find any coding where this is done. So if someone has an idea or a hint where I can find coding related to this it would be nice. |
Where is this alternating of the color done? |
I'm not sure, I cannot find the coding for this one. I think this is a Mac only feature, at least on windows the alternating of the color is not done. |
Ah ok. So this may be in the native part of SWT. |
This issue also exists in the light theme on macOS but it's not so apparent there: For lines with light background it's correct and for grey lines the difference between grey and white can easily been overlooked. |
I have tested the change using the provided demo shell on Windows (Windows 11 Enterprise, Version 21H2, Build 22000.2777) without noticing any difference in behavior in highlighting behavior. Below, you can find two example screenshots with and without the patch. I'll also test on Linux and post the results. |
Here are my test results with the provided demo shell on Linux (Ubuntu 22.04.4 LTS, Gnome 42.9, X11). There is a noticable difference on Linux, and I think the existing implementation is actually motivated by the behavior on GTK: It seems like on GTK the whole row is highlighted and setting the individual background color for the cells ensures that for non-selected cells the highlighting is overwritten. You can see in the screenshots below, that this is a kind of hacky solution, as you can still see the row highlighted behind the cell, but at least the user can see which cell is selected. After applying this patch, it will become impossible to know which cell is selected. |
So should we limit @Christopher-Hermann patch to only set the transparency on macOS as on windows the problem doesn't exist and on GTK it's even harmfull? |
If there is no alternative, I think that would be the way to go. However, I would try to avoid OS-specific behavior whenever possible. Do we know why the original line is working on every OS except Mac? More precisely, do we know why the background color returned by the viewer row is "wrong" on Mac? Since it works on the other OS', the returned color does not seem to be non-themed in general. Line 109 in ea87817
|
eclipse.platform.ui/bundles/org.eclipse.ui.themes/css/e4-dark_mac.css Lines 43 to 49 in cb121fe
By unsetting the color for Trees/Tables on MacOs, the default color is returned which is just white. |
Thanks for explanation, @Christopher-Hermann! I currently don't see any generic, i.e., OS-independent, solution. My understanding (from some experiments I made) is as follows: On Windows and Mac, it is sufficient to remove the So in conclusion: the "special case" for me is GTK and not Mac, which is why I would not propose to apply the alpha-value solution for Mac. Instead I would restrict the application of the background color to GTK (or even better to ensure that the row is not highlighted on GTK at all, like it is done on the other OS'). |
At @Christopher-Hermann is this something you think can do? |
a2f0be0
to
11c756f
Compare
Yes, done. Thanks for testing and the hint @HeikoKlare. The fix works fine on MacOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the PR! I've tested the current changes on all three platforms and they work as expected.
Just one minor proposal for improvement: instead of adding further platform dependencies, I suggest to use the abilities for GTK identification provided by SWT, as the dependency to SWT exists anyway.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/FocusCellOwnerDrawHighlighter.java
Outdated
Show resolved
Hide resolved
In dark theme on macOS, the cell back ground color are colored in light colors when using a FocusCellOwnerDrawHighlighter. By setting the background color alpha to 0, the color is not even draw and the initial color is kept.
4caa29e
to
cbf9737
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still works as expected. Thank you!
Ready to be merged from my side.
Same for me. I will merge once the validation-build looks good. |
Test failures are pre-existing and already reported in Merging this. |
In dark theme, the cell back ground color are colored in light colors when using a FocusCellOwnerDrawHighlighter. By setting the background color alpha to 0, the color is not even draw and the initial color is kept.
Coloring on macOS before the fix:
Coloring on macOS after the fix:
Reproduce/Test
To test the issue on your platform, import the project focusCellDemo.zip and execute command "Open focus cell demo" to open a dialog with a demo viewer.