From 57bd7e623ef4b5481b9820cb8f5d1bfe8cd86adf Mon Sep 17 00:00:00 2001 From: kanato Date: Mon, 11 May 2009 02:18:22 +0000 Subject: [PATCH] Implement PointToScreen via poor man's method of just inverting result from PointToClient. --- Source/OpenTK/GameWindow.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index 849827ce..29e999da 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -1365,7 +1365,7 @@ namespace OpenTK #endregion #region PointToScreen -#if false // Todo: Linux / Mac OS X support missing. + /// /// Converts the client-area coordinates of a specified point to screen coordinates. /// @@ -1373,9 +1373,14 @@ namespace OpenTK /// The screen coordinates of the point, relative to the upper-left corner of the screen. Note, a screen-coordinate point that is above the window's client area has a negative y-coordinate. Similarly, a screen coordinate to the left of a client area has a negative x-coordinate. public System.Drawing.Point PointToScreen(System.Drawing.Point p) { - return glWindow.PointToScreen(p); + // Here we use the fact that PointToClient just translates the point, and PointToScreen + // should perform the inverse operation. + System.Drawing.Point trans = PointToClient(System.Drawing.Point.Empty); + p.X -= trans.X; + p.Y -= trans.Y; + return p; } -#endif + #endregion #region --- IDisposable Members ---