X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_menu.c;h=a0b544c8f487be4e3d2935bb06bcec144f0d502d;hb=3515ebeb3424bf675a8a10f04b61fb6924775e0c;hp=3fdc342dc89bba9d9f81d6f1169e86cc4748f5e0;hpb=7c8806280d824b872cb97a684172ed3531c5ed11;p=freeglut diff --git a/src/freeglut_menu.c b/src/freeglut_menu.c index 3fdc342..a0b544c 100644 --- a/src/freeglut_menu.c +++ b/src/freeglut_menu.c @@ -215,6 +215,14 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) menuEntry->SubMenu->X = menu->X + menu->Width ; menuEntry->SubMenu->Y = menu->Y + menuEntry->Ordinal * FREEGLUT_MENU_HEIGHT ; + if ( menuEntry->SubMenu->X + menuEntry->SubMenu->Width > glutGet ( +GLUT_SCREEN_WIDTH ) ) + menuEntry->SubMenu->X = menu->X - menuEntry->SubMenu->Width ; + + if ( menuEntry->SubMenu->Y + menuEntry->SubMenu->Height > glutGet ( +GLUT_SCREEN_HEIGHT ) ) + menuEntry->SubMenu->Y -=menuEntry->SubMenu->Height ; + fgSetWindow ( menuEntry->SubMenu->Window ) ; glutPositionWindow ( menuEntry->SubMenu->X, menuEntry->SubMenu->Y ) ; glutReshapeWindow ( menuEntry->SubMenu->Width, menuEntry->SubMenu->Height ) ; @@ -513,6 +521,12 @@ void fgActivateMenu( SFG_Window* window, int button ) menu->X = window->State.MouseX + glutGet ( GLUT_WINDOW_X ) ; menu->Y = window->State.MouseY + glutGet ( GLUT_WINDOW_Y ) ; + if ( menu->X + menu->Width > glutGet ( GLUT_SCREEN_WIDTH ) ) + menu->X -=menu->Width ; + + if ( menu->Y + menu->Height > glutGet ( GLUT_SCREEN_HEIGHT ) ) + menu->Y -=menu->Height ; + fgSetWindow ( menu->Window ) ; glutPositionWindow ( menu->X, menu->Y ) ; glutReshapeWindow ( menu->Width, menu->Height ) ; @@ -520,10 +534,6 @@ void fgActivateMenu( SFG_Window* window, int button ) glutShowWindow () ; menu->Window->ActiveMenu = menu ; -/* if( x > ( glutGet( GLUT_WINDOW_WIDTH ) - menu->Width ) ) - menu->X = glutGet( GLUT_WINDOW_WIDTH ) - menu->Width; - if( y > ( glutGet( GLUT_WINDOW_HEIGHT ) - menu->Height) ) - menu->Y = glutGet( GLUT_WINDOW_HEIGHT ) - menu->Height; */ } /* @@ -628,7 +638,7 @@ void fgDeactivateMenu( SFG_Window *window ) /* * Is that an active submenu by any case? */ - if ( ( menuEntry->SubMenu != NULL ) && menuEntry->SubMenu->IsActive ) + if ( menuEntry->SubMenu != NULL ) fgDeactivateSubMenu ( menuEntry ) ; } @@ -663,7 +673,7 @@ void fgDeactivateSubMenu( SFG_MenuEntry *menuEntry ) /* * Is that an active submenu by any case? */ - if ( ( subMenuIter->SubMenu != NULL ) && subMenuIter->SubMenu->IsActive ) + if ( subMenuIter->SubMenu != NULL ) fgDeactivateSubMenu ( subMenuIter ) ; }