355149 - Workbench window rendering very slow when restored from
minimized state if previously maximized
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index f785acb..e94de35 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -2140,6 +2140,7 @@
 	public static final int WM_VSCROLL = 0x115;
 	public static final int WM_WINDOWPOSCHANGED = 0x47;
 	public static final int WM_WINDOWPOSCHANGING = 0x46;
+	public static final int WPF_RESTORETOMAXIMIZED = 0x0002;
 	public static final int WS_BORDER = 0x800000;
 	public static final int WS_CAPTION = 0xc00000;
 	public static final int WS_CHILD = 0x40000000;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
old mode 100755
new mode 100644
index 6052f6b..ea39737
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
@@ -107,6 +107,7 @@
 	boolean moved, resized, opened;
 	int oldX = OS.CW_USEDEFAULT, oldY = OS.CW_USEDEFAULT;
 	int oldWidth = OS.CW_USEDEFAULT, oldHeight = OS.CW_USEDEFAULT;
+	RECT maxRect = new RECT();
 
 /**
  * Prevents uninitialized instances from being created outside the package.
@@ -485,6 +486,11 @@
 			WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
 			lpwndpl.length = WINDOWPLACEMENT.sizeof;
 			OS.GetWindowPlacement (handle, lpwndpl);
+			if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
+				int width = maxRect.right - maxRect.left;
+				int height = maxRect.bottom - maxRect.top;
+				return new Rectangle (maxRect.left, maxRect.top, width, height);
+			}
 			int width = lpwndpl.right - lpwndpl.left;
 			int height = lpwndpl.bottom - lpwndpl.top;
 			return new Rectangle (lpwndpl.left, lpwndpl.top, width, height);
@@ -515,6 +521,9 @@
 			WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
 			lpwndpl.length = WINDOWPLACEMENT.sizeof;
 			OS.GetWindowPlacement (handle, lpwndpl);
+			if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
+				return new Rectangle (0, 0, oldWidth, oldHeight);
+			}
 			int width = lpwndpl.right - lpwndpl.left;
 			int height = lpwndpl.bottom - lpwndpl.top;
 			/*
@@ -630,6 +639,9 @@
 			WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
 			lpwndpl.length = WINDOWPLACEMENT.sizeof;
 			OS.GetWindowPlacement (handle, lpwndpl);
+			if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
+				return new Point (maxRect.left, maxRect.top);
+			}
 			return new Point (lpwndpl.left, lpwndpl.top);
 		}
 	}
@@ -705,6 +717,11 @@
 			WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
 			lpwndpl.length = WINDOWPLACEMENT.sizeof;
 			OS.GetWindowPlacement (handle, lpwndpl);
+			if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
+				int width = maxRect.right - maxRect.left;
+				int height = maxRect.bottom - maxRect.top;
+				return new Point (width, height);
+			}
 			int width = lpwndpl.right - lpwndpl.left;
 			int height = lpwndpl.bottom - lpwndpl.top;
 			return new Point (width, height);
@@ -1757,8 +1774,9 @@
 	if (resized) {
 		int newWidth = 0, newHeight = 0;
 		switch ((int)/*64*/wParam) {
-			case OS.SIZE_RESTORED:
 			case OS.SIZE_MAXIMIZED:
+				OS.GetWindowRect (handle, maxRect);
+			case OS.SIZE_RESTORED:
 				newWidth = OS.LOWORD (lParam);
 				newHeight = OS.HIWORD (lParam);
 				break;