From a526b6e5ee6c0567dd25cecc5cd860c7511030d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Thu, 20 Nov 2025 09:06:58 +0200 Subject: [PATCH] [Gtk] Ignore transparency when setting Combo popup color Ensures no transparency is set for Combo's popup (which generally makes UI harder to read). Fixes https://github.com/eclipse-platform/eclipse.platform.swt/issues/2794 --- .../gtk/org/eclipse/swt/widgets/Combo.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java index e810d42ed7b..7dffe52dbd7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java @@ -2695,6 +2695,17 @@ void updateCss() { // Deal with background if (background != null) { final String colorString = display.gtk_rgba_to_css_string(background); + GdkRGBA menuBackground = new GdkRGBA(); + menuBackground.red = background.red; + menuBackground.green = background.green; + menuBackground.blue = background.blue; + menuBackground.alpha = 1.0; + /* Ensures that the popup menu is not transparent and as a result unreadable + * This way effects like "light" transparency (alpha > 0.85) can not be achieved. + * Having any transparency of the popup is generally unwanted as it hurts visibility so + * if such a feature is usable to anyone it would need new dedicated API. + */ + final String menuColorString = display.gtk_rgba_to_css_string(menuBackground); /* * Use 'background:' instead of 'background-color:' to also override @@ -2702,7 +2713,7 @@ void updateCss() { * 'background-image:' for 'GtkToggleButton' used in READ_ONLY combo. */ css.append("* {background: " + colorString + ";}\n"); - css.append("menu {background: " + colorString + ";}\n"); + css.append("menu {background: " + menuColorString + ";}\n"); /* * Setting background color for '*' also affects selection background,