int eventClass= OS.GetEventClass(event); if (eventClass == OS.kEventClassMouse) { switch (OS.GetEventKind(event)) { case OS.kEventMouseDown: case OS.kEventMouseDragged: switch (MacEvent.getEventMouseButton(event)) { case 1: fMouseButtonState |= SWT.BUTTON1; break; case 2: fMouseButtonState |= SWT.BUTTON2; break; case 3: fMouseButtonState |= SWT.BUTTON3; break; } break; case OS.kEventMouseMoved: fMouseButtonState= 0; break; case OS.kEventMouseUp: switch (MacEvent.getEventMouseButton(event)) { case 1: fMouseButtonState &= ~SWT.BUTTON1; break; case 2: fMouseButtonState &= ~SWT.BUTTON2; break; case 3: fMouseButtonState &= ~SWT.BUTTON3; break; } break; } }
MacEvent.trackStateMask(event);
public boolean readAndDispatch () {	checkDevice ();	int[] evt= new int[1];	int rc= OS.ReceiveNextEvent(null, OS.kEventDurationNoWait, true, evt);		switch (rc) {	case OS.kNoErr:		int target= OS.GetEventDispatcherTarget();				/*		System.out.println("readAndDispatch: " + MacUtil.toString(eventClass));		*/		int event= evt[0];				int eventClass= OS.GetEventClass(event);		if (eventClass == OS.kEventClassMouse) {			switch (OS.GetEventKind(event)) {			case OS.kEventMouseDown:			case OS.kEventMouseDragged:				switch (MacEvent.getEventMouseButton(event)) {				case 1:					fMouseButtonState |= SWT.BUTTON1;					break;				case 2:					fMouseButtonState |= SWT.BUTTON2;					break;				case 3:					fMouseButtonState |= SWT.BUTTON3;					break;				}				break;			case OS.kEventMouseMoved:				fMouseButtonState= 0;				break;			case OS.kEventMouseUp:				switch (MacEvent.getEventMouseButton(event)) {				case 1:					fMouseButtonState &= ~SWT.BUTTON1;					break;				case 2:					fMouseButtonState &= ~SWT.BUTTON2;					break;				case 3:					fMouseButtonState &= ~SWT.BUTTON3;					break;				}				break;			}		}					OS.SendEventToEventTarget(event, target);		OS.ReleaseEvent(event);		repairPending();		runDeferredEvents ();		return true;			case OS.eventLoopTimedOutErr:		break;	// no event: run async			default:		System.out.println("readAndDispatch: error " + rc);		break;	}	return runAsyncMessages ();}