minor update making code more compact.

(cherry picked from commit 09f4017618)

(cherry picked from commit 09f4017618)

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1761 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2015-06-29 10:09:06 +00:00
parent b593d219d6
commit 949f7b3747
2 changed files with 7 additions and 9 deletions

View File

@ -1545,13 +1545,11 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
#endif #endif
//Added by Jinrong Xie (stonexjr@gmail.com) 12/24/2014 //Added by Jinrong Xie (stonexjr@gmail.com) 12/24/2014
//for SpaceNavigator support on Windows. //for SpaceNavigator support on Windows.
/*
case WM_ACTIVATEAPP:
fgInitialiseSpaceball();
break;
*/
case WM_INPUT: case WM_INPUT:
fgSpaceballHandleWinEvent(hWnd, wParam, lParam); if (fgHasSpaceball())
{
fgSpaceballHandleWinEvent(hWnd, wParam, lParam);
}
break; break;
default: default:
/* Handle unhandled messages */ /* Handle unhandled messages */

View File

@ -148,7 +148,7 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
// X goes right, Y goes up and Z goes towards viewer, e.g. // X goes right, Y goes up and Z goes towards viewer, e.g.
// the one used in OpenGL // the one used in OpenGL
if (pRawInput->data.hid.bRawData[0] == if (pRawInput->data.hid.bRawData[0] ==
SPNAV_EVENT_MOTION_TRANSLATION)//0x01) SPNAV_EVENT_MOTION_TRANSLATION)
{ // Translation vector { // Translation vector
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]); short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
short X = pnData[0]; short X = pnData[0];
@ -157,7 +157,7 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
INVOKE_WCB(*window, SpaceMotion, (X, Y, Z)); INVOKE_WCB(*window, SpaceMotion, (X, Y, Z));
} }
else if (pRawInput->data.hid.bRawData[0] == else if (pRawInput->data.hid.bRawData[0] ==
SPNAV_EVENT_MOTION_ROTATION)//0x02) SPNAV_EVENT_MOTION_ROTATION)
{ // Axis aligned rotation vector { // Axis aligned rotation vector
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]); short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
short rX = pnData[0]; short rX = pnData[0];
@ -166,7 +166,7 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ)); INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ));
} }
else if (pRawInput->data.hid.bRawData[0] == else if (pRawInput->data.hid.bRawData[0] ==
SPNAV_EVENT_BUTTON)//0x03) SPNAV_EVENT_BUTTON)
{ // State of the keys { // State of the keys
unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]); unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]);
unsigned int state = GLUT_UP; unsigned int state = GLUT_UP;