cleaning up mixed tabs and spaces

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1840 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2018-03-26 20:32:31 +00:00
parent a2fef0a9bb
commit b8a9827c5b
16 changed files with 218 additions and 218 deletions

View File

@ -82,7 +82,7 @@ FGAPI void FGAPIENTRY glutInitWarningFuncUcall( void (* callback)( const char *f
FGAPI void FGAPIENTRY glutInitContextFuncUcall( void (* callback)( void* ), void* user_data );
FGAPI void FGAPIENTRY glutAppStatusFuncUcall( void (* callback)( int, void* ), void* user_data );
/*
/*
* Continued "hack" from GLUT applied to Ucall functions.
* For more info, see bottom of freeglut_std.h
*/

View File

@ -5,10 +5,10 @@
in OpenGLUT. It may also be useful to see which
parameters control what behavior in the OpenGLUT
objects.
Spinning wireframe and solid-shaded shapes are
displayed. Some parameters can be adjusted.
Keys:
- <tt>Esc &nbsp;</tt> Quit
- <tt>q Q &nbsp;</tt> Quit
@ -34,7 +34,7 @@
\author Portions Copyright (C) 2004, the OpenGLUT project contributors. <br>
OpenGLUT branched from freeglut in February, 2004.
\image html openglut_shapes.png OpenGLUT Geometric Shapes Demonstration
\include demos/shapes/shapes.c
*/
@ -63,7 +63,7 @@ void checkError(const char *functionName)
}
/*
* OpenGL 2+ shader mode needs some function and macro definitions,
* OpenGL 2+ shader mode needs some function and macro definitions,
* avoiding a dependency on additional libraries like GLEW or the
* GL/glext.h header
*/
@ -283,10 +283,10 @@ GLint getAttribOrUniformLocation(const char* name, GLuint program, GLboolean isA
GLint attrib = gl_GetAttribLocation(program, name);
if (attrib == -1)
{
fprintf(stderr, "Warning: Could not bind attrib %s\n", name);
fprintf(stderr, "Warning: Could not bind attrib %s\n", name);
}
checkError ("getAttribOrUniformLocation");
checkError ("getAttribOrUniformLocation");
return attrib;
}
else
@ -294,16 +294,16 @@ GLint getAttribOrUniformLocation(const char* name, GLuint program, GLboolean isA
GLint uniform = gl_GetUniformLocation(program, name);
if (uniform == -1)
{
fprintf(stderr, "Warning: Could not bind uniform %s\n", name);
fprintf(stderr, "Warning: Could not bind uniform %s\n", name);
}
checkError ("getAttribOrUniformLocation");
checkError ("getAttribOrUniformLocation");
return uniform;
}
}
GLuint program;
GLint attribute_fg_coord = -1, attribute_fg_normal = -1;
GLint attribute_fg_coord = -1, attribute_fg_normal = -1;
GLint uniform_m = -1, uniform_p = -1, uniform_m_3x3_inv_transp = -1;
GLint shaderReady = 0; /* Set to 1 when all initialization went well, to -1 when shader somehow unusable. */
@ -800,10 +800,10 @@ key(unsigned char key, int x, int y)
case '.':
case '>': stacks++; break;
case '9':
case '9':
case '(': if( depth > -1 ) depth--; break;
case '0':
case '0':
case ')': ++depth; break;
case 'P':

View File

