-
Notifications
You must be signed in to change notification settings - Fork 187
[Gtk] Ignore transparency when setting Combo popup color #2797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The fix should be quite safe so if it gets needed approvals it could be shipped in RC1 even. |
laeubi
left a comment
There was a problem hiding this 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
left a comment
There was a problem hiding this 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
|
FYI @jdneo this should also fix this issue in Copilot |
|
@vogella Thank you! :) |
ed9462d to
9a0a8a4
Compare
There was a problem hiding this 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
GdkRGBAobject 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
|
@akurtakov : is there some SWT snippet where one can check the fix? |
|
copilot says: Issues Found:
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. |
|
@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
9a0a8a4 to
a526b6e
Compare
|
@laeubi review comments fixed |
There was a problem hiding this 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.
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. |
|
@iloveeclipse if you revert eclipse-pde/eclipse.pde#2094 you should see eclipse-pde/eclipse.pde#2094 (comment) |
|
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. |
|
As there have been two +1 I'm merging this one and starting new I-build. |
|
Verified that E4 tools problem is gone with in https://download.eclipse.org/eclipse/downloads/drops4/I20251120-0400/ |

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