Advertisement
Guest User

Untitled

a guest
Dec 21st, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.28 KB | None | 0 0
  1. Index: Source/OpenTK/Platform/Windows/WinRawMouse.cs
  2. ===================================================================
  3. --- Source/OpenTK/Platform/Windows/WinRawMouse.cs   (revision 3125)
  4. +++ Source/OpenTK/Platform/Windows/WinRawMouse.cs   (working copy)
  5. @@ -137,6 +137,8 @@
  6.              }
  7.          }
  8.  
  9. +        delegate void MouseButtonChangedHandler(MouseButton Button);
  10. +
  11.          public bool ProcessMouseEvent(RawInput rin)
  12.          {
  13.              RawMouse raw = rin.Data.Mouse;
  14. @@ -158,17 +160,20 @@
  15.              int mouse_handle = rawids.ContainsKey(handle) ? rawids[handle] : 0;
  16.              mouse = mice[mouse_handle];
  17.  
  18. -            if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_DOWN) != 0) mouse.EnableBit((int)MouseButton.Left);
  19. -            if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_UP) != 0) mouse.DisableBit((int)MouseButton.Left);
  20. -            if ((raw.ButtonFlags & RawInputMouseState.RIGHT_BUTTON_DOWN) != 0) mouse.EnableBit((int)MouseButton.Right);
  21. -            if ((raw.ButtonFlags & RawInputMouseState.RIGHT_BUTTON_UP) != 0) mouse.DisableBit((int)MouseButton.Right);
  22. -            if ((raw.ButtonFlags & RawInputMouseState.MIDDLE_BUTTON_DOWN) != 0) mouse.EnableBit((int)MouseButton.Middle);
  23. -            if ((raw.ButtonFlags & RawInputMouseState.MIDDLE_BUTTON_UP) != 0) mouse.DisableBit((int)MouseButton.Middle);
  24. -            if ((raw.ButtonFlags & RawInputMouseState.BUTTON_4_DOWN) != 0) mouse.EnableBit((int)MouseButton.Button1);
  25. -            if ((raw.ButtonFlags & RawInputMouseState.BUTTON_4_UP) != 0) mouse.DisableBit((int)MouseButton.Button1);
  26. -            if ((raw.ButtonFlags & RawInputMouseState.BUTTON_5_DOWN) != 0) mouse.EnableBit((int)MouseButton.Button2);
  27. -            if ((raw.ButtonFlags & RawInputMouseState.BUTTON_5_UP) != 0) mouse.DisableBit((int)MouseButton.Button2);
  28. +            MouseButtonChangedHandler EnableBit = (Button) => { mouse.EnableBit((int)Button); Functions.SetCapture(Window); };
  29. +            MouseButtonChangedHandler DisableBit = (Button) => { mouse.DisableBit((int)Button); Functions.ReleaseCapture(); };
  30.  
  31. +            if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_DOWN) != 0) EnableBit(MouseButton.Left);
  32. +            if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_UP) != 0) DisableBit(MouseButton.Left);
  33. +            if ((raw.ButtonFlags & RawInputMouseState.RIGHT_BUTTON_DOWN) != 0) EnableBit(MouseButton.Right);
  34. +            if ((raw.ButtonFlags & RawInputMouseState.RIGHT_BUTTON_UP) != 0) DisableBit(MouseButton.Right);
  35. +            if ((raw.ButtonFlags & RawInputMouseState.MIDDLE_BUTTON_DOWN) != 0) EnableBit(MouseButton.Middle);
  36. +            if ((raw.ButtonFlags & RawInputMouseState.MIDDLE_BUTTON_UP) != 0) DisableBit(MouseButton.Middle);
  37. +            if ((raw.ButtonFlags & RawInputMouseState.BUTTON_4_DOWN) != 0) EnableBit(MouseButton.Button1);
  38. +            if ((raw.ButtonFlags & RawInputMouseState.BUTTON_4_UP) != 0) DisableBit(MouseButton.Button1);
  39. +            if ((raw.ButtonFlags & RawInputMouseState.BUTTON_5_DOWN) != 0) EnableBit(MouseButton.Button2);
  40. +            if ((raw.ButtonFlags & RawInputMouseState.BUTTON_5_UP) != 0) DisableBit(MouseButton.Button2);
  41. +
  42.              if ((raw.ButtonFlags & RawInputMouseState.WHEEL) != 0)
  43.                  mouse.WheelPrecise += (short)raw.ButtonData / 120.0f;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement