fg_cursor is a much better place for code reading the mouse position
authorDiederick Niehorster <dcnieho@gmail.com>
Sun, 29 Jul 2012 05:18:36 +0000 (05:18 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Sun, 29 Jul 2012 05:18:36 +0000 (05:18 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1377 7f0cb862-5218-0410-a997-914c9d46530a

src/fg_menu.c
src/mswin/fg_cursor_mswin.c
src/mswin/fg_window_mswin.c

index ff1b21e..6a7d96d 100644 (file)
@@ -76,6 +76,7 @@ static float menu_pen_hback [4] = FREEGLUT_MENU_PEN_HBACK_COLORS;
 
 
 extern GLvoid fgPlatformGetGameModeVMaxExtent( SFG_Window* window, int* x, int* y );
+extern void fghPlatformGetCursorPos(SFG_XYUse *mouse_pos);
 
 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
 
@@ -721,7 +722,7 @@ void fgDeactivateMenu( SFG_Window *window )
         {
             /* Get cursor position on screen and convert to relative to parent_window's client area */
             SFG_XYUse mouse_pos;
-            fghPlatformGetMousePos(&mouse_pos);
+            fghPlatformGetCursorPos(&mouse_pos);
             
             mouse_pos.X -= glutGet( GLUT_WINDOW_X );
             mouse_pos.Y -= glutGet( GLUT_WINDOW_Y );
index b0eda70..1241e0a 100644 (file)
@@ -113,3 +113,12 @@ void fgPlatformWarpPointer ( int x, int y )
 }
 
 
+void fghPlatformGetCursorPos(SFG_XYUse *mouse_pos)
+{
+    POINT pos;
+    GetCursorPos(&pos);
+
+    mouse_pos->X = pos.x;
+    mouse_pos->Y = pos.y;
+    mouse_pos->Use = GL_TRUE;
+}
\ No newline at end of file
index b09c008..ff47404 100644 (file)
@@ -371,16 +371,6 @@ void fgPlatformSetWindow ( SFG_Window *window )
 }
 
 
-void fghPlatformGetMousePos(SFG_XYUse *mouse_pos)
-{
-    POINT pos;
-    GetCursorPos(&pos);
-
-    mouse_pos->X = pos.x;
-    mouse_pos->Y = pos.y;
-    mouse_pos->Use = GL_TRUE;
-}
-
 /* Returns the width of the window borders based on the window's style.
 */
 void fghGetBorderWidth(const DWORD windowStyle, int* xBorderWidth, int* yBorderWidth)