Skip to content

Commit f58b4e3

Browse files
authored
Splash Screen getting Flipped in MacOs Sonoma. (#1355)
Fixes: eclipse-platform/eclipse.platform.swt#772 Due to a bug in MacOS Sonoma(eclipse-platform/eclipse.platform.swt#772) ,Splash Screen gets flipped.As a workaround the image is flipped and returned.
1 parent 3d5ae3d commit f58b4e3

File tree

1 file changed

+26
-1
lines changed
  • bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal

1 file changed

+26
-1
lines changed

bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
import org.eclipse.jface.util.IPropertyChangeListener;
136136
import org.eclipse.jface.util.OpenStrategy;
137137
import org.eclipse.jface.util.SafeRunnable;
138+
import org.eclipse.jface.util.Util;
138139
import org.eclipse.jface.viewers.ISelection;
139140
import org.eclipse.jface.window.IShellProvider;
140141
import org.eclipse.jface.window.Window;
@@ -145,9 +146,11 @@
145146
import org.eclipse.swt.custom.BusyIndicator;
146147
import org.eclipse.swt.graphics.DeviceData;
147148
import org.eclipse.swt.graphics.FontData;
149+
import org.eclipse.swt.graphics.GC;
148150
import org.eclipse.swt.graphics.Image;
149151
import org.eclipse.swt.graphics.Point;
150152
import org.eclipse.swt.graphics.Rectangle;
153+
import org.eclipse.swt.graphics.Transform;
151154
import org.eclipse.swt.widgets.Display;
152155
import org.eclipse.swt.widgets.Listener;
153156
import org.eclipse.swt.widgets.Monitor;
@@ -850,14 +853,36 @@ private static Image loadSplashScreenImage(Display display, String splashLoc) {
850853
Image background = null;
851854
if (splashLoc != null) {
852855
try (InputStream input = new BufferedInputStream(new FileInputStream(splashLoc))) {
853-
background = new Image(display, input);
856+
background = getImage(display, input);
854857
} catch (SWTException | IOException e) {
855858
StatusManager.getManager().handle(StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, e));
856859
}
857860
}
858861
return background;
859862
}
860863

864+
private static Image getImage(Display display, InputStream input) {
865+
Image image = new Image(display, input);
866+
867+
if (Util.isMac()) {
868+
/*
869+
* Due to a bug in MacOS Sonoma
870+
* (https://github.com/eclipse-platform/eclipse.platform.swt/issues/772) ,Splash
871+
* Screen gets flipped.As a workaround the image is flipped and returned.
872+
*/
873+
if (System.getProperty("os.version").startsWith("14")) { //$NON-NLS-1$ //$NON-NLS-2$
874+
GC gc = new GC(image);
875+
Transform tr = new Transform(display);
876+
tr.setElements(1, 0, 0, -1, 0, 0);
877+
gc.setTransform(tr);
878+
gc.drawImage(image, 0, -(image.getBounds().height));
879+
tr.dispose();
880+
gc.dispose();
881+
}
882+
}
883+
return image;
884+
}
885+
861886
/**
862887
* Return the splash handler for this application. If none is specifically
863888
* provided the default Eclipse implementation is returned.

0 commit comments

Comments
 (0)