Fixed coordinate transform for CursorVisible = false on Windows. Fixes issue [#2416]: "Hided mouse cursor problem".
Removed unnecessary constructors from Win32Rectangle struct.
This commit is contained in:
parent
f4f0b97f7c
commit
9c6a4bb2df
2 changed files with 4 additions and 9 deletions
|
@ -2635,13 +2635,6 @@ namespace OpenTK.Platform.Windows
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
internal struct Win32Rectangle
|
internal struct Win32Rectangle
|
||||||
{
|
{
|
||||||
internal Win32Rectangle(int width, int height)
|
|
||||||
{
|
|
||||||
left = top = 0;
|
|
||||||
right = width;
|
|
||||||
bottom = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies the x-coordinate of the upper-left corner of the rectangle.
|
/// Specifies the x-coordinate of the upper-left corner of the rectangle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -647,10 +647,12 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
void GrabCursor()
|
void GrabCursor()
|
||||||
{
|
{
|
||||||
Win32Rectangle rect = Win32Rectangle.From(ClientRectangle);
|
Point pos = PointToScreen(new Point(ClientRectangle.X, ClientRectangle.Y));
|
||||||
Point pos = PointToScreen(new Point(rect.left, rect.top));
|
Win32Rectangle rect = new Win32Rectangle();
|
||||||
rect.left = pos.X;
|
rect.left = pos.X;
|
||||||
|
rect.right = pos.X + ClientRectangle.Width;
|
||||||
rect.top = pos.Y;
|
rect.top = pos.Y;
|
||||||
|
rect.bottom = pos.Y + ClientRectangle.Height;
|
||||||
if (!Functions.ClipCursor(ref rect))
|
if (!Functions.ClipCursor(ref rect))
|
||||||
Debug.WriteLine(String.Format("Failed to grab cursor. Error: {0}",
|
Debug.WriteLine(String.Format("Failed to grab cursor. Error: {0}",
|
||||||
Marshal.GetLastWin32Error()));
|
Marshal.GetLastWin32Error()));
|
||||||
|
|
Loading…
Reference in a new issue