OS.TrackMouseLocationWithOptions (port, OS.kTrackMouseLocationOptionDontConsumeMouseUp, 50 / 1000.0, outPt, outModifiers, outResult);
OS.TrackMouseLocationWithOptions (port, OS.kTrackMouseLocationOptionDontConsumeMouseUp, 10 / 1000.0, outPt, outModifiers, outResult);
boolean runGrabs () {	if (grabControl == null || grabbing) return false;	if (!OS.StillDown ()) {		grabControl = null;		return false;	}	Rect rect = new Rect ();	int [] outModifiers = new int [1];	short [] outResult = new short [1];	CGPoint pt = new CGPoint ();	org.eclipse.swt.internal.carbon.Point outPt = new org.eclipse.swt.internal.carbon.Point ();	grabbing = true;	mouseUpControl = null;	try {		while (grabControl != null && !grabControl.isDisposed () && outResult [0] != OS.kMouseTrackingMouseUp) {			if (!OS.HIVIEW) grabControl.getShell().update (true);			lastModifiers = OS.GetCurrentEventKeyModifiers ();			int oldState = OS.GetCurrentEventButtonState ();			int handle = grabControl.handle;			int window = OS.GetControlOwner (handle);			int port = OS.HIVIEW ? -1 : OS.GetWindowPort (window);			OS.TrackMouseLocationWithOptions (port, OS.kTrackMouseLocationOptionDontConsumeMouseUp, 50 / 1000.0, outPt, outModifiers, outResult);			int type = 0, button = 0;			switch ((int) outResult [0]) {				case OS.kMouseTrackingTimedOut: {					runAsyncMessages (false);					break;				}				case OS.kMouseTrackingMouseDown: {					type = SWT.MouseDown;					int newState = OS.GetCurrentEventButtonState ();					if ((oldState & 0x1) == 0 && (newState & 0x1) != 0) button = 1;					if ((oldState & 0x2) == 0 && (newState & 0x2) != 0) button = 2;					if ((oldState & 0x4) == 0 && (newState & 0x4) != 0) button = 3;					break;				}				case OS.kMouseTrackingMouseUp: {					type = SWT.MouseUp;					int newState = OS.GetCurrentEventButtonState ();					if ((oldState & 0x1) != 0 && (newState & 0x1) == 0) button = 1;					if ((oldState & 0x2) != 0 && (newState & 0x2) == 0) button = 2;					if ((oldState & 0x4) != 0 && (newState & 0x4) == 0) button = 3;					break;				}//				case OS.kMouseTrackingMouseExited: 				type = SWT.MouseExit; break;//				case OS.kMouseTrackingMouseEntered: 			type = SWT.MouseEnter; break;				case OS.kMouseTrackingMouseDragged: {					mouseMoved = true;					type = SWT.MouseMove;					dragDetect (grabControl);					break;				}				case OS.kMouseTrackingMouseKeyModifiersChanged:	break;				case OS.kMouseTrackingUserCancelled:	 break;				case OS.kMouseTrackingMouseMoved: {					mouseMoved = true;					type = SWT.MouseMove;					break;				}			}			boolean events = type != 0;			if (type != 0) {				int x = outPt.h;				int y = outPt.v;				if (OS.HIVIEW) {					OS.GetWindowBounds (window, (short) OS.kWindowStructureRgn, rect);					pt.x = x - rect.left;					pt.y = y - rect.top;					OS.HIViewConvertPoint (pt, 0, handle);					x = (int) pt.x;					y = (int) pt.y;				} else {					OS.GetControlBounds (handle, rect);					x -= rect.left;					y -= rect.top;				}				int chord = OS.GetCurrentEventButtonState ();				if (grabControl != null && !grabControl.isDisposed ()) {					if (type == SWT.MouseUp) {						mouseUpControl = grabControl;					} else {						grabControl.sendMouseEvent (type, (short)button, true, chord, (short)x, (short)y, outModifiers [0]);					}				}			}			if (events) runDeferredEvents ();		}	} finally {		grabbing = false;		grabControl = null;	}	return true;}