From 23613f66511be15d205d5bd7bb49883ad8c66624 Mon Sep 17 00:00:00 2001 From: Jinrong Xie Date: Mon, 29 Jun 2015 10:09:42 +0000 Subject: [PATCH] update CMake file so that it will generate proper _WIN32_WINNT and WINVER definitions in visual studio project setting. (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 | 16 ++++++++++++++-- src/fg_spaceball.c | 33 ++++++++++++++++++++++++++++++--- src/mswin/fg_main_mswin.c | 6 ++++-- src/mswin/fg_spaceball_mswin.c | 4 ++++ 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34873c1..2467cd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/fg_spaceball.c b/src/fg_spaceball.c index 52d9841..16b0c52 100644 --- a/src/fg_spaceball.c +++ b/src/fg_spaceball.c @@ -7,9 +7,12 @@ * magellan X-based protocol. */ + #include #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 diff --git a/src/mswin/fg_main_mswin.c b/src/mswin/fg_main_mswin.c index 17d00e1..20a635b 100644 --- a/src/mswin/fg_main_mswin.c +++ b/src/mswin/fg_main_mswin.c @@ -1543,14 +1543,16 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR break; } #endif - //Added by Jinrong Xie 12/24/2014 - //for SpaceNavigator support on Windows. + +#ifdef WM_INPUT case WM_INPUT: + /* Added by Jinrong Xie 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 ); diff --git a/src/mswin/fg_spaceball_mswin.c b/src/mswin/fg_spaceball_mswin.c index f9bad24..84d848d 100644 --- a/src/mswin/fg_spaceball_mswin.c +++ b/src/mswin/fg_spaceball_mswin.c @@ -36,6 +36,8 @@ * six degree of freedom navigator. */ +#if(_WIN32_WINNT >= 0x0501) + #include #include #include "../fg_internal.h" @@ -190,3 +192,5 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam) } } } + +#endif \ No newline at end of file -- 1.7.10.4