X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2FCommon%2Ffreeglut_internal.h;h=ebd93403c4468ecf8e10bb96207b780284c17492;hb=0cd6817079c9f545bbff65d6ac86d9fac6b92db9;hp=f4fc7562bfedd72b8edde2a2dfc88c6048077792;hpb=9486b7d6a3bf0d00cc00ab98380e99810250aa84;p=freeglut diff --git a/src/Common/freeglut_internal.h b/src/Common/freeglut_internal.h index f4fc756..ebd9340 100644 --- a/src/Common/freeglut_internal.h +++ b/src/Common/freeglut_internal.h @@ -88,23 +88,7 @@ /* -- PLATFORM-SPECIFIC INCLUDES ------------------------------------------- */ -/* All Win32 headers depend on the huge windows.h recursive include. - * Note: Lower-case header names are used, for best cross-platform - * compatibility. - */ -#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE) -# include -# include -# include -/* CYGWIN does not have tchar.h, but has TEXT(x), defined in winnt.h. */ -# ifndef __CYGWIN__ -# include -# else -# define _TEXT(x) TEXT(x) -# define _T(x) TEXT(x) -# endif - -#elif TARGET_HOST_POSIX_X11 +#if TARGET_HOST_POSIX_X11 # include # include # include @@ -164,21 +148,6 @@ # endif #endif -#if TARGET_HOST_MS_WINDOWS -# define HAVE_VFPRINTF 1 -#endif - -/* MinGW may lack a prototype for ChangeDisplaySettingsEx() (depending on the version?) */ -#if TARGET_HOST_MS_WINDOWS && !defined(ChangeDisplaySettingsEx) -LONG WINAPI ChangeDisplaySettingsExA(LPCSTR,LPDEVMODEA,HWND,DWORD,LPVOID); -LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID); -# ifdef UNICODE -# define ChangeDisplaySettingsEx ChangeDisplaySettingsExW -# else -# define ChangeDisplaySettingsEx ChangeDisplaySettingsExA -# endif -#endif - #if defined(_MSC_VER) || defined(__WATCOMC__) /* strdup() is non-standard, for all but POSIX-2001 */ #define strdup _strdup @@ -450,19 +419,24 @@ struct tagSFG_Context }; /* Window's state description. This structure should be kept portable. */ +#if TARGET_HOST_POSIX_X11 +typedef struct tagSFG_PlatformWindowState SFG_PlatformWindowState; +struct tagSFG_PlatformWindowState +{ + int OldWidth; /* Window width from before a resize */ + int OldHeight; /* " height " " " " */ +}; +#endif + + typedef struct tagSFG_WindowState SFG_WindowState; struct tagSFG_WindowState { /* Note that on Windows, sizes always refer to the client area, thus without the window decorations */ int Width; /* Window's width in pixels */ int Height; /* The same about the height */ -#if TARGET_HOST_POSIX_X11 - int OldWidth; /* Window width from before a resize */ - int OldHeight; /* " height " " " " */ -#elif TARGET_HOST_MS_WINDOWS - RECT OldRect; /* window rect - stored before the window is made fullscreen */ - DWORD OldStyle; /* window style - stored before the window is made fullscreen */ -#endif + + SFG_PlatformWindowState pWState; /* Window width/height (X11) or rectangle/style (Windows) from before a resize */ GLboolean Redisplay; /* Do we have to redisplay? */ GLboolean Visible; /* Is the window visible now */ @@ -779,6 +753,86 @@ struct tagSFG_StrokeFont const SFG_StrokeChar** Characters; /* The characters mapping */ }; + +/* -- JOYSTICK-SPECIFIC STRUCTURES AND TYPES ------------------------------- */ +/* XXX It might be better to poll the operating system for the numbers of buttons and + * XXX axes and then dynamically allocate the arrays. + */ +#define _JS_MAX_BUTTONS 32 + +#if TARGET_HOST_MACINTOSH +# define _JS_MAX_AXES 9 +typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick; +struct tagSFG_PlatformJoystick +{ +#define ISP_NUM_AXIS 9 +#define ISP_NUM_NEEDS 41 + ISpElementReference isp_elem [ ISP_NUM_NEEDS ]; + ISpNeed isp_needs [ ISP_NUM_NEEDS ]; +}; +#endif + +#if TARGET_HOST_MAC_OSX +# define _JS_MAX_AXES 16 +typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick; +struct tagSFG_PlatformJoystick +{ + IOHIDDeviceInterface ** hidDev; + IOHIDElementCookie buttonCookies[41]; + IOHIDElementCookie axisCookies[_JS_MAX_AXES]; +/* The next two variables are not used anywhere */ +/* long minReport[_JS_MAX_AXES], + * maxReport[_JS_MAX_AXES]; + */ +}; +#endif + +#if TARGET_HOST_POSIX_X11 +# define _JS_MAX_AXES 16 +typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick; +struct tagSFG_PlatformJoystick +{ +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) + struct os_specific_s *os; +# endif + +# ifdef JS_NEW + struct js_event js; + int tmp_buttons; + float tmp_axes [ _JS_MAX_AXES ]; +# else + struct JS_DATA_TYPE js; +# endif + + char fname [ 128 ]; + int fd; +}; +#endif + +/* + * Definition of "SFG_Joystick" structure -- based on JS's "jsJoystick" object class. + * See "js.h" lines 80-178. + */ +typedef struct tagSFG_Joystick SFG_Joystick; +struct tagSFG_Joystick +{ + SFG_PlatformJoystick pJoystick; + + int id; + GLboolean error; + char name [ 128 ]; + int num_axes; + int num_buttons; + + float dead_band[ _JS_MAX_AXES ]; + float saturate [ _JS_MAX_AXES ]; + float center [ _JS_MAX_AXES ]; + float max [ _JS_MAX_AXES ]; + float min [ _JS_MAX_AXES ]; +}; + + + /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */ /* Freeglut display related stuff (initialized once per session) */ @@ -991,10 +1045,6 @@ int fgHintPresent(Window window, Atom property, Atom hint); SFG_Proc fghGetProcAddress( const char *procName ); -#if TARGET_HOST_MS_WINDOWS -extern void (__cdecl *__glutExitFunc)( int return_value ); -#endif - #endif /* FREEGLUT_INTERNAL_H */ /*** END OF FILE ***/