@ -39,11 +39,11 @@
/* What supports variadic macros based off Wikipedia article on it (GCC-like must support C99 or higher to use variadic macros) */
#if (((defined(__GNUC__) && (__GNUC__ >= 3)) || \
(defined(__clang__))) && \
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) || \
(defined(_MSC_VER) && (_MSC_VER >= 1400)) || \
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x570)) || \
(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x530))
(defined(__clang__))) && \
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) || \
(defined(_MSC_VER) && (_MSC_VER >= 1400)) || \
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x570)) || \
(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x530))
#define FG_COMPILER_SUPPORTS_VA_ARGS 1
#else
#define FG_COMPILER_SUPPORTS_VA_ARGS 0
@ -58,7 +58,7 @@
*
* This took a while to figure out, so be sure try to understand what is happening so that you can ensure that whatever you
* change won't break other areas.
*
*
* If you are just adding a new callback/changing it's argument count, just go to the bottom of the file.
*
* This whole file exists purely for the sake of preventing the need to implement additional parsing logic for each callback
@ -70,26 +70,26 @@
* then the GCC macro, so maybe it's good to stay as is.
*
* Onto the different "versions" of macros:
*
* The first is for any compiler that supports C99 by default. It requires each callback to have a specific argument count
* passthrough macro. The only reason there are specific count macros is so that (see paraghraph below) don't need have their own
* set of callback macros. Ideally, there would only be ZERO and ONE_OR_MORE. This works by having callback-specific macros call a
* specific handler macro to return user data (ZERO) or return one or more arguments along with userData (ONE_OR_MORE) where, with
*
* The first is for any compiler that supports C99 by default. It requires each callback to have a specific argument count
* passthrough macro. The only reason there are specific count macros is so that (see paraghraph below) don't need have their own
* set of callback macros. Ideally, there would only be ZERO and ONE_OR_MORE. This works by having callback-specific macros call a
* specific handler macro to return user data (ZERO) or return one or more arguments along with userData (ONE_OR_MORE) where, with
* variadic macros, it just reuses the arguments.
*
* The last macro set is for the poor individual who has to use a compiler that doesn't support C99 by default, or may not support
* it at all. Stuff like MSVC6... It works by having a specific-count macro that "extracts" each argument to have them reused without
* The last macro set is for the poor individual who has to use a compiler that doesn't support C99 by default, or may not support
* it at all. Stuff like MSVC6... It works by having a specific-count macro that "extracts" each argument to have them reused without
* the parathesis.
*
* There is a 3rd macro set that only worked on GCC/Clang, and thus was removed (last seen in revision e9676fc of the GIT mirror.
* There is a 3rd macro set that only worked on GCC/Clang, and thus was removed (last seen in revision e9676fc of the GIT mirror.
* Not sure at this time what the SVN number is.) as it's a non-standard functionality.
*/
/*
* EXPAND_WCB() is used as:
*
*
* EXPAND_WCB( cbname )(( arg_list, userData ))
*
*
* ... where {(arg_list)} is the parameter list and userData is user
* provided data.
*
@ -140,7 +140,7 @@
#define EXPAND_WCB(cbname) EXPAND_WCB_SUB_ ## cbname
/*
/*
* Freeglut callbacks type definitions macros
*
* Every time a callback is updated in fg_internal.h is updated, this needs updated
@ -261,8 +261,8 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
}
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b) \
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT_UCALL(a,b) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT_UCALL(a,b) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
/*
* Combine _glut and _cb macros:
@ -276,20 +276,20 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b)
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0(a) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,a) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,a) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0_2NAME(a,b) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,b) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,b) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG1(a) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a)
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG1(a) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG2(a) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
@ -300,12 +300,12 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b)
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2(a) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2_2NAME(a,b) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,b) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,b) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG3(a) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
@ -316,12 +316,12 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a)
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3(a) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3_2NAME(a,b) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,b) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,b) \
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG4(a) \
IMPLEMENT_CALLBACK_FUNC_CB_ARG4(a,a) \

View File

@ -42,10 +42,10 @@ void FGAPIENTRY glutPostRedisplay( void )
{
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPostRedisplay" );
if ( ! fgStructure.CurrentWindow )
{
{
fgError ( " ERROR: Function <%s> called"
" with no current window defined.", "glutPostRedisplay" ) ;
}
}
fgStructure.CurrentWindow->State.WorkMask |= GLUT_DISPLAY_WORK;
}

View File

@ -4,7 +4,7 @@
*/
/*
* This file has been automatically generated by the
* This file has been automatically generated by the
* genfonts utility.
*
* The legal status of this file is a bit vague. The font glyphs
@ -31,7 +31,7 @@
*
* Copyright (c) 1999-2000 by Pawel W. Olszta
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
*
*
* 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
@ -55,7 +55,7 @@
/*
* The following bitmapped fonts are defined in this file:
*
*
* 1. fgFontFixed8x13
* -misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1
* 2. fgFontFixed9x15

View File

@ -111,7 +111,7 @@ void fgInitialiseInputDevices ( void )
{
const char *dial_device=NULL;
dial_device = getenv ( "GLUT_DIALS_SERIAL" );
fgPlatformRegisterDialDevice ( dial_device );
fgPlatformRegisterDialDevice ( dial_device );
if ( !dial_device ) return;
if ( !( dialbox_port = serial_open ( dial_device ) ) ) return;

View File

@ -214,7 +214,7 @@
/* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
/*
/*
* Freeglut callbacks type definitions
*
* If anything here is modified or added, update fg_callback_macros.h functions.
@ -392,7 +392,7 @@ struct tagSFG_State
int NumActiveJoysticks; /* Number of active joysticks (callback defined and positive pollrate) -- if zero, don't poll joysticks */
GLboolean InputDevsInitialised; /* Only initialize if application calls for them */
int MouseWheelTicks; /* Number of ticks the mouse wheel has turned */
int MouseWheelTicks; /* Number of ticks the mouse wheel has turned */
int AuxiliaryBufferNumber;/* Number of auxiliary buffers */
int SampleNumber; /* Number of samples per pixel */
@ -417,7 +417,7 @@ struct tagSFG_State
typedef struct tagSFG_Display SFG_Display;
struct tagSFG_Display
{
SFG_PlatformDisplay pDisplay;
SFG_PlatformDisplay pDisplay;
int ScreenWidth; /* The screen's width in pixels */
int ScreenHeight; /* The screen's height in pixels */
@ -447,7 +447,7 @@ struct tagSFG_Context
SFG_WindowHandleType Handle; /* The window's handle */
SFG_WindowContextType Context; /* The window's OpenGL/WGL context */
SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */
SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */
int DoubleBuffered; /* Treat the window as double-buffered */
@ -536,7 +536,7 @@ struct tagSFG_WindowState /* as per notes above, sizes always refer to the cli
int DesiredZOrder; /* desired window Z Order position */
fgDesiredVisibility DesiredVisibility;/* desired visibility (hidden, iconic, shown/normal) */
SFG_PlatformWindowState pWState; /* Window width/height (X11) or rectangle/style (Windows) from before a resize, and other stuff only needed on specific platforms */
SFG_PlatformWindowState pWState; /* Window width/height (X11) or rectangle/style (Windows) from before a resize, and other stuff only needed on specific platforms */
long JoystickPollRate; /* The joystick polling rate */
fg_time_t JoystickLastPoll; /* When the last poll happened */
@ -589,10 +589,10 @@ do \
(((window).CallBacks[WCB_ ## cbname]) = (SFG_Proc)(func)); \
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
} \
else if( FETCH_USER_DATA_WCB( window, cbname ) != udata ) \
{ \
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
} \
else if( FETCH_USER_DATA_WCB( window, cbname ) != udata ) \
{ \
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
} \
} while( 0 )
/*
@ -611,7 +611,7 @@ do \
/*
* FETCH_USER_DATA_WCB() is used as:
*
*
* FETCH_USER_DATA_WCB( window, cbname );
*
* ...where {window} is the freeglut window,
@ -626,9 +626,9 @@ do \
/*
* EXPAND_WCB() is used as:
*
*
* EXPAND_WCB( cbname )(( arg_list, userData ))
*
*
* ... where {(arg_list)} is the parameter list and userData is user
* provided data.
*
@ -655,7 +655,7 @@ do \
*
* callback( arg_list, userData );
*
* ...where userData is added to the arg_list, but the parentheses
* ...where userData is added to the arg_list, but the parentheses
* are REQUIRED in the {arg_list}.
*
* NOTE that it does a sanity-check and also sets the
@ -670,7 +670,7 @@ do \
FGCB ## cbname ## UC func = (FGCB ## cbname ## UC)(FETCH_WCB( window, cbname )); \
FGCBUserData userData = FETCH_USER_DATA_WCB( window, cbname ); \
fgSetWindow( &window ); \
func EXPAND_WCB( cbname )(( arg_list, userData )); \
func EXPAND_WCB( cbname )(( arg_list, userData )); \
} \
} while( 0 )
@ -945,7 +945,7 @@ struct tagSFG_PlatformJoystick
typedef struct tagSFG_Joystick SFG_Joystick;
struct tagSFG_Joystick
{
SFG_PlatformJoystick pJoystick;
SFG_PlatformJoystick pJoystick;
int id;
GLboolean error;

View File

@ -135,7 +135,7 @@ static void fghDeactivateSubMenu( SFG_MenuEntry *menuEntry )
static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y )
{
if( fgStructure.GameModeWindow )
fgPlatformGetGameModeVMaxExtent ( window, x, y );
fgPlatformGetGameModeVMaxExtent ( window, x, y );
else
{
*x = fgDisplay.ScreenWidth;
@ -784,10 +784,10 @@ int FGAPIENTRY glutCreateMenuUcall( FGCBMenuUC callback, FGCBUserData userData )
{
/* The menu object creation code resides in fg_structure.c */
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenuUcall" );
if (fgState.ActiveMenus)
{
fgError( "Menu manipulation not allowed while menus in use." );
}
if (fgState.ActiveMenus)
{
fgError( "Menu manipulation not allowed while menus in use." );
}
return fgCreateMenu( callback, userData )->ID;
}

View File

@ -35,7 +35,7 @@ void fgInitialiseSpaceball(void)
void fgSpaceballClose(void)
{
fgPlatformSpaceballClose();
fgPlatformSpaceballClose();
}
int fgHasSpaceball(void)
@ -88,12 +88,12 @@ void fgSpaceballClose(void)
int fgHasSpaceball(void)
{
return 0;
return 0;
}
int fgSpaceballNumButtons(void)
{
return 0;
return 0;
}
void fgSpaceballSetWindow(SFG_Window *window)

View File

@ -270,7 +270,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
case GLUT_NUM_DIALS:
if ( fgState.InputDevsInitialised ) return 8;
return 0;
case GLUT_NUM_BUTTON_BOX_BUTTONS:
return 0;
@ -293,7 +293,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
return fgState.KeyRepeat;
default:
return fgPlatformGlutDeviceGet ( eWhat );
return fgPlatformGlutDeviceGet ( eWhat );
}
}

