Blame SOURCES/eclipse-bug-444143.patch

10f0d1
From 716d35d30c1f639a04515188fedd89bb3aaf12bc Mon Sep 17 00:00:00 2001
10f0d1
From: Sami Wagiaalla
10f0d1
Date: Mon, 15 Sep 2014 11:51:44 -0400
10f0d1
Subject: Bug 444143 - [GTK3] Reset selected background color in Table
10f0d1
10f0d1
When setBackgroundColor is called for Table it results in
10f0d1
a call to gtk_widget_override_background_color with the flag
10f0d1
GTK_STATE_FLAG_NORMAL which overrides the color for selected
10f0d1
items' background despite the flag. Therefore the selected item
10f0d1
color must be reset to the default.
10f0d1
10f0d1
Change-Id: Iab3cad4e01cf87cca04e536fdea8991c818d0336
10f0d1
Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
10f0d1
10f0d1
diff --git a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
10f0d1
index 96493c6..2558fd1 100644
10f0d1
--- a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java	
10f0d1
+++ b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java	
10f0d1
@@ -11,12 +11,28 @@
10f0d1
 package org.eclipse.swt.widgets;
10f0d1
 
10f0d1
 
10f0d1
-import org.eclipse.swt.*;
10f0d1
-import org.eclipse.swt.internal.*;
10f0d1
-import org.eclipse.swt.internal.cairo.*;
10f0d1
-import org.eclipse.swt.internal.gtk.*;
10f0d1
-import org.eclipse.swt.graphics.*;
10f0d1
-import org.eclipse.swt.events.*;
10f0d1
+import org.eclipse.swt.SWT;
10f0d1
+import org.eclipse.swt.SWTException;
10f0d1
+import org.eclipse.swt.events.SelectionEvent;
10f0d1
+import org.eclipse.swt.events.SelectionListener;
10f0d1
+import org.eclipse.swt.graphics.Color;
10f0d1
+import org.eclipse.swt.graphics.Font;
10f0d1
+import org.eclipse.swt.graphics.GC;
10f0d1
+import org.eclipse.swt.graphics.Image;
10f0d1
+import org.eclipse.swt.graphics.Point;
10f0d1
+import org.eclipse.swt.graphics.Rectangle;
10f0d1
+import org.eclipse.swt.internal.Converter;
10f0d1
+import org.eclipse.swt.internal.ImageList;
10f0d1
+import org.eclipse.swt.internal.cairo.Cairo;
10f0d1
+import org.eclipse.swt.internal.gtk.GdkColor;
10f0d1
+import org.eclipse.swt.internal.gtk.GdkEventButton;
10f0d1
+import org.eclipse.swt.internal.gtk.GdkEventExpose;
10f0d1
+import org.eclipse.swt.internal.gtk.GdkRGBA;
10f0d1
+import org.eclipse.swt.internal.gtk.GdkRectangle;
10f0d1
+import org.eclipse.swt.internal.gtk.GtkAllocation;
10f0d1
+import org.eclipse.swt.internal.gtk.GtkCellRendererClass;
10f0d1
+import org.eclipse.swt.internal.gtk.GtkRequisition;
10f0d1
+import org.eclipse.swt.internal.gtk.OS;
10f0d1
 
10f0d1
 /** 
10f0d1
  * Instances of this class implement a selectable user interface
10f0d1
@@ -3006,6 +3022,17 @@ void setBackgroundColor (GdkColor color) {
10f0d1
 	super.setBackgroundColor (color);
10f0d1
 	if (!OS.GTK3) {
10f0d1
 		OS.gtk_widget_modify_base (handle, 0, color);
10f0d1
+	} else {
10f0d1
+		// Setting the background color overrides the selected background color
10f0d1
+		// so we have to reset it the default.
10f0d1
+		GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION;
10f0d1
+		GdkRGBA selectedBackground = new GdkRGBA ();
10f0d1
+		selectedBackground.alpha = 1;
10f0d1
+		selectedBackground.red = (defaultColor.red & 0xFFFF) / (float)0xFFFF;
10f0d1
+		selectedBackground.green = (defaultColor.green & 0xFFFF) / (float)0xFFFF;
10f0d1
+		selectedBackground.blue = (defaultColor.blue & 0xFFFF) / (float)0xFFFF;
10f0d1
+
10f0d1
+		OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground);
10f0d1
 	}
10f0d1
 }
10f0d1
 
10f0d1
diff --git a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
10f0d1
index 2a40869..4603cff 100644
10f0d1
--- a/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java	
10f0d1
+++ b/eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java	
10f0d1
@@ -3038,6 +3038,17 @@ void setBackgroundColor (GdkColor color) {
10f0d1
 	super.setBackgroundColor (color);
10f0d1
 	if (!OS.GTK3) {
10f0d1
 		OS.gtk_widget_modify_base (handle, 0, color);
10f0d1
+	} else {
10f0d1
+		// Setting the background color overrides the selected background color
10f0d1
+		// so we have to reset it the default.
10f0d1
+		GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION;
10f0d1
+		GdkRGBA selectedBackground = new GdkRGBA ();
10f0d1
+		selectedBackground.alpha = 1;
10f0d1
+		selectedBackground.red = (defaultColor.red & 0xFFFF) / (float)0xFFFF;
10f0d1
+		selectedBackground.green = (defaultColor.green & 0xFFFF) / (float)0xFFFF;
10f0d1
+		selectedBackground.blue = (defaultColor.blue & 0xFFFF) / (float)0xFFFF;
10f0d1
+
10f0d1
+		OS.gtk_widget_override_background_color (handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground);
10f0d1
 	}
10f0d1
 }
10f0d1
 
10f0d1
-- 
10f0d1
cgit v0.10.1-9-gd18e
10f0d1