now providing new position of child relative to parent in the position
callback also need to set position func for the child window in the resizer demo git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1480 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
9db85cd9b3
commit
409ca5b133
@ -12,7 +12,8 @@ GLboolean bChildPosDone = GL_FALSE, bChildSizeDone = GL_FALSE;
|
|||||||
|
|
||||||
void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY );
|
void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY );
|
||||||
void Redisplay();
|
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 );
|
glutKeyboardFunc( SampleKeyboard );
|
||||||
glutDisplayFunc( Redisplay );
|
glutDisplayFunc( Redisplay );
|
||||||
glutReshapeFunc( Reshape );
|
glutReshapeFunc( Reshape );
|
||||||
|
glutPositionFunc( Position );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -432,6 +432,18 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
|||||||
SFG_Window* saved_window = fgStructure.CurrentWindow;
|
SFG_Window* saved_window = fgStructure.CurrentWindow;
|
||||||
RECT windowRect;
|
RECT windowRect;
|
||||||
GetWindowRect( window->Window.Handle, &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 ) );
|
INVOKE_WCB( *window, Position, ( windowRect.left, windowRect.top ) );
|
||||||
fgSetWindow(saved_window);
|
fgSetWindow(saved_window);
|
||||||
|
Reference in New Issue
Block a user