display.grabControl = null;
public boolean open () {	checkWidget ();	cancelled = false;	tracking = true;	window = display.createOverlayWindow ();	OS.ShowWindow (window);	drawRectangles (window, rectangles, false);		/*	* If exactly one of UP/DOWN is specified as a style then set the cursor	* orientation accordingly (the same is done for LEFT/RIGHT styles below).	*/	int vStyle = style & (SWT.UP | SWT.DOWN);	if (vStyle == SWT.UP || vStyle == SWT.DOWN) {		cursorOrientation |= vStyle;	}	int hStyle = style & (SWT.LEFT | SWT.RIGHT);	if (hStyle == SWT.LEFT || hStyle == SWT.RIGHT) {		cursorOrientation |= hStyle;	}		Point cursorPos;	if (OS.StillDown ()) {		org.eclipse.swt.internal.carbon.Point pt = new org.eclipse.swt.internal.carbon.Point ();		OS.GetGlobalMouse (pt);		cursorPos = new Point (pt.h, pt.v);	} else {		if ((style & SWT.RESIZE) != 0) {			cursorPos = adjustResizeCursor (true);		} else {			cursorPos = adjustMoveCursor ();		}	}	if (cursorPos != null) {		oldX = cursorPos.x;		oldY = cursorPos.y;	}	/* Tracker behaves like a Dialog with its own OS event loop. */	int [] outEvent  = new int [1];	while (tracking && !cancelled) {		int status = OS.ReceiveNextEvent (0, null, OS.kEventDurationNoWait, true, outEvent);		if (status != OS.noErr) continue;		int event = outEvent [0];		int eventClass = OS.GetEventClass (event);		int eventKind = OS.GetEventKind (event);		int nextHandler = 0;		switch (eventClass) {			case OS.kEventClassMouse:				switch (eventKind) {					case OS.kEventMouseUp: kEventMouseUp (nextHandler, event, 0); break;					case OS.kEventMouseMoved: kEventMouseMoved (nextHandler, event, 0); break;					case OS.kEventMouseDragged: kEventMouseDragged (nextHandler, event, 0); break;				}				break;			case OS.kEventClassKeyboard:				switch (eventKind) {					case OS.kEventRawKeyDown: kEventRawKeyDown (nextHandler, event, 0); break;					case OS.kEventRawKeyModifiersChanged: kEventRawKeyModifiersChanged (nextHandler, event, 0); break;					case OS.kEventRawKeyRepeat: kEventRawKeyRepeat (nextHandler, event, 0); break;					case OS.kEventRawKeyUp: kEventRawKeyUp (nextHandler, event, 0); break;				}				break;		}		/*		* Don't dispatch mouse and key events in general, EXCEPT once this		* tracker has finished its work.		*/		boolean dispatch = true;		if (tracking && !cancelled) {			if (eventClass == OS.kEventClassMouse) dispatch = false;			if (eventClass == OS.kEventClassKeyboard) dispatch = false;		}		if (dispatch) OS.SendEventToEventTarget (event, OS.GetEventDispatcherTarget ());		OS.ReleaseEvent (event);		if (clientCursor != null && resizeCursor == null) {			display.setCursor (clientCursor.handle);		}	}	if (!isDisposed()) {		drawRectangles (window, rectangles, true);	}	OS.DisposeWindow (window);	tracking = false;	display.grabControl = null;	window = 0;	return !cancelled;}