Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: Source/OpenTK/Platform/Windows/WinRawMouse.cs
- ===================================================================
- --- Source/OpenTK/Platform/Windows/WinRawMouse.cs (revision 3125)
- +++ Source/OpenTK/Platform/Windows/WinRawMouse.cs (working copy)
- @@ -137,6 +137,8 @@
- }
- }
- + delegate void MouseButtonChangedHandler(MouseButton Button);
- +
- public bool ProcessMouseEvent(RawInput rin)
- {
- RawMouse raw = rin.Data.Mouse;
- @@ -158,17 +160,20 @@
- int mouse_handle = rawids.ContainsKey(handle) ? rawids[handle] : 0;
- mouse = mice[mouse_handle];
- - if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_DOWN) != 0) mouse.EnableBit((int)MouseButton.Left);
- - if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_UP) != 0) mouse.DisableBit((int)MouseButton.Left);
- - if ((raw.ButtonFlags & RawInputMouseState.RIGHT_BUTTON_DOWN) != 0) mouse.EnableBit((int)MouseButton.Right);
- - if ((raw.ButtonFlags & RawInputMouseState.RIGHT_BUTTON_UP) != 0) mouse.DisableBit((int)MouseButton.Right);
- - if ((raw.ButtonFlags & RawInputMouseState.MIDDLE_BUTTON_DOWN) != 0) mouse.EnableBit((int)MouseButton.Middle);
- - if ((raw.ButtonFlags & RawInputMouseState.MIDDLE_BUTTON_UP) != 0) mouse.DisableBit((int)MouseButton.Middle);
- - if ((raw.ButtonFlags & RawInputMouseState.BUTTON_4_DOWN) != 0) mouse.EnableBit((int)MouseButton.Button1);
- - if ((raw.ButtonFlags & RawInputMouseState.BUTTON_4_UP) != 0) mouse.DisableBit((int)MouseButton.Button1);
- - if ((raw.ButtonFlags & RawInputMouseState.BUTTON_5_DOWN) != 0) mouse.EnableBit((int)MouseButton.Button2);
- - if ((raw.ButtonFlags & RawInputMouseState.BUTTON_5_UP) != 0) mouse.DisableBit((int)MouseButton.Button2);
- + MouseButtonChangedHandler EnableBit = (Button) => { mouse.EnableBit((int)Button); Functions.SetCapture(Window); };
- + MouseButtonChangedHandler DisableBit = (Button) => { mouse.DisableBit((int)Button); Functions.ReleaseCapture(); };
- + if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_DOWN) != 0) EnableBit(MouseButton.Left);
- + if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_UP) != 0) DisableBit(MouseButton.Left);
- + if ((raw.ButtonFlags & RawInputMouseState.RIGHT_BUTTON_DOWN) != 0) EnableBit(MouseButton.Right);
- + if ((raw.ButtonFlags & RawInputMouseState.RIGHT_BUTTON_UP) != 0) DisableBit(MouseButton.Right);
- + if ((raw.ButtonFlags & RawInputMouseState.MIDDLE_BUTTON_DOWN) != 0) EnableBit(MouseButton.Middle);
- + if ((raw.ButtonFlags & RawInputMouseState.MIDDLE_BUTTON_UP) != 0) DisableBit(MouseButton.Middle);
- + if ((raw.ButtonFlags & RawInputMouseState.BUTTON_4_DOWN) != 0) EnableBit(MouseButton.Button1);
- + if ((raw.ButtonFlags & RawInputMouseState.BUTTON_4_UP) != 0) DisableBit(MouseButton.Button1);
- + if ((raw.ButtonFlags & RawInputMouseState.BUTTON_5_DOWN) != 0) EnableBit(MouseButton.Button2);
- + if ((raw.ButtonFlags & RawInputMouseState.BUTTON_5_UP) != 0) DisableBit(MouseButton.Button2);
- +
- if ((raw.ButtonFlags & RawInputMouseState.WHEEL) != 0)
- mouse.WheelPrecise += (short)raw.ButtonData / 120.0f;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement