Bug 531392 - [Dark Theme] PopupDialog uses system colors
Summary: [Dark Theme] PopupDialog uses system colors
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 4.8 M6   Edit
Assignee: Matthias Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 501781 fullScreenPopup (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-02-20 07:58 EST by Matthias Becker CLA
Modified: 2018-02-27 03:17 EST (History)
4 users (show)

See Also:


Attachments
Screenshot showing the issue (11.41 KB, image/png)
2018-02-20 07:58 EST, Matthias Becker CLA
no flags Details
Screenshot with the fix (12.79 KB, image/png)
2018-02-20 08:02 EST, Matthias Becker CLA
no flags Details
Screenshot with the fix in the light theme (12.97 KB, image/png)
2018-02-20 09:31 EST, Matthias Becker CLA
no flags Details
Screenshot before in the light theme (12.98 KB, image/png)
2018-02-20 09:34 EST, Matthias Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Becker CLA 2018-02-20 07:58:01 EST
Created attachment 272753 [details]
Screenshot showing the issue

The Eclips Update Notification is not correctly styled in the dark theme.
It has a light color.
The cause is that in protected PopupDialog#getBackground() SWT.COLOR_INFO_BACKGROUND is used.

Sub-Classes of PopupDialog (e.g. org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdatesPopup could overright getBackground (as e.g. the jface ContentProposalAdapter does) but I think it's a better ways to provide a meaningful default in PopupDialog#getBackground().
For PopupDialog#getDefaultForeground() the same applies.
Do we already have color-preference keys that can be used as background / foreground color?
I only found "Content Assist background / foreground color" or "Information background / foreground color".

Also see attachement "update_before.png"
Comment 1 Eclipse Genie CLA 2018-02-20 08:02:35 EST
New Gerrit change created: https://git.eclipse.org/r/117749
Comment 2 Matthias Becker CLA 2018-02-20 08:02:58 EST
Created attachment 272754 [details]
Screenshot with the fix
Comment 3 Lars Vogel CLA 2018-02-20 08:06:39 EST
*** Bug 531269 has been marked as a duplicate of this bug. ***
Comment 4 Lars Vogel CLA 2018-02-20 08:13:57 EST
Very nice, fixes also the issues in the light theme reported with Bug 531269.
Comment 5 Matthias Becker CLA 2018-02-20 08:16:41 EST
(In reply to Lars Vogel from comment #3)
> *** Bug 531269 has been marked as a duplicate of this bug. ***

Are u sure that this is really the same issue?
Is this a Linux specific issue? At least on Mac this issue does not exist.
Comment 6 Lars Vogel CLA 2018-02-20 08:22:37 EST
(In reply to Matthias Becker from comment #5)
> Are u sure that this is really the same issue?
> Is this a Linux specific issue? 

Yes, it is a Linux specific issue and I'm sure that this is the same issue. I also tested your patch and with it the correct colors is used for Linux.
Comment 7 Matthias Becker CLA 2018-02-20 08:26:18 EST
Did u also test the update-dialog shows up in the correct colors?
Comment 8 Matthias Becker CLA 2018-02-20 09:31:09 EST
Created attachment 272758 [details]
Screenshot with the fix in the light theme
Comment 9 Matthias Becker CLA 2018-02-20 09:34:30 EST
Created attachment 272759 [details]
Screenshot before in the light theme
Comment 10 Matthias Becker CLA 2018-02-20 10:34:51 EST
(In reply to Lars Vogel from comment #6)
> (In reply to Matthias Becker from comment #5)
> > Are u sure that this is really the same issue?
> > Is this a Linux specific issue? 
> 
> Yes, it is a Linux specific issue and I'm sure that this is the same issue.
> I also tested your patch and with it the correct colors is used for Linux.

I am not quite sure about my implementation. I have added a question in gerrit.
@Lars: Can you have a look at that question?
Comment 11 Lars Vogel CLA 2018-02-20 11:27:51 EST
(In reply to Matthias Becker from comment #10)
> @Lars: Can you have a look at that question?

Via a text search for SWT.FOCUS, I did not find a usage of this flag in eclipse.platform.ui for popup dialogs.  Also in general I don't understand why we anyway should be using a different hard-coded color based on the SWT.FOCUS flag. 

I think it is OK to merge this and if someone finds an issue with this, we can revisted.
Comment 13 Lars Vogel CLA 2018-02-21 04:00:40 EST
I suggest to add this to the N&N. If you add an entry for the dark theme, I can add the info that the light theme is Linux is also fixed with a screenshot.
Comment 14 Eclipse Genie CLA 2018-02-21 04:24:50 EST
New Gerrit change created: https://git.eclipse.org/r/117841
Comment 16 Alexander Kurtakov CLA 2018-02-21 05:06:59 EST
Thanks, Matthias. These UI touches are quite annoying and it's a relief to see them fixed.
Comment 17 Lars Vogel CLA 2018-02-21 05:13:49 EST
(In reply to Lars Vogel from comment #13)
> I suggest to add this to the N&N. If you add an entry for the dark theme, I
> can add the info that the light theme is Linux is also fixed with a
> screenshot.

Looking at the entry, an extra Linux entry seems unnecessary.
Comment 18 Dani Megert CLA 2018-02-21 12:31:46 EST
Please revert that change asap. The white background of the Quick Outline is now replaced by a yellow hover-like background, which is not OK.
Comment 19 Dani Megert CLA 2018-02-21 12:33:05 EST
(In reply to Dani Megert from comment #18)
> Please revert that change asap. The white background of the Quick Outline is
> now replaced by a yellow hover-like background, which is not OK.

There was a good reason for the
    if ((getShellStyle() & SWT.NO_FOCUS) != 0) {
Comment 20 Leo Ufimtsev CLA 2018-02-21 14:37:53 EST
My 50 cents (as having implemented the INFORMATION_ color...):

So in general INFORMATION_ color is intended to replace use of "TOOLTIP_", it's generally not a replacement for LIST_*, as is the case here:
https://git.eclipse.org/r/#/c/117749/
(the patch above merges TOOLTIP and LIST, which should be kept separate I think?)

With that said, keep in mind:
- on win/cocoa, INFORMATION_ by default translates to TOOLTIP_*
- Gtk, INFORMATION_ by default translates to LIST_*
  So on gtk, if you use INFORMATION_ and LIST_*, you get the same color.

The fix I think should utilize INFORMATION_ where 'tooltip' was used, and perhaps a slightly different case when focus is used (e.g make color darker etc..).
Comment 21 Eclipse Genie CLA 2018-02-22 02:40:10 EST
New Gerrit change created: https://git.eclipse.org/r/117920
Comment 22 Eclipse Genie CLA 2018-02-22 02:40:22 EST
New Gerrit change created: https://git.eclipse.org/r/117921
Comment 23 Alexander Kurtakov CLA 2018-02-22 02:44:43 EST
(In reply to Eclipse Genie from comment #21)
> New Gerrit change created: https://git.eclipse.org/r/117920

Should we really go for revert? IMHO Leo's comment 20 is the right way forward.
Comment 24 Matthias Becker CLA 2018-02-22 02:48:47 EST
(In reply to Alexander Kurtakov from comment #23)
> (In reply to Eclipse Genie from comment #21)
> > New Gerrit change created: https://git.eclipse.org/r/117920
> 
> Should we really go for revert? IMHO Leo's comment 20 is the right way
> forward.

I revert it and will then will take my time to provide a new change.
Comment 25 Matthias Becker CLA 2018-02-22 03:05:26 EST
(In reply to Leo Ufimtsev from comment #20)
> The fix I think should utilize INFORMATION_ where 'tooltip' was used, and
> perhaps a slightly different case when focus is used (e.g make color darker
> etc..).

But in the old code TOOLTIP* was not used. I did not quite get your point.
Do you have a pointer to place where you did a similar change?
Comment 26 Alexander Kurtakov CLA 2018-02-22 03:09:59 EST
(In reply to Matthias Becker from comment #25)
> (In reply to Leo Ufimtsev from comment #20)
> > The fix I think should utilize INFORMATION_ where 'tooltip' was used, and
> > perhaps a slightly different case when focus is used (e.g make color darker
> > etc..).
> 
> But in the old code TOOLTIP* was not used. I did not quite get your point.
> Do you have a pointer to place where you did a similar change?

TOOLTIP* should have been COLOR_INFO*. If you look at COLOR_INFO_BACKGROUND javadoc it says "System color used to paint tooltip background areas (value is 29)."
Comment 28 Matthias Becker CLA 2018-02-22 04:20:02 EST
(In reply to Dani Megert from comment #19)
> (In reply to Dani Megert from comment #18)
> > Please revert that change asap. The white background of the Quick Outline is
> > now replaced by a yellow hover-like background, which is not OK.
> 
> There was a good reason for the
>     if ((getShellStyle() & SWT.NO_FOCUS) != 0) {

With quick-outline you mean Ctrl-O e.g. in the java editor?
For this case if ((getShellStyle() & SWT.NO_FOCUS) != 0) also is false (as well as for the update popup.
So the cause of this error is not the removal of this condition but the fact that i picked the wrong color definition.
Comment 29 Dani Megert CLA 2018-02-22 04:40:13 EST
(In reply to Matthias Becker from comment #28)
> (In reply to Dani Megert from comment #19)
> > (In reply to Dani Megert from comment #18)
> > > Please revert that change asap. The white background of the Quick Outline is
> > > now replaced by a yellow hover-like background, which is not OK.
> > 
> > There was a good reason for the
> >     if ((getShellStyle() & SWT.NO_FOCUS) != 0) {
> 
> With quick-outline you mean Ctrl-O e.g. in the java editor?

Yes.

> For this case if ((getShellStyle() & SWT.NO_FOCUS) != 0) also is false (as
> well as for the update popup.
> So the cause of this error is not the removal of this condition but the fact
> that i picked the wrong color definition.

Right. I'm fine to replace COLOR_INFO_FOREGROUND/tooltop colors. But the LIST color must either be kept or a new color (constant) needs to be defined.
Comment 30 Matthias Becker CLA 2018-02-22 06:18:40 EST
(In reply to Dani Megert from comment #29)
> (In reply to Matthias Becker from comment #28)
> > (In reply to Dani Megert from comment #19)
> > > (In reply to Dani Megert from comment #18)
> > > > Please revert that change asap. The white background of the Quick Outline is
> > > > now replaced by a yellow hover-like background, which is not OK.
> > > 
> > > There was a good reason for the
> > >     if ((getShellStyle() & SWT.NO_FOCUS) != 0) {
> > 
> > With quick-outline you mean Ctrl-O e.g. in the java editor?
> 
> Yes.
> 
> > For this case if ((getShellStyle() & SWT.NO_FOCUS) != 0) also is false (as
> > well as for the update popup.
> > So the cause of this error is not the removal of this condition but the fact
> > that i picked the wrong color definition.
> 
> Right. I'm fine to replace COLOR_INFO_FOREGROUND/tooltop colors. But the
> LIST color must either be kept or a new color (constant) needs to be defined.

Sorry for askting again. Maybe I don't see a very simple point.

So this would be wrong?
private Color getDefaultBackground() {
	if ((getShellStyle() & SWT.NO_FOCUS) != 0) {
		return getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
	}
	return JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
}

If JFacePreferences.INFORMATION_BACKGROUND_COLOR is the replacement for SWT.COLOR_INFO_BACKGROUND  what is the replacement for SWT.COLOR_LIST_BACKGROUND?
Comment 31 Alexander Kurtakov CLA 2018-02-22 07:05:53 EST
CONTENT_ASSIST_BACKGROUND should be good match in place of COLOR_LIST_BACKGROUND as content assist and quick outline should match in colors.

aka

private Color getDefaultBackground() {
	if ((getShellStyle() & SWT.NO_FOCUS) != 0) {
		return JFaceResources.getColorRegistry().get(JFacePreferences.INFORMATION_BACKGROUND_COLOR);
	}
	return JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
}
Comment 32 Eclipse Genie CLA 2018-02-22 08:00:43 EST
New Gerrit change created: https://git.eclipse.org/r/117943
Comment 33 Matthias Becker CLA 2018-02-22 08:02:20 EST
(In reply to Alexander Kurtakov from comment #31)
> CONTENT_ASSIST_BACKGROUND should be good match in place of
> COLOR_LIST_BACKGROUND as content assist and quick outline should match in
> colors.
> 
> aka
> 
> private Color getDefaultBackground() {
> 	if ((getShellStyle() & SWT.NO_FOCUS) != 0) {
> 		return
> JFaceResources.getColorRegistry().get(JFacePreferences.
> INFORMATION_BACKGROUND_COLOR);
> 	}
> 	return
> JFaceResources.getColorRegistry().get(JFacePreferences.
> CONTENT_ASSIST_BACKGROUND_COLOR);
> }

I implemented this with my new change.
On macOS the update dialog, the quick outline and that no-focus that appreas when you do Window > Appearance > Toggle Full Screen Mode all look good in light and dark them.

@Dani: Can you pls check on windows if it now is ok?
@Lars: How does it look on Linux
Comment 35 Dani Megert CLA 2018-02-23 10:53:07 EST
N&N still needs to be merged.
Comment 36 Matthias Becker CLA 2018-02-23 10:55:07 EST
(In reply to Dani Megert from comment #35)
> N&N still needs to be merged.

It's still in. What was pending (because of a merge conflict) was the revert of the N&N. But we no longer need the revert.

Thanks for testing and the advice.
Comment 37 Lars Vogel CLA 2018-02-27 03:17:38 EST
*** Bug 501781 has been marked as a duplicate of this bug. ***