Minor fix on indentation.
[freeglut] / src / mswin / fg_spaceball_mswin.c
index 4d96c31..09f6a96 100644 (file)
@@ -10,7 +10,7 @@
  * Copyright (c) 2014 Jinrong Xie. All Rights Reserved.
  * Written by Jinrong Xie <stonexjr at gmail.com>
  * Modification date: Wed Dec 24, 2014
-
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
@@ -30,6 +30,8 @@
  */
 
 /*
+ * Modified by Jinrong Xie (stonexjr@gmail.com) 12/24/2014
+ * for Space Navigator support on Windows.
  * This code is enhanced by at least supporting 3Dconnexion's 
  * six degree of freedom navigator.
  */
@@ -51,7 +53,7 @@ RAWINPUTDEVICE __fgSpaceball = { 0x01, 0x08, 0x00, 0x00 };
 void fgPlatformInitializeSpaceball(void)
 {
        HWND hwnd;
-    sball_initialized = 1;
+       sball_initialized = 1;
        if (!fgStructure.CurrentWindow)
        {
                sball_initialized = 0;
@@ -68,8 +70,6 @@ void fgPlatformInitializeSpaceball(void)
                __fgSpaceball.hwndTarget = NULL;
                sball_initialized = 0;
        }
-
-       return;
 }
 
 void fgPlatformSpaceballClose(void)
@@ -94,6 +94,7 @@ void fgPlatformSpaceballSetWindow(SFG_Window *window)
 
 int fgIsSpaceballWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
+       return 0;
 }
 
 void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
@@ -101,7 +102,6 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
        #define LOGITECH_VENDOR_ID 0x46d
        HRAWINPUT hRawInput = (HRAWINPUT)lParam;
        UINT inputCode = (UINT)wParam;
-       RAWINPUTHEADER hdr;
        UINT size;
        BYTE *rawInputBuffer;
        PRAWINPUT pRawInput;
@@ -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.
                // the one used in OpenGL
                if (pRawInput->data.hid.bRawData[0] == 
-                       SPNAV_EVENT_MOTION_TRANSLATION)//0x01)
+                       SPNAV_EVENT_MOTION_TRANSLATION)
                { // Translation vector
                        short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
                        short X =  pnData[0];
@@ -157,7 +157,7 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
                        INVOKE_WCB(*window, SpaceMotion, (X, Y, Z));
                }
                else if (pRawInput->data.hid.bRawData[0] == 
-                               SPNAV_EVENT_MOTION_ROTATION)//0x02)
+                               SPNAV_EVENT_MOTION_ROTATION)
                { // Axis aligned rotation vector
                        short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
                        short rX =  pnData[0];
@@ -166,7 +166,7 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
                        INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ));
                }
                else if (pRawInput->data.hid.bRawData[0] == 
-                                SPNAV_EVENT_BUTTON)//0x03)
+                                SPNAV_EVENT_BUTTON)
                { // State of the keys
                        unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]);
                        unsigned int state = GLUT_UP;
@@ -188,4 +188,4 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
                        __fgSpaceKeystate = dwKeystate;
                }
        }
-}
\ No newline at end of file
+}