fixed indentation in AUTHORS
[freeglut] / src / mswin / fg_cursor_mswin.c
index d14da59..b8ec716 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_cursor_mswin.c
+ * fg_cursor_mswin.c
  *
  * The Windows-specific mouse cursor related stuff.
  *
@@ -128,14 +128,19 @@ void fgPlatformWarpPointer ( int x, int y )
 }
 
 
-void fghPlatformGetCursorPos(SFG_XYUse *mouse_pos)
+void fghPlatformGetCursorPos(const SFG_Window *window, GLboolean client, SFG_XYUse *mouse_pos)
 {
-    /* Get current pointer location in screen coordinates
+    /* Get current pointer location in screen coordinates (if client is false or window is NULL), else
+     * Get current pointer location relative to top-left of client area of window (if client is true and window is not NULL)
      */
     POINT pos;
     GetCursorPos(&pos);
 
+    /* convert to client coords if wanted */
+    if (client && window && window->Window.Handle)
+        ScreenToClient(window->Window.Handle,&pos);
+
     mouse_pos->X = pos.x;
     mouse_pos->Y = pos.y;
     mouse_pos->Use = GL_TRUE;
-}
\ No newline at end of file
+}