View File

@ -83,7 +83,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
fgError( "Out of memory. Could not create window." );
}
fgPlatformCreateWindow ( window );
fgPlatformCreateWindow ( window );
fghClearCallBacks( window );
SET_WCB( *window, Reshape, fghDefaultReshape, NULL);
@ -183,10 +183,10 @@ void fgAddToWindowDestroyList( SFG_Window* window )
SET_WCB( *window, Destroy, destroy, destroyData );
}
/*
* Similarly, clear all work set for the window, none of this has to be executed anymore
*/
window->State.WorkMask = 0;
/*
* Similarly, clear all work set for the window, none of this has to be executed anymore
*/
window->State.WorkMask = 0;
}
/*

View File

@ -102,17 +102,17 @@ void fgPlatformInitialize( const char* displayName )
HDC context = CreateDC(fgDisplay.pDisplay.DisplayName,0,0,0);
if( context )
{
fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES );
fgDisplay.ScreenHeight = GetDeviceCaps( context, VERTRES );
fgDisplay.ScreenWidthMM = GetDeviceCaps( context, HORZSIZE );
fgDisplay.ScreenHeightMM = GetDeviceCaps( context, VERTSIZE );
DeleteDC(context);
fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES );
fgDisplay.ScreenHeight = GetDeviceCaps( context, VERTRES );
fgDisplay.ScreenWidthMM = GetDeviceCaps( context, HORZSIZE );
fgDisplay.ScreenHeightMM = GetDeviceCaps( context, VERTSIZE );
DeleteDC(context);
}
else
fgWarning("fgPlatformInitialize: "
"CreateDC failed, Screen size info may be incorrect\n"
fgWarning("fgPlatformInitialize: "
"CreateDC failed, Screen size info may be incorrect\n"
"This is quite likely caused by a bad '-display' parameter");
}
/* Set the timer granularity to 1 ms */
timeBeginPeriod ( 1 );
@ -142,7 +142,7 @@ void fgPlatformInitialize( const char* displayName )
void fgPlatformDeinitialiseInputDevices ( void )
{
#if !defined(_WIN32_WCE)
fghCloseInputDevices ();
fghCloseInputDevices ();
#endif /* !defined(_WIN32_WCE) */
fgState.JoysticksInitialised = GL_FALSE;
fgState.InputDevsInitialised = GL_FALSE;
@ -162,7 +162,7 @@ void fgPlatformCloseDisplay ( void )
void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext )
{
/* Do nothing -- this is required for X11 */
/* Do nothing -- this is required for X11 */
}
/* -- PLATFORM-SPECIFIC INTERFACE FUNCTION -------------------------------------------------- */

