summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio_quarti@ca.ibm.com>2012-10-04 17:33:45 -0400
committerSilenio Quarti <silenio_quarti@ca.ibm.com>2012-10-04 17:33:45 -0400
commit29deb6dad3bbc4a1894b93123ec8c8c5440fbecd (patch)
tree9b274881bc29b3c93202a0da5127aef5eb5b9525
parenta4e8d53a7f3afac8a7698d325365123a4d399a8c (diff)
downloadeclipse.platform.swt-29deb6dad3bbc4a1894b93123ec8c8c5440fbecd.tar.gz
eclipse.platform.swt-29deb6dad3bbc4a1894b93123ec8c8c5440fbecd.tar.xz
eclipse.platform.swt-29deb6dad3bbc4a1894b93123ec8c8c5440fbecd.zip
Bug 388574 - [Mac OS X 10.8] Text control loses focus upon its movement
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java2
2 files changed, 10 insertions, 0 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 dded880d88..6e045352bf 100644
--- 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
@@ -3526,6 +3526,13 @@ public void setBounds (int x, int y, int width, int height) {
}
void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
+ /*
+ * Bug in Cocoa. On Mac 10.8, a text control loses and gains focus
+ * when its bounds changes. The fix is to ignore these events.
+ */
+ Display display = this.display;
+ boolean oldIgnoreFocus = display.ignoreFocus;
+ display.ignoreFocus = true;
NSView topView = topView();
if (move && resize) {
NSRect rect = new NSRect();
@@ -3545,6 +3552,7 @@ void setBounds (int x, int y, int width, int height, boolean move, boolean resiz
size.height = height;
topView.setFrameSize(size);
}
+ display.ignoreFocus = oldIgnoreFocus;
}
/**
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 f4558aab5f..7706c173b9 100644
--- 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
@@ -126,6 +126,7 @@ public class Display extends Device {
Caret currentCaret;
+ boolean ignoreFocus;
boolean sendEvent;
int clickCountButton, clickCount;
int blinkTime;
@@ -643,6 +644,7 @@ void checkEnterExit (Control control, NSEvent nsEvent, boolean send) {
}
void checkFocus () {
+ if (ignoreFocus) return;
Control oldControl = currentFocusControl;
Control newControl = getFocusControl ();
if (oldControl != newControl) {