diff options
author | Scott Kovatch <skovatch> | 2010-11-01 15:51:13 +0000 |
---|---|---|
committer | Scott Kovatch <skovatch> | 2010-11-01 15:51:13 +0000 |
commit | f2838c7c5a06537eec4689ec5c97910861297c54 (patch) | |
tree | 060c1daa86191fa1382b41a97d81ddcab6fbf2b9 | |
parent | ff9455a446c1c0d9507f87b8ba0cd725e34bab5b (diff) | |
download | eclipse.platform.swt-f2838c7c5a06537eec4689ec5c97910861297c54.tar.gz eclipse.platform.swt-f2838c7c5a06537eec4689ec5c97910861297c54.tar.xz eclipse.platform.swt-f2838c7c5a06537eec4689ec5c97910861297c54.zip |
328945 - put back the original NSWindow subclass when there are no more embedded shells.
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java | 22 |
1 files changed, 19 insertions, 3 deletions
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 d4f6ecd949..612657455f 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 @@ -117,6 +117,7 @@ import org.eclipse.swt.internal.cocoa.*; public class Shell extends Decorations { NSWindow window; SWTWindowDelegate windowDelegate; + int /*long*/ currWindowClass; int /*long*/ tooltipOwner, tooltipTag, tooltipUserData; boolean opened, moved, resized, fullScreen, center, deferFlushing; Control lastActive; @@ -671,13 +672,18 @@ void createHandle () { if (window == null) { NSWindow hostWindow = view.window(); - int /*long*/ windowClass = OS.object_getClass(hostWindow.id); - int /*long*/ sendEventImpl = OS.class_getMethodImplementation(windowClass, OS.sel_sendEvent_); + currWindowClass = OS.object_getClass(hostWindow.id); + int /*long*/ sendEventImpl = OS.class_getMethodImplementation(currWindowClass, OS.sel_sendEvent_); if (sendEventImpl != Display.windowCallback3.getAddress()) { - int /*long*/ embeddedSubclass = display.createWindowSubclass(windowClass, "SWTAWTWindow"); + int /*long*/ embeddedSubclass = display.createWindowSubclass(currWindowClass, "SWTAWTWindow"); OS.object_setClass(hostWindow.id, embeddedSubclass); } + int /*long*/ [] embedCount = new int /*long*/ [1]; + OS.object_getInstanceVariable(hostWindow.id, Display.SWT_EMBED_FRAMES, embedCount); + embedCount[0]++; + OS.object_setInstanceVariable(hostWindow.id, Display.SWT_EMBED_FRAMES, embedCount[0]); + // Register for notifications. An embedded shell has no control over the host window, // so it isn't correct to install a delegate. NSNotificationCenter defaultCenter = NSNotificationCenter.defaultCenter(); @@ -1340,6 +1346,16 @@ void releaseHandle () { NSNotificationCenter.defaultCenter().removeObserver(windowDelegate); if (windowDelegate != null) windowDelegate.release(); windowDelegate = null; + + if (window == null && currWindowClass != 0) { + int /*long*/ [] embedCount = new int /*long*/ [1]; + OS.object_getInstanceVariable(view.window().id, Display.SWT_EMBED_FRAMES, embedCount); + embedCount[0]--; + OS.object_setInstanceVariable(view.window().id, Display.SWT_EMBED_FRAMES, embedCount[0]); + + if (embedCount[0] <= 0) OS.object_setClass(view.window().id, currWindowClass); + } + super.releaseHandle (); window = null; } |