Removing some errant tabs, fixing ticket #2137721, and adding special-key capability to recognizing the NumLock, Delete, and keypad '5' keys

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@764 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
fayjf 2009-02-03 21:08:11 +00:00
parent 6ad88aa884
commit 6633fd32ac
2 changed files with 18 additions and 3 deletions

View File

@ -32,6 +32,13 @@
extern "C" { extern "C" {
#endif #endif
/*
* Additional GLUT Key definitions for the Special key function
*/
#define GLUT_KEY_NUM_LOCK 0x006D
#define GLUT_KEY_BEGIN 0x006E
#define GLUT_KEY_DELETE 0x006F
/* /*
* GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window * GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window
*/ */

View File

@ -1159,15 +1159,15 @@ void FGAPIENTRY glutMainLoopEvent( void )
* XXX track ButtonPress/ButtonRelease events in our own * XXX track ButtonPress/ButtonRelease events in our own
* XXX bit-mask? * XXX bit-mask?
*/ */
fgState.Modifiers = fghGetXModifiers( event.xmotion.state ); fgState.Modifiers = fghGetXModifiers( event.xmotion.state );
if ( event.xmotion.state & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) ) { if ( event.xmotion.state & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) ) {
INVOKE_WCB( *window, Motion, ( event.xmotion.x, INVOKE_WCB( *window, Motion, ( event.xmotion.x,
event.xmotion.y ) ); event.xmotion.y ) );
} else { } else {
INVOKE_WCB( *window, Passive, ( event.xmotion.x, INVOKE_WCB( *window, Passive, ( event.xmotion.x,
event.xmotion.y ) ); event.xmotion.y ) );
} }
fgState.Modifiers = INVALID_MODIFIERS; fgState.Modifiers = INVALID_MODIFIERS;
} }
break; break;
@ -1356,9 +1356,13 @@ void FGAPIENTRY glutMainLoopEvent( void )
case XK_F11: special = GLUT_KEY_F11; break; case XK_F11: special = GLUT_KEY_F11; break;
case XK_F12: special = GLUT_KEY_F12; break; case XK_F12: special = GLUT_KEY_F12; break;
case XK_KP_Left:
case XK_Left: special = GLUT_KEY_LEFT; break; case XK_Left: special = GLUT_KEY_LEFT; break;
case XK_KP_Right:
case XK_Right: special = GLUT_KEY_RIGHT; break; case XK_Right: special = GLUT_KEY_RIGHT; break;
case XK_KP_Up:
case XK_Up: special = GLUT_KEY_UP; break; case XK_Up: special = GLUT_KEY_UP; break;
case XK_KP_Down:
case XK_Down: special = GLUT_KEY_DOWN; break; case XK_Down: special = GLUT_KEY_DOWN; break;
case XK_KP_Prior: case XK_KP_Prior:
@ -1371,6 +1375,10 @@ void FGAPIENTRY glutMainLoopEvent( void )
case XK_End: special = GLUT_KEY_END; break; case XK_End: special = GLUT_KEY_END; break;
case XK_KP_Insert: case XK_KP_Insert:
case XK_Insert: special = GLUT_KEY_INSERT; break; case XK_Insert: special = GLUT_KEY_INSERT; break;
case XK_Num_Lock : special = GLUT_KEY_NUM_LOCK; break;
case XK_KP_Begin : special = GLUT_KEY_BEGIN; break;
case XK_KP_Delete: special = GLUT_KEY_DELETE; break;
} }
/* /*