diff --git a/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp b/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp index c2ca76d..3caf38e 100644 --- a/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp +++ b/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp @@ -12,7 +12,8 @@ GLboolean bChildPosDone = GL_FALSE, bChildSizeDone = GL_FALSE; void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY ); void Redisplay(); -void Reshape(int x, int y); +void Reshape(int width, int height); +void Position(int x, int y); @@ -117,6 +118,7 @@ void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY ) glutKeyboardFunc( SampleKeyboard ); glutDisplayFunc( Redisplay ); glutReshapeFunc( Reshape ); + glutPositionFunc( Position ); } else { diff --git a/freeglut/freeglut/src/mswin/fg_main_mswin.c b/freeglut/freeglut/src/mswin/fg_main_mswin.c index 981acad..3ecde1f 100644 --- a/freeglut/freeglut/src/mswin/fg_main_mswin.c +++ b/freeglut/freeglut/src/mswin/fg_main_mswin.c @@ -432,6 +432,18 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, SFG_Window* saved_window = fgStructure.CurrentWindow; RECT windowRect; GetWindowRect( window->Window.Handle, &windowRect ); + + if (window->Parent) + { + /* For child window, we should return relative to upper-left + * of parent's client area. + */ + POINT topleft = {windowRect.left,windowRect.top}; + + ScreenToClient(window->Parent->Window.Handle,&topleft); + windowRect.left = topleft.x; + windowRect.top = topleft.y; + } INVOKE_WCB( *window, Position, ( windowRect.left, windowRect.top ) ); fgSetWindow(saved_window);