summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2010-08-06 18:51:54 +0000
committerSilenio Quarti <silenio>2010-08-06 18:51:54 +0000
commit3b6578434c49d9e9dcb47ee05302394f9c9ca7de (patch)
tree0386f66db878e97fb24f608a566df9e51850268f
parente956d28ff98c29a9acf3a2fde3ef728ddeea9135 (diff)
downloadeclipse.platform.swt-3b6578434c49d9e9dcb47ee05302394f9c9ca7de.tar.gz
eclipse.platform.swt-3b6578434c49d9e9dcb47ee05302394f9c9ca7de.tar.xz
eclipse.platform.swt-3b6578434c49d9e9dcb47ee05302394f9c9ca7de.zip
Bug 316238 - [Widgets] Main menu lost when using "open in new window" (back port to 3.6.x)
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java15
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 84c7722390..26624cbd8a 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
@@ -373,6 +373,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 552e27fc96..6a92ef599d 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
@@ -401,6 +401,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) {
@@ -2297,6 +2305,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 14f4e98399..643d0225c2 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
@@ -1069,6 +1069,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;
@@ -1154,15 +1159,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) {
@@ -1180,7 +1190,6 @@ int kEventWindowDeactivated (int nextHandler, int theEvent, int userData) {
display.setMenuBar (null);
deferDispose = false;
}
- return result;
}
int kEventWindowDrawContent (int nextHandler, int theEvent, int userData) {