Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Priya Shanmugam2019-02-12 09:20:32 +0000
committerLakshmi Priya Shanmugam2019-02-12 09:20:32 +0000
commitc917f4d391ffef1efe4bcb5f8a75f8e6c7cf1451 (patch)
tree484b076c35aa0cbea46963d9ee516300d7e6643c
parentf2e225410a69d92c0818570752f2480bc6e6c5cb (diff)
downloadeclipse.platform.swt-c917f4d391ffef1efe4bcb5f8a75f8e6c7cf1451.tar.gz
eclipse.platform.swt-c917f4d391ffef1efe4bcb5f8a75f8e6c7cf1451.tar.xz
eclipse.platform.swt-c917f4d391ffef1efe4bcb5f8a75f8e6c7cf1451.zip
Bug 544365 - [Mac] Native dialogs should use dark appearance in Eclipse
Set the dark/light appearance to the NSApplication directly so that we don't have to set the appearance to each NSPanel for the SWT dialogs such as FileDialog, Color/Font Dialogs, etc. Change-Id: I7cb65292b226971a68c41d9f649b978b4b8ed6fc
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java4
2 files changed, 11 insertions, 5 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 43425e09de..9e3399c907 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
@@ -4270,6 +4270,16 @@ NSAppearance getAppearance (APPEARANCE newMode) {
return NSAppearance.appearanceNamed (NSString.stringWith (appearanceName));
}
+void setAppAppearance (APPEARANCE newMode) {
+ if (OS.VERSION_MMB < OS.VERSION_MMB (10, 14, 0)) return;
+
+ NSAppearance appearance = getAppearance(newMode);
+ if (appearance != null && application != null) {
+ OS.objc_msgSend(application.id, OS.sel_setAppearance_, appearance.id);
+ appAppearance = newMode;
+ }
+}
+
void setWindowAppearance (NSWindow window, NSAppearance appearance) {
if (window != null && appearance != null) {
OS.objc_msgSend(window.id, OS.sel_setAppearance_, appearance.id);
@@ -5534,7 +5544,7 @@ static long /*int*/ applicationProc(long /*int*/ id, long /*int*/ sel, long /*in
NSApplication application = display.application;
if (sel == OS.sel_appAppearanceChanged) {
- display.setWindowsAppearance(arg0 == 1 ? APPEARANCE.Dark : APPEARANCE.Light);
+ display.setAppAppearance(arg0 == 1 ? APPEARANCE.Dark : APPEARANCE.Light);
return 0;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
index 183fd78c0d..5afb2706ec 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
@@ -760,10 +760,6 @@ void createHandle () {
style |= SWT.NO_BACKGROUND;
}
- if (display.appAppearance != null) {
- display.setWindowAppearance(window, display.getAppearance(display.appAppearance));
- }
-
windowDelegate = (SWTWindowDelegate)new SWTWindowDelegate().alloc().init();
if (window == null) {

Back to the top