Bug 561177 - [GTK] Wrong text background in Resource properties dialog
Summary: [GTK] Wrong text background in Resource properties dialog
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.16   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.16 M1   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-03-17 04:51 EDT by Andrey Loskutov CLA
Modified: 2020-03-18 17:41 EDT (History)
3 users (show)

See Also:


Attachments
wrong background (58.33 KB, image/png)
2020-03-17 04:51 EDT, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2020-03-17 04:51:04 EDT
Created attachment 282126 [details]
wrong background

See attached picture. That happened on recent 4.16 builds (I see this in I20200316-1800, GTK 3.22.30 on RHEL 7.4).

I assume it is a regression from one of bug 561047 commits, probably some usual GTK CSS weirdness.
Comment 2 Andrey Loskutov CLA 2020-03-17 05:09:56 EDT
OK, looks like Adwaita can show right colors there, so the regression is for non-default themes only (that supposed something like CSS id's were kind of API, which is of course was never the case for GTK3).

Clearlooks-Phenix is affected, we will most likely need to provide patch on our end, need to check what was changed in detail.

Related SWT code change is:

https://git.eclipse.org/r/#/c/159272/3/bundles/org.eclipse.swt/Eclipse+SWT/gtk/org/eclipse/swt/widgets/Text.java

We can also check why only specific cases are affected, may be the way how Text instances are created in org.eclipse.ui.internal.ide.dialogs.ResourceInfoPage.createBasicInfoGroup() is "special".

Commenting out lines below "fixes" the issue:

diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java
index cb3f156..9684698 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java
@@ -212,8 +212,8 @@
 		gd.horizontalAlignment = GridData.FILL;
 		gd.horizontalSpan = 2;
 		pathValueText.setLayoutData(gd);
-		pathValueText.setBackground(pathValueText.getDisplay().getSystemColor(
-				SWT.COLOR_WIDGET_BACKGROUND));
+//		pathValueText.setBackground(pathValueText.getDisplay().getSystemColor(
+//				SWT.COLOR_WIDGET_BACKGROUND));
 
 		// The group for types
 		Label typeTitle = new Label(basicInfoComposite, SWT.LEFT);
@@ -223,8 +223,8 @@
 		GridDataFactory.swtDefaults().span(2, SWT.DEFAULT).applyTo(typeValue);
 		typeValue.setText(IDEResourceInfoUtils.getTypeString(resource,
 				getContentDescription(resource)));
-		typeValue.setBackground(typeValue.getDisplay().getSystemColor(
-				SWT.COLOR_WIDGET_BACKGROUND));
+//		typeValue.setBackground(typeValue.getDisplay().getSystemColor(
+//				SWT.COLOR_WIDGET_BACKGROUND));
 
 		if (resource.isLinked() && !resource.isVirtual()) {
 			// The group for location
Comment 3 Andrey Loskutov CLA 2020-03-17 05:11:39 EDT
Thanks Dani!
Comment 4 Andrey Loskutov CLA 2020-03-18 09:45:57 EDT
The change on ResourceInfoPage was done for Linux only, see bug 80646, but I was wrong regarding *this* bug - now I couldn't reproduce anything by removing the calls to set GB color on text fields. Must mixed something before.

The color constants values did not change either due the commit => this is CSS selector only change.

The CSS style we create in NOW org.eclipse.swt.widgets.Text.setBackgroundGdkRGBA(long, long, GdkRGBA)

textview {background-color: rgb(237,236,235);}
textview text:selected {background-color: rgb(148,182,224);}
textview text selection {color: rgb(255,255,255);}

before we created:

textview text {background-color: rgb(237,236,235);}
textview text:selected {background-color: rgb(148,182,224);}
textview text selection {color: rgb(255,255,255);}

We see a typo in the first CSS line. I will push fix in a moment.
Comment 5 Eclipse Genie CLA 2020-03-18 09:53:03 EDT
New Gerrit change created: https://git.eclipse.org/r/159623
Comment 6 Alexander Kurtakov CLA 2020-03-18 09:56:26 EDT
My mistake, sorry about that. I read twice the changes but still missed this one.
Comment 7 Andrey Loskutov CLA 2020-03-18 09:59:24 EDT
(In reply to Alexander Kurtakov from comment #6)
> My mistake, sorry about that. I read twice the changes but still missed this
> one.

Alex, I had to read it more then once to spot the difference in debugger. The code was real spaghetti.
Comment 8 Alexander Kurtakov CLA 2020-03-18 10:46:03 EDT
(In reply to Andrey Loskutov from comment #7)
> (In reply to Alexander Kurtakov from comment #6)
> > My mistake, sorry about that. I read twice the changes but still missed this
> > one.
> 
> Alex, I had to read it more then once to spot the difference in debugger.
> The code was real spaghetti.

Absolutely. There is a reason why I push so much for cleanups - in many places we need badly to drop such stuff as otherwise fear from fixing/changing anything will spread out again as no one can be sure if he has to touch such code.
Comment 10 Andrey Loskutov CLA 2020-03-18 17:41:15 EDT
Verified with build I20200318-1400