diff options
author | Silenio Quarti | 2012-10-04 21:33:45 +0000 |
---|---|---|
committer | Bogdan Gheorghe | 2013-01-15 21:15:18 +0000 |
commit | 857e6a19569cc73c1565413d20a16af1b16d476c (patch) | |
tree | f4901394a6e6f62d28e991981f0248ae12a8de3c | |
parent | 4141d0f2c2ec0fb8720bc145412b69e44102cc1b (diff) | |
download | eclipse.platform.swt-857e6a19569cc73c1565413d20a16af1b16d476c.tar.gz eclipse.platform.swt-857e6a19569cc73c1565413d20a16af1b16d476c.tar.xz eclipse.platform.swt-857e6a19569cc73c1565413d20a16af1b16d476c.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.java | 8 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java | 2 |
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 2319721824..ab8477b474 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 8b7c8daf1f..fd9e11dd18 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) { |