X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffg_cursor_mswin.c;h=7bc5cae250a5f6914b56399fbb2c61fe3eea8faf;hb=29ce77740209818d54bdea174d193307314f4084;hp=d14da5904b7e4aea48cc6a3b204337242e23aefc;hpb=0d72f166aecf3392abf1c1a31667937f24905264;p=freeglut diff --git a/src/mswin/fg_cursor_mswin.c b/src/mswin/fg_cursor_mswin.c index d14da59..7bc5cae 100644 --- a/src/mswin/fg_cursor_mswin.c +++ b/src/mswin/fg_cursor_mswin.c @@ -128,13 +128,18 @@ 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;