View File

@ -85,7 +85,7 @@ void fgPlatformCheckMenuDeactivate(HWND newFocusWnd)
/* window that got focus was not one of the active menus. That means we'll
* close the active menu's unless the window that got focus was their parent */
menu = fgGetActiveMenu();
if (newFocusWnd != menu->ParentWindow->Window.Handle)
{
/* focus shifted to another window than the menu's parent, close menus */
@ -108,6 +108,6 @@ int FGAPIENTRY __glutCreateMenuWithExit( void(* callback)( int ), void (__cdecl
int FGAPIENTRY __glutCreateMenuUcallWithExit(void(*callback)(int, void*), void(__cdecl *exit_function)(int), void* user_data)
{
__glutExitFunc = exit_function;
return glutCreateMenuUcall(callback, user_data);
__glutExitFunc = exit_function;
return glutCreateMenuUcall(callback, user_data);
}

View File

@ -2,7 +2,7 @@
* fg_spaceball_mswin.c
*
* Spaceball support for Windows
*
*
* Copyright (c) 2012 Stephen J. Baker. All Rights Reserved.
* Written by Evan Felix <karcaw at gmail.com>
* Creation date: Sat Feb 4, 2012
@ -32,7 +32,7 @@
/*
* Modified by Jinrong Xie <stonexjr at gmail.com> 12/24/2014
* for Space Navigator support on Windows.
* This code is enhanced by at least supporting 3Dconnexion's
* This code is enhanced by at least supporting 3Dconnexion's
* six degree of freedom navigator.
*/
@ -43,7 +43,7 @@
#include "../fg_internal.h"
enum {
SPNAV_EVENT_ANY,
SPNAV_EVENT_ANY,
SPNAV_EVENT_MOTION_TRANSLATION,
SPNAV_EVENT_MOTION_ROTATION,
SPNAV_EVENT_BUTTON /* includes both press and release */
@ -55,145 +55,145 @@ RAWINPUTDEVICE __fgSpaceball = { 0x01, 0x08, 0x00, 0x00 };
void fgPlatformInitializeSpaceball(void)
{
HWND hwnd;
sball_initialized = 1;
if (!fgStructure.CurrentWindow)
{
sball_initialized = 0;
return;
}
hwnd = fgStructure.CurrentWindow->Window.Handle;
HWND hwnd;
sball_initialized = 1;
if (!fgStructure.CurrentWindow)
{
sball_initialized = 0;
return;
}
hwnd = fgStructure.CurrentWindow->Window.Handle;
{
BOOL ok;
UINT cbSize = sizeof(__fgSpaceball);
__fgSpaceball.hwndTarget = hwnd;
ok = RegisterRawInputDevices(&__fgSpaceball, 1, cbSize);
{
BOOL ok;
UINT cbSize = sizeof(__fgSpaceball);
__fgSpaceball.hwndTarget = hwnd;
ok = RegisterRawInputDevices(&__fgSpaceball, 1, cbSize);
if (!ok){
__fgSpaceball.hwndTarget = NULL;
sball_initialized = 0;
}
}
if (!ok){
__fgSpaceball.hwndTarget = NULL;
sball_initialized = 0;
}
}
}
void fgPlatformSpaceballClose(void)
{
return;
return;
}
int fgPlatformHasSpaceball(void)
{
return __fgSpaceball.hwndTarget ? 1 : 0;
return __fgSpaceball.hwndTarget ? 1 : 0;
}
int fgPlatformSpaceballNumButtons(void)
{
return 0;
return 0;
}
void fgPlatformSpaceballSetWindow(SFG_Window *window)
{
return;
return;
}
int fgIsSpaceballWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
return 0;
return 0;
}
void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
#define LOGITECH_VENDOR_ID 0x46d
HRAWINPUT hRawInput = (HRAWINPUT)lParam;
UINT inputCode = (UINT)wParam;
UINT size;
BYTE *rawInputBuffer;
PRAWINPUT pRawInput;
UINT res;
RID_DEVICE_INFO sRidDeviceInfo;
#define LOGITECH_VENDOR_ID 0x46d
HRAWINPUT hRawInput = (HRAWINPUT)lParam;
UINT inputCode = (UINT)wParam;
UINT size;
BYTE *rawInputBuffer;
PRAWINPUT pRawInput;
UINT res;
RID_DEVICE_INFO sRidDeviceInfo;
if (!sball_initialized)
{
fgPlatformInitializeSpaceball();
if (!sball_initialized)
{
return;
}
}
if (!sball_initialized)
{
fgPlatformInitializeSpaceball();
if (!sball_initialized)
{
return;
}
}
res = GetRawInputData(hRawInput, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
if (res == -1)
return;
res = GetRawInputData(hRawInput, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
if (res == -1)
return;
rawInputBuffer = malloc(size * sizeof *rawInputBuffer);
pRawInput = (PRAWINPUT)rawInputBuffer;
rawInputBuffer = malloc(size * sizeof *rawInputBuffer);
pRawInput = (PRAWINPUT)rawInputBuffer;
res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER));
if (res == -1)
return;
if (pRawInput->header.dwType != RIM_TYPEHID)
return;
res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER));
if (res == -1)
return;
if (pRawInput->header.dwType != RIM_TYPEHID)
return;
sRidDeviceInfo.cbSize = sizeof(RID_DEVICE_INFO);
size = sizeof(RID_DEVICE_INFO);
res = GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICEINFO, &sRidDeviceInfo, &size);
if (res == -1)
return;
{
SFG_Window* window = fgWindowByHandle(hwnd);
if ((window == NULL))
return;
sRidDeviceInfo.cbSize = sizeof(RID_DEVICE_INFO);
size = sizeof(RID_DEVICE_INFO);
res = GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICEINFO, &sRidDeviceInfo, &size);
if (res == -1)
return;
{
SFG_Window* window = fgWindowByHandle(hwnd);
if ((window == NULL))
return;
if (sRidDeviceInfo.hid.dwVendorId == LOGITECH_VENDOR_ID)
{
// Motion data comes in two parts: motion type and
// displacement/rotation along three axis.
// Orientation is a right handed coordinate system with
// 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)
{ // Translation vector
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
short X = pnData[0];
short Y = -pnData[2];
short Z = pnData[1];
INVOKE_WCB(*window, SpaceMotion, (X, Y, Z));
}
else if (pRawInput->data.hid.bRawData[0] ==
SPNAV_EVENT_MOTION_ROTATION)
{ // Axis aligned rotation vector
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
short rX = pnData[0];
short rY = -pnData[2];
short rZ = pnData[1];
INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ));
}
else if (pRawInput->data.hid.bRawData[0] ==
SPNAV_EVENT_BUTTON)
{ // State of the keys
unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]);
unsigned int state = GLUT_UP;
if (FETCH_WCB(*window, SpaceButton))
{
int i;
for (i = 0; i < 32; i++)
{
unsigned long stateBefore = __fgSpaceKeystate&(1 << i);
unsigned long stateNow = dwKeystate&(1 << i);
if (sRidDeviceInfo.hid.dwVendorId == LOGITECH_VENDOR_ID)
{
// Motion data comes in two parts: motion type and
// displacement/rotation along three axis.
// Orientation is a right handed coordinate system with
// 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)
{ // Translation vector
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
short X = pnData[0];
short Y = -pnData[2];
short Z = pnData[1];
INVOKE_WCB(*window, SpaceMotion, (X, Y, Z));
}
else if (pRawInput->data.hid.bRawData[0] ==
SPNAV_EVENT_MOTION_ROTATION)
{ // Axis aligned rotation vector
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
short rX = pnData[0];
short rY = -pnData[2];
short rZ = pnData[1];
INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ));
}
else if (pRawInput->data.hid.bRawData[0] ==
SPNAV_EVENT_BUTTON)
{ // State of the keys
unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]);
unsigned int state = GLUT_UP;
if (FETCH_WCB(*window, SpaceButton))
{
int i;
for (i = 0; i < 32; i++)
{
unsigned long stateBefore = __fgSpaceKeystate&(1 << i);
unsigned long stateNow = dwKeystate&(1 << i);
if (stateBefore && !stateNow)
INVOKE_WCB(*window, SpaceButton, (stateBefore, GLUT_UP));
if (!stateBefore && stateNow)
INVOKE_WCB(*window, SpaceButton, (stateNow, GLUT_DOWN));
if (stateBefore && !stateNow)
INVOKE_WCB(*window, SpaceButton, (stateBefore, GLUT_UP));
if (!stateBefore && stateNow)
INVOKE_WCB(*window, SpaceButton, (stateNow, GLUT_DOWN));
}
}
__fgSpaceKeystate = dwKeystate;
}
}
}
}
}
__fgSpaceKeystate = dwKeystate;
}
}
}
}
#endif

