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

Bug 487023

Summary: [GTK3.20] Update SWT to use proper GTK CSS nodes/selectors
Product: [Eclipse Project] Platform Reporter: Eric Williams <ericwill>
Component: SWTAssignee: Eric Williams <ericwill>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: arunkumar.thondapu, markus.kell.r, nobeh5, peter, sravankumarl
Version: 4.6   
Target Milestone: 4.6 M7   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/68046
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=345697d77606dfd42eba2882f0bc51d11576834e
https://git.eclipse.org/r/69657
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=b25636194fb9a2fb5329522cd28d1f794bd08d14
https://git.eclipse.org/r/69729
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=688b4f2113a6b8602f7f40b972a9a1b545b4ffc6
https://git.eclipse.org/r/69832
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=efa2634e4209791dbdb491ab13cbca55a327fb0a
https://git.eclipse.org/r/69848
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=3efcb608db7b67648f0faf639e4664e5c54508fb
https://git.eclipse.org/r/69850
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=c45c50d4eb0964254583e7a949a66bd46c2c69e8
https://git.eclipse.org/r/70643
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=84ec0e619bac5a9b2208d8b35fe0fc7d85a0818a
Whiteboard:
Bug Depends on:    
Bug Blocks: 474628, 490934    
Attachments:
Description Flags
Massive toolbars, entries, and tabs none

Description Eric Williams CLA 2016-02-02 10:57:38 EST
Created attachment 259494 [details]
Massive toolbars, entries, and tabs

GTK3.20 will see a relatively major change in CSS theme machinery which includes the use of CSS nodes and different selectors.

This results in some SWT irregularities, mainly massive toolbars and such things.

You can read more about the GTK3.20 changes here:
https://developer.gnome.org/gtk3/unstable/chap-css-overview.html
https://blogs.gnome.org/mclasen/2015/11/20/a-gtk-update/

Attached is a screenshot of what Eclipse looks like on GTK3.19.6, a preview based on the development branch of GTK3.
Comment 1 Eclipse Genie CLA 2016-03-09 08:46:28 EST
New Gerrit change created: https://git.eclipse.org/r/68046
Comment 3 Eric Williams CLA 2016-03-09 10:37:11 EST
(In reply to Eclipse Genie from comment #2)
> Gerrit change https://git.eclipse.org/r/68046 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=345697d77606dfd42eba2882f0bc51d11576834e

This updates toolbars and window underpinnings. Waiting for bug 483097 to be merged and then I will update the background/foreground CSS.
Comment 4 Eclipse Genie CLA 2016-03-31 15:53:57 EDT
New Gerrit change created: https://git.eclipse.org/r/69657
Comment 6 Eric Williams CLA 2016-04-01 10:24:23 EDT
(In reply to Eclipse Genie from comment #5)
> Gerrit change https://git.eclipse.org/r/69657 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=b25636194fb9a2fb5329522cd28d1f794bd08d14

This patch restores GTK3.18 toolbar sizes for 3.20.
Comment 7 Eclipse Genie CLA 2016-04-01 10:50:23 EDT
New Gerrit change created: https://git.eclipse.org/r/69729
Comment 9 Eclipse Genie CLA 2016-04-04 10:34:44 EDT
New Gerrit change created: https://git.eclipse.org/r/69832
Comment 11 Eric Williams CLA 2016-04-04 11:52:34 EDT
(In reply to Eclipse Genie from comment #10)
> Gerrit change https://git.eclipse.org/r/69832 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=efa2634e4209791dbdb491ab13cbca55a327fb0a

This patch updates background colors to GTK3.20 style CSS nodes.
Comment 12 Eclipse Genie CLA 2016-04-04 13:53:24 EDT
New Gerrit change created: https://git.eclipse.org/r/69848
Comment 14 Eric Williams CLA 2016-04-04 13:56:11 EDT
(In reply to Eclipse Genie from comment #13)
> Gerrit change https://git.eclipse.org/r/69848 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=3efcb608db7b67648f0faf639e4664e5c54508fb

Small typo fix for os_custom.h.
Comment 15 Eclipse Genie CLA 2016-04-04 14:18:53 EDT
New Gerrit change created: https://git.eclipse.org/r/69850
Comment 17 Eric Williams CLA 2016-04-04 14:22:35 EDT
(In reply to Eclipse Genie from comment #16)
> Gerrit change https://git.eclipse.org/r/69850 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=c45c50d4eb0964254583e7a949a66bd46c2c69e8

Final fix is in, all the CSS being fed to GTK is 3.20/CSS node compatible.
Comment 18 Markus Keller CLA 2016-04-08 16:28:20 EDT
All these code duplications for GTK >= OS.VERSION(3, 20, 0) are a breeding ground for future errors that will inevitable creep in:

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/diff/bundles/org.eclipse.swt/Eclipse%20SWT/gtk/org/eclipse/swt/widgets/Tree.java?id=efa2634e4209791dbdb491ab13cbca55a327fb0a

Please replace this with a DRY (don't repeat yourself) coding style that keeps the main CSS in a single place and only branches on the real differences.

E.g. like this:

String treeview = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView";
css = treeview + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n";

Or like this, if the mapping is somehow predictable and you can offload the conversion to a utility method adjustCssSelector(..):

String css = adjustCssSelector("GtkTreeView") + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n";
Comment 19 Eric Williams CLA 2016-04-13 09:44:41 EDT
(In reply to Markus Keller from comment #18)
> All these code duplications for GTK >= OS.VERSION(3, 20, 0) are a breeding
> ground for future errors that will inevitable creep in:
> 
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/diff/bundles/org.
> eclipse.swt/Eclipse%20SWT/gtk/org/eclipse/swt/widgets/Tree.
> java?id=efa2634e4209791dbdb491ab13cbca55a327fb0a
> 
> Please replace this with a DRY (don't repeat yourself) coding style that
> keeps the main CSS in a single place and only branches on the real
> differences.
> 
> E.g. like this:
> 
> String treeview = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" :
> "GtkTreeView";
> css = treeview + " {background-color: " +
> display.gtk_rgba_to_css_string(background) + ";}\n";
> 
> Or like this, if the mapping is somehow predictable and you can offload the
> conversion to a utility method adjustCssSelector(..):
> 
> String css = adjustCssSelector("GtkTreeView") + " {background-color: " +
> display.gtk_rgba_to_css_string(background) + ";}\n";

Yeah that's reasonable, I'll implement something later today.
Comment 20 Eclipse Genie CLA 2016-04-14 09:09:23 EDT
New Gerrit change created: https://git.eclipse.org/r/70643
Comment 21 Eric Williams CLA 2016-04-14 09:57:59 EDT
(In reply to Eclipse Genie from comment #20)
> New Gerrit change created: https://git.eclipse.org/r/70643

Markus: I made a change with your suggestions. Please let me know if it looks good to you.
Comment 23 Sravan Kumar Lakkimsetti CLA 2016-04-26 02:59:43 EDT
Hi Eric,

Can you please verify this for M7 milestone build?

Thanks
Sravan
Comment 24 Eric Williams CLA 2016-04-26 09:21:22 EDT
(In reply to Sravan Kumar Lakkimsetti from comment #23)
> Hi Eric,
> 
> Can you please verify this for M7 milestone build?
> 
> Thanks
> Sravan

Verified fixed in N20160423-1500.