Community
Participate
Working Groups
Created attachment 220621 [details] Test case reproducing the issue. Text control loses focus upon its movement in Mac OS X 10.8 if created and displayed after Shell is opened. Text text1 = new Text(shell, SWT.BORDER); text1.setFocus(); text1.setBounds(10, 10, 64, 16); Test case is attached. Run the test case and click on "Click here!" label. See the sysout. Expected: "Text1: focus gained." Actual: "Text1: focus gained. Text1: focus lost. Text1: focus gained." Works as expected on Mac OS X 10.6.7.
I can reproduce the bad FocusOut event with the snippet on 10.8: at test.TestFocus$2.focusLost(TestFocus.java:74) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:143) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4143) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1462) at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:3295) at org.eclipse.swt.widgets.Display.checkFocus(Display.java:650) at org.eclipse.swt.widgets.Shell.makeFirstResponder(Shell.java:1260) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5613) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221) at org.eclipse.swt.widgets.Widget.textDidEndEditing(Widget.java:1955) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5581) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.callSuperBoolean(Widget.java:288) at org.eclipse.swt.widgets.Widget.makeFirstResponder(Widget.java:1166) at org.eclipse.swt.widgets.Shell.makeFirstResponder(Shell.java:1259) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5613) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.setFrameSize(Widget.java:1663) at org.eclipse.swt.widgets.Control.setFrameSize(Control.java:3800) at org.eclipse.swt.widgets.Text.setFrameSize(Text.java:1796) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5495) at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method) at org.eclipse.swt.internal.cocoa.NSView.setFrame(NSView.java:267) at org.eclipse.swt.widgets.Control.setBounds(Control.java:3536) at org.eclipse.swt.widgets.Control.setBounds(Control.java:3525) at test.TestFocus.createText(TestFocus.java:82) at test.TestFocus$1.mouseDown(TestFocus.java:58) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:192) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4143) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1271) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3989) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3628) at test.TestFocus.open(TestFocus.java:40) at test.TestFocus.main(TestFocus.java:25)
This bug is basically blocking the Android plugin (the layout editor) as well; the property sheet won't work for text properties (which are probably the most important ones).
Is this the same as Bug 390924? @Tor: Could you try the patch we applied for 4.3.2?
I'll try with the latest nightly build: http://download.eclipse.org/eclipse/downloads/drops4/N20121003-2000/ That contains the fix, right? If not, is there somewhere I can grab prebuilt binaries which include the fix?
I think the latest build should contain that. Not sure though. To test you can: 1.) git clone http://anonymous@git.eclipse.org/gitroot/platform/eclipse.platform.ui.git 2.) Import the org.eclipse.ui.ide project into Eclipse and apply the patch on it 3.) Start a runtime Eclipse (right mouse click on org.eclipse.ui.ide -> Run as -> Eclipse Application) Fortunately ;-) I don't have a Mac so I can't test.
It's not fixed in the nightly build I downloaded. I'll try your patch approach now in case it's just a matter of the fix not being included in that nightly yet.
Actually, it looks like that patch is for the Eclipse UI. That seems like a different bug, since this one is reproducible with a simple SWT example (the original test case attached to this bug).
Fixed http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=29deb6dad3bbc4a1894b93123ec8c8c5440fbecd
Sweet, thank you!!
I can confirm that this fix works for our scenario in the Android plugin as well (tested with a 4.3 nightly). Any plans to backport it to 4.2 maintenance releases?
It requires more testing before we can back port it. I will reopen and target it for 4.2.2 so that we do not forget.
Backported to 4_2_maintenance and 3_8_maintenance