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:
the_fiddler 2011-08-25 13:38:08 +00:00
parent f4f0b97f7c
commit 9c6a4bb2df
2 changed files with 4 additions and 9 deletions

View file

@ -2635,13 +2635,6 @@ namespace OpenTK.Platform.Windows
[StructLayout(LayoutKind.Sequential)]
internal struct Win32Rectangle
{
internal Win32Rectangle(int width, int height)
{
left = top = 0;
right = width;
bottom = height;
}
/// <summary>
/// Specifies the x-coordinate of the upper-left corner of the rectangle.
/// </summary>

View file

@ -647,10 +647,12 @@ namespace OpenTK.Platform.Windows
void GrabCursor()
{
Win32Rectangle rect = Win32Rectangle.From(ClientRectangle);
Point pos = PointToScreen(new Point(rect.left, rect.top));
Point pos = PointToScreen(new Point(ClientRectangle.X, ClientRectangle.Y));
Win32Rectangle rect = new Win32Rectangle();
rect.left = pos.X;
rect.right = pos.X + ClientRectangle.Width;
rect.top = pos.Y;
rect.bottom = pos.Y + ClientRectangle.Height;
if (!Functions.ClipCursor(ref rect))
Debug.WriteLine(String.Format("Failed to grab cursor. Error: {0}",
Marshal.GetLastWin32Error()));