diff options
author | Scott Kovatch <skovatch> | 2009-09-28 23:00:02 +0000 |
---|---|---|
committer | Scott Kovatch <skovatch> | 2009-09-28 23:00:02 +0000 |
commit | a4b9a6829a0560da22fad24a26489669262a4881 (patch) | |
tree | 1c0f605527b6890c397936957cd824632315b57a | |
parent | d9aa53af16d8aa1951b6c08902d541c33197b74b (diff) | |
download | eclipse.platform.swt-a4b9a6829a0560da22fad24a26489669262a4881.tar.gz eclipse.platform.swt-a4b9a6829a0560da22fad24a26489669262a4881.tar.xz eclipse.platform.swt-a4b9a6829a0560da22fad24a26489669262a4881.zip |
290635 - updateParent() not checking for embedded case. Also, remove topView() from parent when disposing of embedded shell.
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java | 2 | ||||
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java | 46 |
2 files changed, 30 insertions, 18 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 ebad5a2d05..1f271b9546 100755 --- 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 @@ -4127,6 +4127,8 @@ void updateDefaultButton () { } void updateQuitMenu () { + // If we did not create the menu bar, don't modify it. + if (isEmbedded) return; boolean enabled = true; Shell [] shells = getShells (); int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL; 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 f63e27f74e..8a9db6d71e 100755 --- 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 @@ -620,7 +620,7 @@ void createHandle () { // add it to the foreign view. NSView parentView = view; super.createHandle(); - parentView.addSubview(view); + parentView.addSubview(topView()); } style |= SWT.NO_BACKGROUND; @@ -651,6 +651,8 @@ void deregister () { void destroyWidget () { NSWindow window = this.window; Display display = this.display; + NSView view = topView(); + boolean sheet = (style & (SWT.SHEET)) != 0; releaseHandle (); if (window != null) { @@ -659,10 +661,16 @@ void destroyWidget () { application.endSheet(window, 0); } window.close(); + } else if (view != null) { + view.removeFromSuperview(); } - //If another shell is not going to become active, clear the menu bar. - if (!display.isDisposed () && display.getShells ().length == 0) { - display.setMenuBar (null); + + // If another shell is not going to become active, clear the menu bar. + // Don't modify the menu bar if we are an embedded Shell, though. + if (window != null) { + if (!display.isDisposed () && display.getShells ().length == 0) { + display.setMenuBar (null); + } } } @@ -1764,22 +1772,24 @@ void updateModal () { } void updateParent (boolean visible) { - if (visible) { - if (parent != null && parent.getVisible ()) { - ((Shell)parent).window.addChildWindow (window, OS.NSWindowAbove); - - /** - * Feature in Cocoa: When a window is added as a child window, - * its window level resets to its parent's window level. So, we - * have to set the level for ON_TOP child window again. - */ - if ((style & SWT.ON_TOP) != 0) { - window.setLevel(OS.NSStatusWindowLevel); + if (window != null) { + if (visible) { + if (parent != null && parent.getVisible ()) { + ((Shell)parent).window.addChildWindow (window, OS.NSWindowAbove); + + /** + * Feature in Cocoa: When a window is added as a child window, + * its window level resets to its parent's window level. So, we + * have to set the level for ON_TOP child window again. + */ + if ((style & SWT.ON_TOP) != 0) { + window.setLevel(OS.NSStatusWindowLevel); + } } + } else { + NSWindow parentWindow = window.parentWindow (); + if (parentWindow != null) parentWindow.removeChildWindow (window); } - } else { - NSWindow parentWindow = window.parentWindow (); - if (parentWindow != null) parentWindow.removeChildWindow (window); } Shell [] shells = getShells (); for (int i = 0; i < shells.length; i++) { |