update CMake file so that it will generate proper _WIN32_WINNT and WINVER definitions...
authorJinrong Xie <jrxie@ucdavis.edu>
Mon, 29 Jun 2015 10:09:42 +0000 (10:09 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Mon, 29 Jun 2015 10:09:42 +0000 (10:09 +0000)
(cherry picked from commit 96e89316b6de6502522f1527b0e132e731af175a)

(cherry picked from commit 96e89316b6de6502522f1527b0e132e731af175a)

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1766 7f0cb862-5218-0410-a997-914c9d46530a

CMakeLists.txt
src/fg_spaceball.c
src/mswin/fg_main_mswin.c
src/mswin/fg_spaceball_mswin.c

index 34873c1..2467cd4 100644 (file)
@@ -273,9 +273,21 @@ IF(WIN32)
         SET( CMAKE_DEBUG_POSTFIX "d" )
     ENDIF(MSVC)
     
+    IF(NOT(MSVC_VERSION LESS "1300"))
+    # minimum requirement for spaceball device
+        ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
+        ADD_DEFINITIONS(-DWINVER=0x0501)
+    ELSE()
     # enable the use of Win2000 APIs (needed for really old compilers like MSVC6)
-    ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)
-    ADD_DEFINITIONS(-DWINVER=0x0500)
+        ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)
+        ADD_DEFINITIONS(-DWINVER=0x0500)
+    ENDIF()
+
+    IF(NOT(MSVC_VERSION LESS "1600"))
+    # minimum requirement for WM_TOUCH device
+        ADD_DEFINITIONS(-D_WIN32_WINNT=0x0601)
+        ADD_DEFINITIONS(-DWINVER=0x0601)
+    ENDIF()
 ENDIF()
 
 IF(CMAKE_COMPILER_IS_GNUCC)
index 52d9841..16b0c52 100644 (file)
@@ -7,9 +7,12 @@
  * magellan X-based protocol.
  */
 
+
 #include <GL/freeglut.h>
 #include "fg_internal.h"
 
+#if(_WIN32_WINNT >= 0x0501)
+
 /* -- PRIVATE FUNCTIONS --------------------------------------------------- */
 
 extern void fgPlatformInitializeSpaceball(void);
@@ -28,13 +31,12 @@ void fgInitialiseSpaceball(void)
     }
 
     fgPlatformInitializeSpaceball();
-
-    //sball_initialized = 1;
 }
 
 void fgSpaceballClose(void)
 {
-       fgPlatformSpaceballClose();}
+       fgPlatformSpaceballClose();
+}
 
 int fgHasSpaceball(void)
 {
@@ -74,3 +76,28 @@ void fgSpaceballSetWindow(SFG_Window *window)
     fgPlatformSpaceballSetWindow(window);
 }
 
+#else
+
+void fgInitialiseSpaceball(void)
+{
+}
+
+void fgSpaceballClose(void)
+{
+}
+
+int fgHasSpaceball(void)
+{
+       return 0;
+}
+
+int fgSpaceballNumButtons(void)
+{
+       return 0;
+}
+
+void fgSpaceballSetWindow(SFG_Window *window)
+{
+}
+
+#endif
index 17d00e1..20a635b 100644 (file)
@@ -1543,14 +1543,16 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
                break;
        }
 #endif
-       //Added by Jinrong Xie <stonexjr at gmail.com> 12/24/2014
-       //for SpaceNavigator support on Windows.
+
+#ifdef WM_INPUT
        case WM_INPUT:
+        /* Added by Jinrong Xie <stonexjr at gmail.com> for SpaceNavigator support on Windows. Dec 2014 */
                if (fgHasSpaceball())
                {
                        fgSpaceballHandleWinEvent(hWnd, wParam, lParam);
                }
                break;
+#endif
     default:
         /* Handle unhandled messages */
         lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
index f9bad24..84d848d 100644 (file)
@@ -36,6 +36,8 @@
  * six degree of freedom navigator.
  */
 
+#if(_WIN32_WINNT >= 0x0501)
+
 #include <GL/freeglut.h>
 #include <stdlib.h>
 #include "../fg_internal.h"
@@ -190,3 +192,5 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
                }
        }
 }
+
+#endif
\ No newline at end of file