mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 18:45:34 +00:00
[X11] Added X11KeyMap.TranslateButton()
This code was duplicated on four different places before.
This commit is contained in:
parent
28a1849a72
commit
e155d647de
|
@ -387,5 +387,30 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
return key != Key.Unknown;
|
||||
}
|
||||
|
||||
internal static MouseButton TranslateButton(int button, out int wheelx, out int wheely)
|
||||
{
|
||||
wheelx = 0;
|
||||
wheely = 0;
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case 1: return MouseButton.Left;
|
||||
case 2: return MouseButton.Middle;
|
||||
case 3: return MouseButton.Right;
|
||||
case 4: wheely = +1; return MouseButton.LastButton;
|
||||
case 5: wheely = -1; return MouseButton.LastButton;
|
||||
case 6: wheelx = +1; return MouseButton.LastButton;
|
||||
case 7: wheelx = -1; return MouseButton.LastButton;
|
||||
case 8: return MouseButton.Button1;
|
||||
case 9: return MouseButton.Button2;
|
||||
case 10: return MouseButton.Button3;
|
||||
case 11: return MouseButton.Button4;
|
||||
case 12: return MouseButton.Button5;
|
||||
case 13: return MouseButton.Button6;
|
||||
case 14: return MouseButton.Button7;
|
||||
default: return MouseButton.LastButton;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue