From d9de8ec42b076f875059acf8c02299689c9aa756 Mon Sep 17 00:00:00 2001 From: Diederick Niehorster Date: Sun, 29 Jul 2012 05:18:36 +0000 Subject: [PATCH 1/1] fg_cursor is a much better place for code reading the mouse position 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 | 3 ++- src/mswin/fg_cursor_mswin.c | 9 +++++++++ src/mswin/fg_window_mswin.c | 10 ---------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/fg_menu.c b/src/fg_menu.c index ff1b21e..6a7d96d 100644 --- a/src/fg_menu.c +++ b/src/fg_menu.c @@ -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 ); diff --git a/src/mswin/fg_cursor_mswin.c b/src/mswin/fg_cursor_mswin.c index b0eda70..1241e0a 100644 --- a/src/mswin/fg_cursor_mswin.c +++ b/src/mswin/fg_cursor_mswin.c @@ -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 diff --git a/src/mswin/fg_window_mswin.c b/src/mswin/fg_window_mswin.c index b09c008..ff47404 100644 --- a/src/mswin/fg_window_mswin.c +++ b/src/mswin/fg_window_mswin.c @@ -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) -- 1.7.10.4