Tweaking for menu behavior in Linux regarding mouse whatnot - John Fay
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@212 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
400a9b3d11
commit
c209cc5479
@ -322,5 +322,12 @@ October 24, 2002:
|
||||
|
||||
(110) Fixed compiliation of freeglut_joystick.c on FreeBSD
|
||||
|
||||
*******************************************************************************************
|
||||
* Freeglut 2.0.0 Released on September 29, 2003!
|
||||
*******************************************************************************************
|
||||
|
||||
*******************************************************************************************
|
||||
* Changes on October 3, 2003
|
||||
*******************************************************************************************
|
||||
|
||||
(110) Tweaking for the menu behavior on Linux regarding mice, etc. - John Fay
|
||||
|
@ -752,17 +752,23 @@ void FGAPIENTRY glutMainLoopEvent( void )
|
||||
*/
|
||||
if( window->ActiveMenu != NULL )
|
||||
{
|
||||
if ( window == window->ActiveMenu->ParentWindow )
|
||||
{
|
||||
window->ActiveMenu->Window->State.MouseX = event.xmotion.x_root - window->ActiveMenu->X ;
|
||||
window->ActiveMenu->Window->State.MouseY = event.xmotion.y_root - window->ActiveMenu->Y ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Let's make the window redraw as a result of the mouse motion.
|
||||
*/
|
||||
window->State.Redisplay = TRUE ;
|
||||
window->ActiveMenu->Window->State.Redisplay = TRUE ;
|
||||
|
||||
/*
|
||||
* Since the window is a menu, make the parent window current
|
||||
*/
|
||||
fgSetWindow ( window->ActiveMenu->ParentWindow ) ;
|
||||
|
||||
break;
|
||||
break; /* I think this should stay in -- an active menu should absorb the mouse motion */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -847,7 +853,13 @@ void FGAPIENTRY glutMainLoopEvent( void )
|
||||
*/
|
||||
if ( window->ActiveMenu != NULL ) /* Window has an active menu, it absorbs any mouse click */
|
||||
{
|
||||
if ( fgCheckActiveMenu ( window, window->ActiveMenu ) == TRUE ) /* Inside the menu, invoke the callback and deactivate the menu*/
|
||||
if ( window == window->ActiveMenu->ParentWindow )
|
||||
{
|
||||
window->ActiveMenu->Window->State.MouseX = event.xbutton.x_root - window->ActiveMenu->X ;
|
||||
window->ActiveMenu->Window->State.MouseY = event.xbutton.y_root - window->ActiveMenu->Y ;
|
||||
}
|
||||
|
||||
if ( fgCheckActiveMenu ( window->ActiveMenu->Window, window->ActiveMenu ) == TRUE ) /* Inside the menu, invoke the callback and deactivate the menu*/
|
||||
{
|
||||
/* Save the current window and menu and set the current window to the window whose menu this is */
|
||||
SFG_Window *save_window = fgStructure.Window ;
|
||||
|
@ -273,6 +273,7 @@ void fgCloseWindows ()
|
||||
void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
|
||||
{
|
||||
SFG_Window* subWindow;
|
||||
int menu_index ;
|
||||
|
||||
assert( window != NULL );
|
||||
freeglut_assert_ready;
|
||||
@ -309,6 +310,15 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
|
||||
else
|
||||
fgListRemove( &fgStructure.Windows, &window->Node );
|
||||
|
||||
if ( window->ActiveMenu != NULL )
|
||||
fgDeactivateMenu ( window ) ;
|
||||
|
||||
for ( menu_index = 0; menu_index < 3; menu_index ++ )
|
||||
{
|
||||
if ( window->Menu[menu_index] != NULL )
|
||||
window->Menu[menu_index]->ParentWindow = NULL ;
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, this window seems disconnected from the structure enough
|
||||
* in order to be closed without any bigger risks...
|
||||
|
Reference in New Issue
Block a user