Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover2006-12-06 14:03:54 -0500
committerSteve Northover2006-12-06 14:03:54 -0500
commitc72fdbd7fafc18281b7b514fcf1db452a8bdfc80 (patch)
tree128b85a65e1a659baa4544a506b873337d90360d
parent077fe3776dc25b4cf61ed243848fcd241c8ef494 (diff)
downloadeclipse.platform.swt-c72fdbd7fafc18281b7b514fcf1db452a8bdfc80.tar.gz
eclipse.platform.swt-c72fdbd7fafc18281b7b514fcf1db452a8bdfc80.tar.xz
eclipse.platform.swt-c72fdbd7fafc18281b7b514fcf1db452a8bdfc80.zip
166942 - Application does not start maximized if setMaximized called before Shell.open()
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java90
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java2
2 files changed, 51 insertions, 41 deletions
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
index 0b23ff7ce3..53a5dbd415 100755
--- 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
@@ -153,6 +153,50 @@ public Decorations (Composite parent, int style) {
super (parent, checkStyle (style));
}
+void _setMaximized (boolean maximized) {
+ swFlags = maximized ? OS.SW_SHOWMAXIMIZED : OS.SW_RESTORE;
+ if (OS.IsWinCE) {
+ /*
+ * Note: WinCE does not support SW_SHOWMAXIMIZED and SW_RESTORE. The
+ * workaround is to resize the window to fit the parent client area.
+ */
+ if (maximized) {
+ RECT rect = new RECT ();
+ OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
+ int width = rect.right - rect.left, height = rect.bottom - rect.top;
+ if (OS.IsPPC) {
+ /* Leave space for the menu bar */
+ if (menuBar != null) {
+ int hwndCB = menuBar.hwndCB;
+ RECT rectCB = new RECT ();
+ OS.GetWindowRect (hwndCB, rectCB);
+ height -= rectCB.bottom - rectCB.top;
+ }
+ }
+ int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
+ SetWindowPos (handle, 0, rect.left, rect.top, width, height, flags);
+ }
+ } else {
+ if (!OS.IsWindowVisible (handle)) return;
+ if (maximized == OS.IsZoomed (handle)) return;
+ OS.ShowWindow (handle, swFlags);
+ OS.UpdateWindow (handle);
+ }
+}
+
+void _setMinimized (boolean minimized) {
+ if (OS.IsWinCE) return;
+ swFlags = minimized ? OS.SW_SHOWMINNOACTIVE : OS.SW_RESTORE;
+ if (!OS.IsWindowVisible (handle)) return;
+ if (minimized == OS.IsIconic (handle)) return;
+ int flags = swFlags;
+ if (flags == OS.SW_SHOWMINNOACTIVE && handle == OS.GetActiveWindow ()) {
+ flags = OS.SW_MINIMIZE;
+ }
+ OS.ShowWindow (handle, flags);
+ OS.UpdateWindow (handle);
+}
+
void addMenu (Menu menu) {
if (menus == null) menus = new Menu [4];
for (int i=0; i<menus.length; i++) {
@@ -801,7 +845,7 @@ void setBounds (int x, int y, int width, int height, int flags, boolean defer) {
if (OS.IsZoomed (handle)) {
if (sameOrigin && sameExtent) return;
setPlacement (x, y, width, height, flags);
- setMaximized (false);
+ _setMaximized (false);
return;
}
}
@@ -1025,34 +1069,8 @@ public void setImages (Image [] images) {
*/
public void setMaximized (boolean maximized) {
checkWidget ();
- swFlags = maximized ? OS.SW_SHOWMAXIMIZED : OS.SW_RESTORE;
- if (OS.IsWinCE) {
- /*
- * Note: WinCE does not support SW_SHOWMAXIMIZED and SW_RESTORE. The
- * workaround is to resize the window to fit the parent client area.
- */
- if (maximized) {
- RECT rect = new RECT ();
- OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
- int width = rect.right - rect.left, height = rect.bottom - rect.top;
- if (OS.IsPPC) {
- /* Leave space for the menu bar */
- if (menuBar != null) {
- int hwndCB = menuBar.hwndCB;
- RECT rectCB = new RECT ();
- OS.GetWindowRect (hwndCB, rectCB);
- height -= rectCB.bottom - rectCB.top;
- }
- }
- int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
- SetWindowPos (handle, 0, rect.left, rect.top, width, height, flags);
- }
- } else {
- if (!OS.IsWindowVisible (handle)) return;
- if (maximized == OS.IsZoomed (handle)) return;
- OS.ShowWindow (handle, swFlags);
- OS.UpdateWindow (handle);
- }
+ Display.lpStartupInfo = null;
+ _setMaximized (maximized);
}
/**
@@ -1103,7 +1121,7 @@ public void setMenuBar (Menu menu) {
if (menuBar != null) OS.ShowWindow (menuBar.hwndCB, OS.SW_HIDE);
menuBar = menu;
if (menuBar != null) OS.ShowWindow (menuBar.hwndCB, OS.SW_SHOW);
- if (resize) setMaximized (true);
+ if (resize) _setMaximized (true);
}
if (OS.IsSP) {
if (menuBar != null) OS.ShowWindow (menuBar.hwndCB, OS.SW_HIDE);
@@ -1145,16 +1163,8 @@ public void setMenuBar (Menu menu) {
*/
public void setMinimized (boolean minimized) {
checkWidget ();
- if (OS.IsWinCE) return;
- swFlags = minimized ? OS.SW_SHOWMINNOACTIVE : OS.SW_RESTORE;
- if (!OS.IsWindowVisible (handle)) return;
- if (minimized == OS.IsIconic (handle)) return;
- int flags = swFlags;
- if (flags == OS.SW_SHOWMINNOACTIVE && handle == OS.GetActiveWindow ()) {
- flags = OS.SW_MINIMIZE;
- }
- OS.ShowWindow (handle, flags);
- OS.UpdateWindow (handle);
+ Display.lpStartupInfo = null;
+ _setMinimized (minimized);
}
void setParent () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
index 0a9f842d90..cde347c560 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java
@@ -551,7 +551,7 @@ void createHandle () {
OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
int flags = OS.SWP_DRAWFRAME | OS.SWP_NOMOVE | OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE;
SetWindowPos (handle, 0, 0, 0, 0, 0, flags);
- if (OS.IsWinCE) setMaximized (true);
+ if (OS.IsWinCE) _setMaximized (true);
if (OS.IsPPC) {
psai = new SHACTIVATEINFO ();
psai.cbSize = SHACTIVATEINFO.sizeof;

Back to the top