Skip to content

Conversation

@akurtakov
Copy link
Member

Ensures no transparency is set for Combo's popup (which generally makes UI harder to read).

Fixes #2794

@akurtakov
Copy link
Member Author

The fix should be quite safe so if it gets needed approvals it could be shipped in RC1 even.

Copy link
Contributor

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most annoying SWT behavior in GTK currently!

@vogella vogella self-requested a review November 20, 2025 07:56
Copy link
Contributor

@vogella vogella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks save and the current behavior is super annoying

@vogella
Copy link
Contributor

vogella commented Nov 20, 2025

FYI @jdneo this should also fix this issue in Copilot

@jdneo
Copy link

jdneo commented Nov 20, 2025

@vogella Thank you! :)

Copilot finished reviewing on behalf of laeubi November 20, 2025 08:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes transparency issues in the GTK Combo widget's popup menu by ensuring the alpha channel is always set to 1.0 (fully opaque) when applying background colors, improving readability of the popup menu.

  • Creates a separate GdkRGBA object for the menu background with alpha forced to 1.0
  • Updates the CSS generation to use the non-transparent color for the menu element while preserving any transparency in the Combo's main background

@iloveeclipse
Copy link
Member

@akurtakov : is there some SWT snippet where one can check the fix?

@laeubi
Copy link
Contributor

laeubi commented Nov 20, 2025

copilot says:

Issues Found:

  • Line 2708 - Spacing: Missing space after the assignment operator in final String menuColorString =display.... Should be = display (with space) to match the formatting on line 2697 and maintain consistent code style throughout the file.

  • Line 2704 - Comment clarity: The comment states "alpha > 0.85%" which is ambiguous. Alpha values in GdkRGBA range from 0.0 to 1.0 (or 0% to 100% when expressed as percentages). The notation "0.85%" would represent 0.0085 as a decimal value, which doesn't align with the intent. This should be either "85%" or "0.85" (without the percent symbol) to accurately represent high transparency values.

Note on Test Coverage: While there are existing tests for setBackground with alpha values in Test_org_eclipse_swt_widgets_Combo.java (e.g., test_setBackgroundAlphaDropDownCombo), these tests verify that the background color getter returns the correct value but don't specifically test the CSS rendering of the popup menu. The new behavior that forces alpha=1.0 for the menu could benefit from a test, though this would likely require inspecting the generated CSS or visual validation which may be challenging to automate.

@akurtakov
Copy link
Member Author

@iloveeclipse I tested with:

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class TransparentComboExample {

    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new FillLayout(SWT.VERTICAL));

        Composite parent = new Composite(shell, SWT.NONE);
        parent.setLayout(new RowLayout(SWT.VERTICAL));


        Combo combo = new Combo(parent, SWT.READ_ONLY);
        for (int i = 1; i <= 5; i++) {
            combo.add("Item " + i);
        }
        combo.select(0);
        combo.setBackground(new Color(240, 240, 240, 0));

        Label l = new Label(parent, SWT.NONE);
        l.setText("Some test long ");
        l = new Label(parent, SWT.NONE);
        l.setText("Some test long ");
        l = new Label(parent, SWT.NONE);
        l.setText("Some test long ");

        shell.pack();
        shell.setSize(500, 500);
        shell.open();

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    }
}

but real testing comes with platform css styling as it really plays with colors.

Ensures no transparency is set for Combo's popup (which generally makes
UI harder to read).

Fixes eclipse-platform#2794
@akurtakov
Copy link
Member Author

@laeubi review comments fixed

@laeubi laeubi requested a review from Copilot November 20, 2025 08:18
Copilot finished reviewing on behalf of laeubi November 20, 2025 08:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@github-actions
Copy link
Contributor

Test Results

  118 files  ±0    118 suites  ±0   13m 55s ⏱️ - 1m 23s
4 653 tests ±0  4 636 ✅ ±0  17 💤 ±0  0 ❌ ±0 
  338 runs  ±0    334 ✅ ±0   4 💤 ±0  0 ❌ ±0 

Results for commit a526b6e. ± Comparison against base commit 77b61df.

@iloveeclipse
Copy link
Member

iloveeclipse commented Nov 20, 2025

but real testing comes with platform css styling as it really plays with colors.

OK, I don't see any differences (and no transparency problems) with/without patch if starting your snippet. I'm on RHEL 9.4 / X11 / gtk3-3.24.31-5.el9.x86_64.
Any hint where I can see this in the SDK?

@akurtakov
Copy link
Member Author

akurtakov commented Nov 20, 2025

@iloveeclipse if you revert eclipse-pde/eclipse.pde#2094 you should see eclipse-pde/eclipse.pde#2094 (comment)
Or in
image

@akurtakov
Copy link
Member Author

FWIW, on Fedora 43 there is no pure X11 session anymore(thus can't test) but the problem is visible with XWayland.

@iloveeclipse
Copy link
Member

FWIW, on Fedora 43 there is no pure X11 session anymore(thus can't test) but the problem is visible with XWayland.

That explains I can't reproduce it (I've tried with your PDE example & reverted workaround). So it seem Wayland issue only.

@akurtakov
Copy link
Member Author

As there have been two +1 I'm merging this one and starting new I-build.

@akurtakov akurtakov merged commit 28bb9b4 into eclipse-platform:master Nov 20, 2025
22 of 23 checks passed
@github-project-automation github-project-automation bot moved this to Done in SWT work Nov 20, 2025
@akurtakov
Copy link
Member Author

Verified that E4 tools problem is gone with in https://download.eclipse.org/eclipse/downloads/drops4/I20251120-0400/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[GTK] Transparent combo popups

5 participants