Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Kovatch2010-12-02 19:31:47 +0000
committerScott Kovatch2010-12-02 19:31:47 +0000
commite581061e375ce57dc34ce3475e977fd34432f198 (patch)
tree027f1d258908b2543902fc985af28c9d09fb7622
parent655b61d50c03a4c7d58be015595f0114fafdc1f8 (diff)
downloadeclipse.platform.swt-e581061e375ce57dc34ce3475e977fd34432f198.tar.gz
eclipse.platform.swt-e581061e375ce57dc34ce3475e977fd34432f198.tar.xz
eclipse.platform.swt-e581061e375ce57dc34ce3475e977fd34432f198.zip
331698 - call bringToTop after saving focus in forceFocus.Root_printer_work
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
index 9fef08ce73..bd71486092 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
@@ -1332,9 +1332,18 @@ public boolean forceFocus () {
if (!focusView.canBecomeKeyView()) return false;
boolean result = forceFocus(focusView);
if (isDisposed ()) return false;
+ shell.setSavedFocus (this);
+ /*
+ * Feature in Cocoa. If the window is inactive when forceFocus is called bringToTop
+ * eventually calls makeKeyAndOrderFront. This activates the window immediately, but unlike other platforms,
+ * it also immediately fire notifications that the window was activated, as opposed to posting an event
+ * to be handled on the next pass of readAndDispatch().
+ *
+ * Shell#windowDidBecomeKey will call Decorations#restoreFocus, so the saved focus must be set
+ * before the window is activated or the wrong control will get focus.
+ */
shell.bringToTop (false);
if (isDisposed ()) return false;
- shell.setSavedFocus (this);
return result;
}

Back to the top