update CMake file so that it will generate proper _WIN32_WINNT and WINVER definitions in visual studio project setting.

(cherry picked from commit 96e89316b6)

(cherry picked from commit 96e89316b6)

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1766 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2015-06-29 10:09:42 +00:00
parent 5259e6156b
commit e595297daf
4 changed files with 52 additions and 7 deletions

View File

@ -273,9 +273,21 @@ IF(WIN32)
SET( CMAKE_DEBUG_POSTFIX "d" ) SET( CMAKE_DEBUG_POSTFIX "d" )
ENDIF(MSVC) 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) # enable the use of Win2000 APIs (needed for really old compilers like MSVC6)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500) ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)
ADD_DEFINITIONS(-DWINVER=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() ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCC)

View File

@ -7,9 +7,12 @@
* magellan X-based protocol. * magellan X-based protocol.
*/ */
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "fg_internal.h" #include "fg_internal.h"
#if(_WIN32_WINNT >= 0x0501)
/* -- PRIVATE FUNCTIONS --------------------------------------------------- */ /* -- PRIVATE FUNCTIONS --------------------------------------------------- */
extern void fgPlatformInitializeSpaceball(void); extern void fgPlatformInitializeSpaceball(void);
@ -28,13 +31,12 @@ void fgInitialiseSpaceball(void)
} }
fgPlatformInitializeSpaceball(); fgPlatformInitializeSpaceball();
//sball_initialized = 1;
} }
void fgSpaceballClose(void) void fgSpaceballClose(void)
{ {
fgPlatformSpaceballClose();} fgPlatformSpaceballClose();
}
int fgHasSpaceball(void) int fgHasSpaceball(void)
{ {
@ -74,3 +76,28 @@ void fgSpaceballSetWindow(SFG_Window *window)
fgPlatformSpaceballSetWindow(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

View File

@ -1543,14 +1543,16 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
break; break;
} }
#endif #endif
//Added by Jinrong Xie <stonexjr at gmail.com> 12/24/2014
//for SpaceNavigator support on Windows. #ifdef WM_INPUT
case WM_INPUT: case WM_INPUT:
/* Added by Jinrong Xie <stonexjr at gmail.com> for SpaceNavigator support on Windows. Dec 2014 */
if (fgHasSpaceball()) if (fgHasSpaceball())
{ {
fgSpaceballHandleWinEvent(hWnd, wParam, lParam); fgSpaceballHandleWinEvent(hWnd, wParam, lParam);
} }
break; break;
#endif
default: default:
/* Handle unhandled messages */ /* Handle unhandled messages */
lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );

View File

@ -36,6 +36,8 @@
* six degree of freedom navigator. * six degree of freedom navigator.
*/ */
#if(_WIN32_WINNT >= 0x0501)
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include <stdlib.h> #include <stdlib.h>
#include "../fg_internal.h" #include "../fg_internal.h"
@ -190,3 +192,5 @@ void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
} }
} }
#endif