summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorSilenio Quarti2012-10-04 17:33:45 (EDT)
committer Bogdan Gheorghe2013-01-15 12:43:01 (EST)
commit8f3dc142dea99aa3a2479caf5485364c2c95414d (patch)
treedb8e9780b2e18060e03dd638699498b40cb03046
parentb7d07f572f31f74973c3c0ecfbd4778ab7847caa (diff)
downloadeclipse.platform.swt-8f3dc142dea99aa3a2479caf5485364c2c95414d.zip
eclipse.platform.swt-8f3dc142dea99aa3a2479caf5485364c2c95414d.tar.gz
eclipse.platform.swt-8f3dc142dea99aa3a2479caf5485364c2c95414d.tar.bz2
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 2319721..ab8477b 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 8b7c8da..fd9e11d 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;
@@ -638,6 +639,7 @@ void checkEnterExit (Control control, NSEvent nsEvent, boolean send) {
}
void checkFocus () {
+ if (ignoreFocus) return;
Control oldControl = currentFocusControl;
Control newControl = getFocusControl ();
if (oldControl != newControl) {