Bug 577370

Summary: [GTK4] CSS not being applied correctly to widgets
Product: [Eclipse Project] Platform Reporter: Joel Majano <jmajano>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.22   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 540385, 567138, 567215, 574977    
Attachments:
Description Flags
Snippet to reproduce ToolBar background Bug (Background should be red) none

Description Joel Majano CLA 2021-11-19 16:18:19 EST
Created attachment 287551 [details]
Snippet to reproduce ToolBar background Bug (Background should be red)

On GTK4, CSS Styles are not being applied correctly. A couple examples so far are in the ToolBar snippet included and in ControlExample, where the background of certain elements are white instead of gray (in GTK3).

In the included snippet, the toolbar background should be red (which it is in GTK3) but it is gray instead.

There is also a css warning which can be resolved by changing the "String css =..." line in ToolBar.java:636 and adding <+ ";}"> to the end.
Comment 1 Joel Majano CLA 2021-11-30 12:28:40 EST
After seeing Alexandr Miloslavskiy's patch for Bug 570502, I was interested in seeing what effects that would have on GTK4. I reverted back to the commit before that bug was fixed to test it out. I tried the original snippet that was included to reproduce that bug, and in GTK4 (Wayland) the snippet is unable to launch as there are gtk_style_context_add_provider and gtk_css_provider_load_from_data errors. 

Now switching to master, the snippet launches with no errors. However, even though the combo appears to be looking like its supposed to, the drop down menu is incorrect as it appears white/gray, when its supposed to be the same color as the background (dark grey).

As pointed out by Alex in the comments of that patch, it seems that a lot of these CSS issues can start being fixed by implementing something like Alexandr did here (https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/176058) and then figuring out why certain elements are still not working.