diff options
author | Lakshmi Shanmugam | 2011-05-25 16:35:52 +0000 |
---|---|---|
committer | Lakshmi Shanmugam | 2011-05-25 16:35:52 +0000 |
commit | 2de60672de576595016222a3314e7b8150bf6f5c (patch) | |
tree | 45d06883d76760a189c0556ee3ea73297a61bdc0 | |
parent | a03ce65c04134acf61613cf80f950031b142c81e (diff) | |
download | eclipse.platform.swt-PatchFor_3_4_maintenance.tar.gz eclipse.platform.swt-PatchFor_3_4_maintenance.tar.xz eclipse.platform.swt-PatchFor_3_4_maintenance.zip |
Bug 316238-Main menu lost when using "open in new window"PatchFor_3_4_maintenance
3 files changed, 22 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java index 77e5faf9fd..e59acb4288 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java @@ -367,6 +367,7 @@ public class OS extends C { public static final int kDragTrackingLeaveWindow = 4; public static final int kDragTrackingLeaveHandler = 5; public static final int kEventAppleEvent = 1; + public static final int kEventAppDeactivated = 2; public static final int kEventAppAvailableWindowBoundsChanged = 110; public static final int kEventAttributeUserEvent = 1 << 0; public static final int kEventClassAppleEvent = ('e'<<24) + ('p'<<16) + ('p'<<8) + 'c'; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java index e67cfd0c6c..73e66b62b7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java @@ -375,6 +375,14 @@ int appleEventProc (int nextHandler, int theEvent, int userData) { switch (eventClass) { case OS.kEventClassApplication: switch (eventKind) { + case OS.kEventAppDeactivated: { + Shell [] shells = getShells (); + for (int i = 0; i < shells.length; i++) { + Shell shell = shells [i]; + if (shell.active && !shell.isDisposed ()) shell.kEventWindowDeactivated (); + } + break; + } case OS.kEventAppAvailableWindowBoundsChanged: { /* Reset the dock image in case the dock has been restarted */ if (dockImage != 0) { @@ -2182,6 +2190,7 @@ void initializeCallbacks () { }; OS.InstallEventHandler (appTarget, mouseProc, mask2.length / 2, mask2, 0, null); int [] mask3 = new int[] { + OS.kEventClassApplication, OS.kEventAppDeactivated, OS.kEventClassApplication, OS.kEventAppAvailableWindowBoundsChanged, OS.kEventClassAppleEvent, OS.kEventAppleEvent, }; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java index f1f5d7fbdc..b404a62cc9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java @@ -993,6 +993,11 @@ int kEventWindowActivated (int nextHandler, int theEvent, int userData) { OS.GetWindowActivationScope (shellHandle, outScope); if (outScope [0] == OS.kWindowActivationScopeNone) return result; if (!active) { + Shell[] shells = display.getShells (); + for (int i = 0; i < shells.length; i++) { + Shell shell = shells [i]; + if (shell.active && !shell.isDisposed ()) shell.kEventWindowDeactivated (); + } active = true; deferDispose = true; Display display = this.display; @@ -1074,15 +1079,20 @@ int kEventWindowCollapsing (int nextHandler, int theEvent, int userData) { int kEventWindowDeactivated (int nextHandler, int theEvent, int userData) { int result = super.kEventWindowDeactivated (nextHandler, theEvent, userData); if (result == OS.noErr) return result; + kEventWindowDeactivated (); + return result; +} + +void kEventWindowDeactivated () { if (active) { active = false; deferDispose = true; Display display = this.display; display.activeShell = this; sendEvent (SWT.Deactivate); - if (isDisposed ()) return result; + if (isDisposed ()) return; setActiveControl (null); - if (isDisposed ()) return result; + if (isDisposed ()) return; display.activeShell = null; saveFocus (); if (savedFocus != null) { @@ -1100,7 +1110,6 @@ int kEventWindowDeactivated (int nextHandler, int theEvent, int userData) { display.setMenuBar (null); deferDispose = false; } - return result; } int kEventWindowDrawContent (int nextHandler, int theEvent, int userData) { |