private bool _doMouseClick(int mouseButton, MDI.MouseUpdate bufferedData) { if (((bufferedData.Value & 0x80) != 0) && (MouseState.Buttons & (1 << mouseButton)) == 0) { MouseState.Buttons |= 1 << mouseButton; //turn the bit flag on if (EventListener != null && IsBuffered) { return(EventListener.MousePressed(new MouseEventArgs(this, MouseState), (MouseButtonID)mouseButton)); } } else if (((bufferedData.Value & 0x80) == 0) && (MouseState.Buttons & (1 << mouseButton)) != 0) { MouseState.Buttons &= ~(1 << mouseButton); //turn the bit flag off if (EventListener != null && IsBuffered) { return(EventListener.MouseReleased(new MouseEventArgs(this, MouseState), (MouseButtonID)mouseButton)); } } return(true); }
private static void ParseMouseData(MouseUpdate[] data) { _mouseDown.Clear(); _mouseUp.Clear(); for (int i = 0; i < data.Length; i++) { if (data[i].IsButton) { int buttonVal = int.Parse(data[i].Offset.ToString().Replace("Buttons", "")); if (data[i].Value != 0) HandleMouseDown(buttonVal); // Pressed if (data[i].Value == 0) HandleMouseUp(buttonVal); // Released } } }