From 2e8b31927ee505cbfe6bb84c5a64e4fc3c45db8c Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Tue, 3 Feb 2009 21:08:11 +0000 Subject: [PATCH] Removing some errant tabs, fixing ticket #2137721, and adding special-key capability to recognizing the NumLock, Delete, and keypad '5' keys git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@764 7f0cb862-5218-0410-a997-914c9d46530a --- include/GL/freeglut_ext.h | 7 +++++++ src/freeglut_main.c | 14 +++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/GL/freeglut_ext.h b/include/GL/freeglut_ext.h index 7dae3e9..27c6f06 100644 --- a/include/GL/freeglut_ext.h +++ b/include/GL/freeglut_ext.h @@ -33,6 +33,13 @@ #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 */ #define GLUT_ACTION_EXIT 0 diff --git a/src/freeglut_main.c b/src/freeglut_main.c index e47bd8a..dd83de8 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -1159,15 +1159,15 @@ void FGAPIENTRY glutMainLoopEvent( void ) * XXX track ButtonPress/ButtonRelease events in our own * XXX bit-mask? */ - fgState.Modifiers = fghGetXModifiers( event.xmotion.state ); + fgState.Modifiers = fghGetXModifiers( event.xmotion.state ); if ( event.xmotion.state & ( Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) ) { INVOKE_WCB( *window, Motion, ( event.xmotion.x, event.xmotion.y ) ); } else { INVOKE_WCB( *window, Passive, ( event.xmotion.x, event.xmotion.y ) ); - } - fgState.Modifiers = INVALID_MODIFIERS; + } + fgState.Modifiers = INVALID_MODIFIERS; } break; @@ -1356,9 +1356,13 @@ void FGAPIENTRY glutMainLoopEvent( void ) case XK_F11: special = GLUT_KEY_F11; break; case XK_F12: special = GLUT_KEY_F12; break; + case XK_KP_Left: case XK_Left: special = GLUT_KEY_LEFT; break; + case XK_KP_Right: case XK_Right: special = GLUT_KEY_RIGHT; break; + case XK_KP_Up: case XK_Up: special = GLUT_KEY_UP; break; + case XK_KP_Down: case XK_Down: special = GLUT_KEY_DOWN; break; case XK_KP_Prior: @@ -1371,6 +1375,10 @@ void FGAPIENTRY glutMainLoopEvent( void ) case XK_End: special = GLUT_KEY_END; break; case XK_KP_Insert: 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; } /* -- 1.7.10.4