event.x = newX; event.y = newY;
public boolean open () {	checkWidget ();	boolean cancelled = false;	tracking = true;	Event event = new Event ();	POINT pt = new POINT ();	MSG msg = new MSG ();	drawRectangles ();	int oldPos = OS.GetMessagePos ();	while (tracking && !cancelled) {		if (parent != null && parent.isDisposed ()) break;		OS.GetMessage (msg, 0, 0, 0);		switch (msg.message) {			case OS.WM_LBUTTONUP:			case OS.WM_MOUSEMOVE:				int newPos = OS.GetMessagePos ();				if (newPos != oldPos) {					int oldX = (short) (oldPos & 0xFFFF);					int oldY = (short) (oldPos >> 16);					int newX = (short) (newPos & 0xFFFF);					int newY = (short) (newPos >> 16);						drawRectangles ();					for (int i=0; i<rectangles.length; i++) {						rectangles [i].x += newX - oldX;						rectangles [i].y += newY - oldY;					}					/*					* It is possible (but unlikely), that application					* code could have disposed the widget in the move					* event.  If this happens, return false to indicate					* that the tracking has failed.					*/					sendEvent (SWT.Move, event);					if (isDisposed ()) return false;					drawRectangles ();					oldPos = newPos;				}				tracking = msg.message != OS.WM_LBUTTONUP;				break;			case OS.WM_KEYDOWN:				cancelled = msg.wParam == OS.VK_ESCAPE;				break;		}		OS.DispatchMessage (msg);	}	drawRectangles ();	tracking = false;	return !cancelled;}