View File

@ -32,7 +32,7 @@
extern GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
unsigned char layer_type );
/*
/*
* Helper functions for getting client area from the window rect
* and the window rect from the client area given the style of the window
* (or a valid window pointer from which the style can be queried).
@ -146,7 +146,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
HDC hdc = fgStructure.CurrentWindow->Window.pContext.Device;
int iPixelFormat = GetPixelFormat( hdc );
DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
returnValue = pfd.cColorBits;
if (pfd.iPixelType==PFD_TYPE_RGBA)
returnValue += pfd.cAlphaBits;
@ -183,7 +183,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect);
#else
ClientToScreen(fgStructure.CurrentWindow->Window.Handle, &topLeft);
if (fgStructure.CurrentWindow->Parent)
/* For child window, we should return relative to upper-left
* of parent's client area.
@ -257,7 +257,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
*/
borderWidth = ((winRect.right-winRect.left)-(clientRect.right-clientRect.left))/2;
captionHeight = (winRect.bottom-winRect.top)-(clientRect.bottom-clientRect.top)-borderWidth; /* include top border in caption height */
switch( eWhat )
{
case GLUT_WINDOW_BORDER_WIDTH:
@ -289,7 +289,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
break;
}
return -1;
return -1;
}

View File

@ -239,7 +239,7 @@ static void fghFillPFD( PIXELFORMATDESCRIPTOR *ppfd, HDC hdc, unsigned char laye
ppfd->dwLayerMask = 0;
ppfd->dwVisibleMask = 0;
ppfd->dwDamageMask = 0;
ppfd->cColorBits = (BYTE) GetDeviceCaps( hdc, BITSPIXEL );
}
@ -291,7 +291,7 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
/* windows hack for multismapling/sRGB */
if ( ( fgState.DisplayMode & GLUT_MULTISAMPLE ) ||
( fgState.DisplayMode & GLUT_SRGB ) )
{
{
HGLRC rc, rc_before=wglGetCurrentContext();
HWND hWnd;
HDC hDC, hDC_before=wglGetCurrentDC();
@ -430,7 +430,7 @@ void fghComputeWindowRectFromClientArea_UseStyle( RECT *clientRect, const DWORD
windowRect.left = clientRect->left;
windowRect.top = clientRect->top;
}
/* done, copy windowRect to output */
CopyRect(clientRect,&windowRect);
}
@ -467,7 +467,7 @@ void fghGetClientArea( RECT *clientRect, const SFG_Window *window, BOOL posIsOut
POINT topLeftClient = {0,0};
freeglut_return_if_fail((window && window->Window.Handle));
/* Get size of client rect */
GetClientRect(window->Window.Handle, clientRect);
if (posIsOutside)
@ -497,9 +497,9 @@ typedef struct
} m_proc_t;
static BOOL CALLBACK m_proc(HMONITOR mon,
HDC hdc,
LPRECT rect,
LPARAM data)
HDC hdc,
LPRECT rect,
LPARAM data)
{
m_proc_t *dp=(m_proc_t *)data;
MONITORINFOEX info;
@ -518,7 +518,7 @@ static BOOL CALLBACK m_proc(HMONITOR mon,
return TRUE;
}
/*
/*
* this function returns the origin of the screen identified by
* fgDisplay.pDisplay.DisplayName, and 0 otherwise.
* This is used in fgOpenWindow to open the gamemode window on the screen
@ -727,9 +727,9 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
/* Enable multitouch: additional flag TWF_FINETOUCH, TWF_WANTPALM */
#ifdef WM_TOUCH
if (fghRegisterTouchWindow == (pRegisterTouchWindow)0xDEADBEEF)
fghRegisterTouchWindow = (pRegisterTouchWindow)GetProcAddress(GetModuleHandle("user32"),"RegisterTouchWindow");
if (fghRegisterTouchWindow)
if (fghRegisterTouchWindow == (pRegisterTouchWindow)0xDEADBEEF)
fghRegisterTouchWindow = (pRegisterTouchWindow)GetProcAddress(GetModuleHandle("user32"),"RegisterTouchWindow");
if (fghRegisterTouchWindow)
fghRegisterTouchWindow( window->Window.Handle, TWF_FINETOUCH | TWF_WANTPALM );
#endif