Browse files

Fixed coordinate transform for CursorVisible = false on Windows. Fixe…

…s issue [#2416]: "Hided mouse cursor problem".

Removed unnecessary constructors from Win32Rectangle struct.

git-svn-id: https://opentk.svn.sourceforge.net/svnroot/opentk/trunk@3079 ebc5dd9b-fb1d-0410-b6f8-d24c324e9604
  • Loading branch information...
1 parent 2dabb63 commit c7ac80f146a24d325aea7a98f3ee740fcf70bcee the_fiddler committed Aug 25, 2011
Showing with 4 additions and 9 deletions.
  1. +0 −7 Source/OpenTK/Platform/Windows/API.cs
  2. +4 −2 Source/OpenTK/Platform/Windows/WinGLNative.cs
View
7 Source/OpenTK/Platform/Windows/API.cs
@@ -2635,13 +2635,6 @@ internal struct RawInputMouseDeviceInfo
[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
6 Source/OpenTK/Platform/Windows/WinGLNative.cs
@@ -647,10 +647,12 @@ void ResetWindowState()
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()));

0 comments on commit c7ac80f

Please sign in to comment.