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

Bug 479998

Summary: [GTK3] Form/wizard Composites have incorrect background colors
Product: [Eclipse Project] Platform Reporter: Eric Williams <ericwill>
Component: SWTAssignee: Eric Williams <ericwill>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: adietish, akurtakov, arunkumar.thondapu, daniel_megert, gegastaldi, Lars.Vogel, lshanmug, mat.booth, sravankumarl
Version: 4.6Flags: akurtakov: review+
arunkumar.thondapu: review+
Target Milestone: 4.5.2   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/61332
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=daefb444e2757b0fda729cafbeea7c19efa979a3
https://git.eclipse.org/r/62380
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=a6809d2829e8dba637cdcebd3962e699b1a152b4
https://git.eclipse.org/r/63643
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=12badf3289f1dc4ea2839d8c8c42af50fb2f0249
https://git.eclipse.org/r/63649
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=877e1c7fef9e54164608e5806ac620db281f5b9f
Whiteboard:
Bug Depends on: 484729    
Bug Blocks: 474628    
Attachments:
Description Flags
Composite background color irregularity
none
JFace Snippet047 with red background color set, F23
none
JFace Snippet047 with red background color set, F22
none
JFace Snippet047 with red background color set, F22 with Gtk2
none
Eclipse with CSS styling for Control.setBackground() none

Description Eric Williams CLA 2015-10-16 15:23:47 EDT
Created attachment 257316 [details]
Composite background color irregularity

Bug:
Certain Composites (swtFixed) have improper background colors in Gtk3. Most notable of these is the workspace chooser dialog that pops up when you first launch Eclipse. As you can see in the attached screenshot, the title area Composite has a gray background, but the labels have white backgrounds. The default behavior is to have a totally white background for the title area Composite. 

As far as I can tell it seems to be related to Gtk3.18 (vs. 3.16) as the nightly builds on my Fedora 22 machine are unaffected.

Versions affected:
Gtk3.18+
Fedora 23 Eclipse 4.5.1+

Steps to re-produce:
1) Launch freshly installed Eclipse and observe the issue in the workspace chooser

OR

2) Launch Eclipse JDT and open the Run Configurations window.
Comment 1 Eric Williams CLA 2015-10-16 15:50:34 EDT
From what I can tell so far it seems to be related -- at least in part -- to the native Gtk calls.

For example, when using proper CSS styling to set background colors, only selected portions of the Composite change colors on Gtk3.18. Yet when using the same native call to change colors on Gtk3.16, the entire Composite changes color properly.
Comment 2 Eric Williams CLA 2015-10-19 15:25:09 EDT
Using gtk_widget_override_background_color() in this context has zero effect on Gtk3.18.
Comment 3 Eric Williams CLA 2015-10-26 10:10:15 EDT
Created attachment 257513 [details]
JFace Snippet047 with red background color set, F23

I have set the background color to red to make the issue more apparent. This screenshot shows the background not being fully set, compared to Gtk3.16 and Gtk2.
Comment 4 Eric Williams CLA 2015-10-26 10:11:15 EDT
Created attachment 257514 [details]
JFace Snippet047 with red background color set, F22

Correct Gtk3 behavior on Gtk3.16 -- read color is set for the entire title composite (except for the image in the top right corner).
Comment 5 Eric Williams CLA 2015-10-26 10:11:46 EDT
Created attachment 257515 [details]
JFace Snippet047 with red background color set, F22 with Gtk2

