Bug 577430 - [GTK4] Wrong background in ControlExample
Summary: [GTK4] Wrong background in ControlExample
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.23   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.23 M1   Edit
Assignee: Joel Majano CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 574977
Blocks: 540385
  Show dependency tree
 
Reported: 2021-11-24 12:20 EST by Alexander Kurtakov CLA
Modified: 2022-01-06 10:19 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kurtakov CLA 2021-11-24 12:20:20 EST
All tabs background is white instead of gray.
Comment 1 Joel Majano CLA 2021-12-07 15:19:08 EST
The fix being explored involved changing the CSS architecture in TabFolder.java however, this class uses the Control.java css architecture so implementing it is deeper than expected. Exploring a different fix to see if its just a GTK3->GTK4 internal change in TabFolder that caused the CSS background to be incorrect.
Comment 2 Joel Majano CLA 2021-12-08 12:59:51 EST
This background issue is most likely not related to tab folder directly, and more to do with how SWT/GTK deals with system themes. For example, in GTK3 changing the theme to dark mode leaves the background of the tabs as their previous non-dark mode colors. However, in GTK4, the backgrounds change to dark mode colors. This to me seems like a better result, as dark mode support in SWT is not the best in GTK3.
Comment 3 Joel Majano CLA 2021-12-08 13:02:14 EST
To add to this, using the Adwaita theme with "Dark Variant" turned on does result in the correct result in GTK3, but not if using the Adwaita-dark theme.
Comment 4 Joel Majano CLA 2021-12-09 10:18:45 EST
I was finally able to come up with a small reproducer for this bug. This bug occurs when a Composite is placed inside of a TabFolder, but not on Composites alone without first being set as a TabItem's control. Setting the background mode "background color" checkbox sets the background blue, then unchecking the box returns the background back to the correct color. This is because setBackgroundColor is called with "null" which sets it back to the default SWT background color.

My main idea: Composite is inheriting the background color of its parent as the GtkNotebook "stack" node has its background-color property set as white (255 for R,G,B). I'll be checking to see what can be done about this.
Comment 5 Eclipse Genie CLA 2021-12-09 10:56:36 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/188699
Comment 6 Joel Majano CLA 2021-12-13 11:24:16 EST
Created a patch to fix this in GTK4. More details in the commit message, but summary is that Composite was inheriting the background-color from the "stack" node of GtkNotebook. Setting the stack background-color upon creation solves the issue and allows for normal background changes.
Comment 8 Joel Majano CLA 2022-01-06 10:19:31 EST
Verified in 4.23 M1 I build (I20220106-0000).