Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-09-04 10:30:39 +0000
committerEric Williams2019-09-10 20:03:13 +0000
commit14e553c72ce3e4f2809bf4ccf2761555482e20dc (patch)
treecafa4047394b793b29a921311b1e7406d904059c
parentc9fd17a7601913fa8378ef9d3885484c16b74b85 (diff)
downloadeclipse.platform.swt-14e553c72ce3e4f2809bf4ccf2761555482e20dc.tar.gz
eclipse.platform.swt-14e553c72ce3e4f2809bf4ccf2761555482e20dc.tar.xz
eclipse.platform.swt-14e553c72ce3e4f2809bf4ccf2761555482e20dc.zip
Bug 550734 - Improve colorPattern in Display
Change-Id: I0b420bf2e6b86c3627c52ca67bdad62978030501 Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index f6b9eb0662..22e007af83 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -336,7 +336,7 @@ public class Display extends Device {
/** True if the current theme is dark. This includes the theme set in GTK_THEME. */
static boolean themeDark;
- private final static Pattern colorPattern = Pattern.compile("[^-]color: rgba?\\((\\d+(,\\s?)?){3,4}\\)");
+ private final static Pattern colorPattern = Pattern.compile("[^-]color: (rgba?\\((?:\\d+(?:,\\s?)?){3,4}\\))");
/* Popup Menus */
Menu [] popups;
@@ -2118,8 +2118,6 @@ String gtk_css_provider_to_string (long provider) {
*/
GdkRGBA gtk_css_parse_foreground (String css, String precise) {
if (css.isEmpty()) return COLOR_WIDGET_FOREGROUND_RGBA;
- String shortOutput;
- int startIndex;
GdkRGBA rgba = new GdkRGBA ();
String searched = "";
/*
@@ -2148,12 +2146,9 @@ GdkRGBA gtk_css_parse_foreground (String css, String precise) {
* properties and filter out things like background-color, border-color,
* etc.
*/
-
Matcher m = colorPattern.matcher(searched);
if (m.find()) {
- String match = m.group(0);
- startIndex = match.indexOf("color:");
- shortOutput = match.substring(startIndex + 7);
+ String shortOutput = m.group(1);
rgba = gtk_css_property_to_rgba(shortOutput);
} else {
return COLOR_WIDGET_FOREGROUND_RGBA;

Back to the top