Correct behavior on Gtk2, for reference.
Comment 6 Eric Williams CLA 2015-10-26 11:20:51 EDT
I've compiled back to Gtk3.17.1 and this issue still occurs, might not be directly tied to the version of Gtk. I will leave the title of this bug as "GTK3" in the meantime.
Comment 7 Eric Williams CLA 2015-10-26 16:11:15 EDT
(In reply to Eric Williams from comment #6)
> I've compiled back to Gtk3.17.1 and this issue still occurs, might not be
> directly tied to the version of Gtk. I will leave the title of this bug as
> "GTK3" in the meantime.

I was mistaken, this is caused by Gtk3, specifically this commit:
https://github.com/GNOME/gtk/commit/c4b88e05fd6f7018a2ed241610ed97323650ec41
Comment 8 Eric Williams CLA 2015-10-27 10:35:08 EDT
Created attachment 257544 [details]
Eclipse with CSS styling for Control.setBackground()

(In reply to Eric Williams from comment #7)
> (In reply to Eric Williams from comment #6)
> > I've compiled back to Gtk3.17.1 and this issue still occurs, might not be
> > directly tied to the version of Gtk. I will leave the title of this bug as
> > "GTK3" in the meantime.
> 
> I was mistaken, this is caused by Gtk3, specifically this commit:
> https://github.com/GNOME/gtk/commit/c4b88e05fd6f7018a2ed241610ed97323650ec41

Judging by the contents of this commit, it seems gtk_widget_override_* functions are no longer working in versions of Gtk greater than 3.16.x, as they have become deprecated.

The alternative to this is CSS styling, which doesn't seem to work as desired -- see attached screenshot. Many of the colors are off, or need tweaking.
Comment 9 Eric Williams CLA 2015-10-29 11:56:49 EDT
(In reply to Eric Williams from comment #8)
> The alternative to this is CSS styling, which doesn't seem to work as
> desired -- see attached screenshot. Many of the colors are off, or need
> tweaking.

I can confirm that this also occurs when using gtk_render_background(), as the GTK documentation suggests. The results are identical.
Comment 10 Eric Williams CLA 2015-11-03 15:46:25 EST
*** Bug 481345 has been marked as a duplicate of this bug. ***
Comment 11 Eclipse Genie CLA 2015-11-26 09:16:16 EST
New Gerrit change created: https://git.eclipse.org/r/61332
Comment 13 Eclipse Genie CLA 2015-12-10 09:37:29 EST
New Gerrit change created: https://git.eclipse.org/r/62380
Comment 14 Alexander Kurtakov CLA 2015-12-15 08:04:17 EST
Reopen for backporting.
Comment 16 Alexander Kurtakov CLA 2016-01-06 09:05:42 EST
This would need backporting http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=5cd53fd10251fa9c8547fd06882b3d69b5c275a1 too to fix the exessive CPU usage.
Comment 17 Eric Williams CLA 2016-01-06 09:44:35 EST
(In reply to Alexander Kurtakov from comment #16)
> This would need backporting
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=5cd53fd10251fa9c8547fd06882b3d69b5c275a1 too to fix the exessive CPU
> usage.

Yes, I'll push a backport patch for this as well.
Comment 18 Eclipse Genie CLA 2016-01-06 09:44:48 EST
New Gerrit change created: https://git.eclipse.org/r/63643
Comment 20 Eclipse Genie CLA 2016-01-06 10:25:09 EST
New Gerrit change created: https://git.eclipse.org/r/63649
Comment 21 Eric Williams CLA 2016-01-06 10:27:52 EST
(In reply to Eclipse Genie from comment #20)
> New Gerrit change created: https://git.eclipse.org/r/63649

Arun, I merged the two changes into this one for backporting.
Comment 22 Sravan Kumar Lakkimsetti CLA 2016-01-11 04:00:55 EST
(In reply to Eric Williams from comment #21)
> (In reply to Eclipse Genie from comment #20)
> > New Gerrit change created: https://git.eclipse.org/r/63649
> 
> Arun, I merged the two changes into this one for backporting.

Hi Eric,

Can you please create a cumulative gerrit patch for backport? I will push it for 4.5.2

Thanks
Sravan
Comment 23 Eric Williams CLA 2016-01-11 10:50:28 EST
(In reply to Sravan Kumar Lakkimsetti from comment #22)
> Hi Eric,
> 
> Can you please create a cumulative gerrit patch for backport? I will push it
> for 4.5.2
> 
> Thanks
> Sravan

What do you mean by "cumulative"? I've created one patch with the changes for both bug 479998 and bug 484729: https://git.eclipse.org/r/#/c/63649/
Comment 24 Sravan Kumar Lakkimsetti CLA 2016-01-11 22:49:34 EST
(In reply to Eric Williams from comment #23)
> (In reply to Sravan Kumar Lakkimsetti from comment #22)
> > Hi Eric,
> > 
> > Can you please create a cumulative gerrit patch for backport? I will push it
> > for 4.5.2
> > 
> > Thanks
> > Sravan
> 
> What do you mean by "cumulative"? I've created one patch with the changes
> for both bug 479998 and bug 484729: https://git.eclipse.org/r/#/c/63649/

This bug has multiple commits so I wanted a cumulative patch so that we can commit to maintenance stream. Now that it has been created I will check and commit today
Comment 25 Arun Thondapu CLA 2016-01-12 02:24:50 EST
(In reply to Eric Williams from comment #21)
> (In reply to Eclipse Genie from comment #20)
> > New Gerrit change created: https://git.eclipse.org/r/63649
> 
> Arun, I merged the two changes into this one for backporting.

Thanks Eric! Did you try to build the libraries with this patch? The GTK2 build is failing and that needs to be fixed, here are the error messages...

os.c: In function ‘Java_org_eclipse_swt_internal_gtk_OS__1gdk_1rgba_1to_1string’:
os.c:7188:2: error: unknown type name ‘GdkRGBA’
  GdkRGBA _arg0, *lparg0=NULL;
  ^
os.c:7198:52: error: unknown type name ‘GdkRGBA’
    rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkRGBA *))fp)((GdkRGBA *)lparg0);
                                                    ^
os.c:7198:63: error: expected ‘)’ before ‘fp’
    rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkRGBA *))fp)((GdkRGBA *)lparg0);
                                                               ^
os.c:7198:68: error: ‘GdkRGBA’ undeclared (first use in this function)
    rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkRGBA *))fp)((GdkRGBA *)lparg0);
                                                                    ^
os.c:7198:68: note: each undeclared identifier is reported only once for each function it appears in
os.c:7198:77: error: expected expression before ‘)’ token
    rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkRGBA *))fp)((GdkRGBA *)lparg0);
Comment 26 Eric Williams CLA 2016-01-12 08:46:59 EST
(In reply to Arun Thondapu from comment #25)
> Thanks Eric! Did you try to build the libraries with this patch? The GTK2
> build is failing and that needs to be fixed, here are the error messages...

My apologies, I forgot to include the os.h file in the commit. I've fixed it up and both GTK3 and GTK2 build now.