Community
Participate
Working Groups
Build Identifier: 20090920-1017 MouseExit event is being thrown on the first drag attempt when it should not be. In general, a MouseExit event will issue when you drag mouce outside out the widget and mouse left key up. But in this case, on the first drag, MouseExit event issue before your mouse left key up. This bug is tested in swt-carbon 3.5.2. And in swt-cocoa 3.5.2, this bug disappear. Reproducible: Always Steps to Reproduce: 1.Run source code. A shell will display. 2.Click down mouse left key inside the blue area, and holding down, darg the mouse outside of the blue area. In this process, mouce left key still hold down. 3.Notice "exit" printed to stdout, showing that a MouseExit event was thrown when it should not be.
Created attachment 167865 [details] example source code
source code: import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class DragSametiemTest { public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell(display); shell=new Shell(display, SWT.SHELL_TRIM); GridLayout gl = new GridLayout(1, false); gl.marginHeight=0; gl.marginWidth=0; shell.setLayout(gl); Composite _chatAreaCmp = new Composite(shell, SWT.NONE); _chatAreaCmp.setLayoutData(new GridData(GridData.FILL_BOTH)); _chatAreaCmp.setLayout(gl); Text browser = new Text(_chatAreaCmp, SWT.NONE); browser.setText("top text"); browser.setLayoutData(new GridData(GridData.FILL_BOTH)); MyComp _chatAreaView = new MyComp(_chatAreaCmp, SWT.DOWN); _chatAreaView.setLayout(gl); _chatAreaView.setLayoutData(new GridData(GridData.FILL_BOTH)); shell.setSize(250, 300); shell.layout(); shell.open(); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } static class MyComp extends Composite { public MyComp(Composite parent, int style) { super(parent, style); Canvas canvas = new Canvas(this, style); Listener listener = new Listener() { public void handleEvent(Event event) { switch (event.type) { case SWT.Paint: GC gc = event.gc; Rectangle rect = getClientArea(); gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)); gc.fillRectangle(rect.x, rect.y, rect.width, rect.height); break; case SWT.MouseExit: System.out.println("exit"); break; } } }; canvas.setLayoutData(new GridData(GridData.FILL_BOTH)); int[] events = new int[] {SWT.Paint,SWT.KeyDown, SWT.MouseExit }; for (int i = 0; i < events.length; i++) { canvas.addListener(events[i], listener); } } } }
Happens only with the first drag.
Created attachment 170102 [details] patch for 3.5.2 and HEAD (after 3.6 ships)
Thanks
Silenio, will this be included in 3.6.1? (we are moving XPD up to 3.6.1 shortly)
Fix has been released to HEAD. Felipe, please review for 3.6.1.
Fix released to R3_6_maintenance and HEAD