/// <summary> /// Notifies the mouse handler that a mouse button was released. /// </summary> /// <param name="buttons">Button which was released.</param> public void MouseButtonUp(MouseButtons buttons) { this.buttonTracker.ButtonRelease(buttons, this.currentState.X, this.currentState.Y); this.currentState.PressedButtons &= ~buttons; var mask = GetCallbackReasonRelease(buttons); if ((mask & this.callbackMask) != 0) { this.reason = mask; this.vm.RaiseInterrupt(CallbackInterrupt); } }
/// <summary> /// Performs common handling of a move event. /// </summary> private void MouseMoved() { this.currentState.X = Math.Max(this.currentState.X, 0); this.currentState.X = Math.Min(this.currentState.X, this.vm.VideoMode.Width - 1); this.currentState.Y = Math.Max(this.currentState.Y, 0); this.currentState.Y = Math.Min(this.currentState.Y, this.vm.VideoMode.Height - 1); if (callbackMask.HasFlag(CallbackMask.Move)) { this.reason = CallbackMask.Move; this.vm.RaiseInterrupt(CallbackInterrupt); } this.vm.OnMouseMove(new MouseMoveEventArgs(this.currentState.X, this.currentState.Y)); }
/// <summary> /// Calls the user-specified callback function. /// </summary> private void RaiseCallback() { int scaledX = GetScaledX(this.currentState.X); int scaledY = GetScaledY(this.currentState.Y); var p = this.vm.Processor; p.AX = (short)reason; p.BX = (short)currentState.PressedButtons; p.CX = (short)scaledX; p.DX = (short)scaledY; p.SI = (ushort)callbackMotionCounterX; p.DI = (ushort)callbackMotionCounterY; this.callbackState = currentState; this.reason = CallbackMask.Disabled; Instructions.Call.FarAbsoluteCall(vm, (uint)((this.callbackSegment << 16) | this.callbackOffset)); }