Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2020-11-26 17:47:11 +0000
committerLakshmi Shanmugam2020-11-27 10:25:28 +0000
commit0b7996a256df44f498e70c0af9da8095fd6b1d9b (patch)
tree1cb2e1864e05007e76cc89eabb4731a668b9566c
parent5188f7aa59c846de925886c08be53b187c0203dc (diff)
downloadeclipse.platform.swt-0b7996a256df44f498e70c0af9da8095fd6b1d9b.tar.gz
eclipse.platform.swt-0b7996a256df44f498e70c0af9da8095fd6b1d9b.tar.xz
eclipse.platform.swt-0b7996a256df44f498e70c0af9da8095fd6b1d9b.zip
Bug 569224 - [Big Sur] Different color for inactive selection background
in Eclipse dark theme Initialise the Table/Tree selection colors only when required so that it always returns the correct system color for the theme. Cache the colors and reset it in initColors(), thought initColors() is currently not called when theme changes dynamically. Change-Id: I3b020bece7c118d3106009c170d122616980558e Signed-off-by: Lakshmi Shanmugam <lshanmug@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java36
1 files changed, 16 insertions, 20 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
index af85db4c75..89dc03fa50 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
@@ -233,8 +233,7 @@ public class Display extends Device {
/* System Colors */
double [][] colors;
double [] alternateSelectedControlTextColor, selectedControlTextColor;
- double [] alternateSelectedControlColor, secondarySelectedControlColor;
- double [] selectedContentBackgroundColor, unemphasizedSelectedContentBackgroundColor;
+ private double [] alternateSelectedControlColor, secondarySelectedControlColor;
/* Key Mappings. */
static int [] [] KeyTable = {
@@ -2181,18 +2180,25 @@ public TaskBar getSystemTaskBar () {
}
/**
+ * Used for selection in Table and Tree when in focus.
* @return Returns the system color used for the face of a selected control in a Table or Tree when in focus
*/
double [] getAlternateSelectedControlColor() {
- return (OS.VERSION >= OS.VERSION(10, 14, 0)) ? selectedContentBackgroundColor : alternateSelectedControlColor;
+ if (alternateSelectedControlColor == null) {
+ alternateSelectedControlColor = getNSColorRGB(NSColor.alternateSelectedControlColor());
+ }
+ return alternateSelectedControlColor;
}
/**
* Used for selection in Table and Tree when not in focus.
- * @return Returns the color used for selected controls in non-key views.
+ * @return Returns the system color used for selected controls in non-key views.
*/
double [] getSecondarySelectedControlColor() {
- return (OS.VERSION >= OS.VERSION(10, 14, 0)) ? unemphasizedSelectedContentBackgroundColor : secondarySelectedControlColor;
+ if (secondarySelectedControlColor == null) {
+ secondarySelectedControlColor = getNSColorRGB(NSColor.secondarySelectedControlColor());
+ }
+ return secondarySelectedControlColor;
}
/**
@@ -3152,22 +3158,12 @@ void initColors () {
colors[SWT.COLOR_TEXT_DISABLED_BACKGROUND] = getWidgetColorRGB(SWT.COLOR_TEXT_DISABLED_BACKGROUND);
colors[SWT.COLOR_WIDGET_DISABLED_FOREGROUND] = getWidgetColorRGB(SWT.COLOR_WIDGET_DISABLED_FOREGROUND);
- /*
- * alternateSelectedControlColor and secondarySelectedControlColor are
- * deprecated in 10.14. Their respective replacements are
- * selectedContentBackgroundColor and unemphasizedSelectedContentBackgroundColor
- */
- if (OS.VERSION >= OS.VERSION(10, 14, 0)) {
- long result = OS.objc_msgSend(OS.class_NSColor, OS.sel_selectedContentBackgroundColor);
- selectedContentBackgroundColor = result != 0 ? getNSColorRGB(new NSColor(result)) : null;
-
- result = OS.objc_msgSend(OS.class_NSColor, OS.sel_unemphasizedSelectedContentBackgroundColor);
- unemphasizedSelectedContentBackgroundColor = result != 0 ? getNSColorRGB(new NSColor(result)) : null;
- }
- alternateSelectedControlColor = getNSColorRGB(NSColor.alternateSelectedControlColor());
alternateSelectedControlTextColor = getNSColorRGB(NSColor.alternateSelectedControlTextColor());
- secondarySelectedControlColor = getNSColorRGB(NSColor.secondarySelectedControlColor());
selectedControlTextColor = getNSColorRGB(NSColor.selectedControlTextColor());
+
+ /* These are set in the getter */
+ alternateSelectedControlColor = null;
+ secondarySelectedControlColor = null;
}
void initFonts () {
@@ -4353,7 +4349,7 @@ void setAppAppearance (APPEARANCE newMode) {
if (appearance != null && application != null) {
OS.objc_msgSend(application.id, OS.sel_setAppearance_, appearance.id);
appAppearance = newMode;
- }
+ }
}
void setWindowAppearance (NSWindow window, NSAppearance appearance) {

Back to the top