Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy2020-05-12 10:21:38 -0400
committerAlexandr Miloslavskiy2020-05-13 08:20:49 -0400
commita9dca4fe20f3cece4ee5a10483591d52bf4f727d (patch)
tree40408ab72e8e6d7afc3c389af7fabd41406f9f32
parent87983ef4bf5c63bd67a5591cd3032ad1a5b514e9 (diff)
downloadeclipse.platform.swt-a9dca4fe20f3cece4ee5a10483591d52bf4f727d.tar.gz
eclipse.platform.swt-a9dca4fe20f3cece4ee5a10483591d52bf4f727d.tar.xz
eclipse.platform.swt-a9dca4fe20f3cece4ee5a10483591d52bf4f727d.zip
Bug 562193 - [Win32] Enable Custom DarkTheme on Windows
1) Reduce the amount of copy&pasted code in Display.setData() in preparation for more keys in dark theme related patches 2) Prepare an emergency switch to disable all dark theme related tweaks. It's designed to be used in case of potential regressions. Change-Id: Idcc56ece0f10ca89803a60e3b0100ab1ca55afb8 Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java47
1 files changed, 23 insertions, 24 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
index c150d4976c..5cfa103356 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
@@ -164,6 +164,8 @@ public class Display extends Device {
static final char [] TAB = new char [] {'T', 'A', 'B', 0};
static final char [] TREEVIEW = new char [] {'T', 'R', 'E', 'E', 'V', 'I', 'E', 'W', 0};
static final String ENABLE_DARK_SCROLLBARS = "org.eclipse.swt.internal.win32.enableDarkScrollbars";
+ /* Emergency switch to be used in case of regressions. Not supposed to be changed when app is running. */
+ static final boolean disableCustomThemeTweaks = Boolean.valueOf(System.getProperty("org.eclipse.swt.internal.win32.disableCustomThemeTweaks")); //$NON-NLS-1$
/* Custom icons */
long hIconSearch;
@@ -4201,6 +4203,10 @@ public void setCursorLocation (Point point) {
setCursorLocation (point.x, point.y);
}
+boolean _toBoolean (Object value) {
+ return value != null && ((Boolean)value).booleanValue ();
+}
+
/**
* Sets the application defined property of the receiver
* with the specified name to the given argument.
@@ -4230,31 +4236,24 @@ public void setData (String key, Object value) {
checkDevice ();
if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (key.equals (RUN_MESSAGES_IN_IDLE_KEY)) {
- Boolean data = (Boolean) value;
- runMessagesInIdle = data != null && data.booleanValue ();
- return;
- }
- if (key.equals (RUN_MESSAGES_IN_MESSAGE_PROC_KEY)) {
- Boolean data = (Boolean) value;
- runMessagesInMessageProc = data != null && data.booleanValue ();
- return;
- }
- if (key.equals (USE_OWNDC_KEY)) {
- Boolean data = (Boolean) value;
- useOwnDC = data != null && data.booleanValue ();
- return;
- }
- if (key.equals (ACCEL_KEY_HIT)) {
- Boolean data = (Boolean) value;
- accelKeyHit = data != null && data.booleanValue ();
- return;
- }
- if (key.equals (EXTERNAL_EVENT_LOOP_KEY)) {
- Boolean data = (Boolean) value;
- externalEventLoop = data != null && data.booleanValue ();
- return;
+ switch (key) {
+ case RUN_MESSAGES_IN_IDLE_KEY:
+ runMessagesInIdle = _toBoolean (value);
+ return;
+ case RUN_MESSAGES_IN_MESSAGE_PROC_KEY:
+ runMessagesInMessageProc = _toBoolean (value);
+ return;
+ case USE_OWNDC_KEY:
+ useOwnDC = _toBoolean (value);
+ return;
+ case ACCEL_KEY_HIT:
+ accelKeyHit = _toBoolean (value);
+ return;
+ case EXTERNAL_EVENT_LOOP_KEY:
+ externalEventLoop = _toBoolean (value);
+ return;
}
+
/* Remove the key/value pair */
if (value == null) {
if (keys == null) return;

Back to the top