\r
#define INVALID_MODIFIERS 0xffffffff\r
\r
+\r
+\r
+/* Platform-specific includes */\r
+#if TARGET_HOST_POSIX_X11\r
+\r
+typedef struct tagSFG_PlatformDisplay SFG_PlatformDisplay;\r
+struct tagSFG_PlatformDisplay\r
+{\r
+ Display* Display; /* The display we are being run in. */\r
+ int Screen; /* The screen we are about to use. */\r
+ Window RootWindow; /* The screen's root window. */\r
+ int Connection; /* The display's connection number */\r
+ Atom DeleteWindow; /* The window deletion atom */\r
+ Atom State; /* The state atom */\r
+ Atom StateFullScreen; /* The full screen atom */\r
+\r
+#ifdef HAVE_X11_EXTENSIONS_XRANDR_H\r
+ int prev_xsz, prev_ysz;\r
+ int prev_refresh;\r
+ int prev_size_valid;\r
+#endif /* HAVE_X11_EXTENSIONS_XRANDR_H */\r
+\r
+#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H\r
+ /*\r
+ * XF86VidMode may be compilable even if it fails at runtime. Therefore,\r
+ * the validity of the VidMode has to be tracked\r
+ */\r
+ int DisplayModeValid; /* Flag that indicates runtime status*/\r
+ XF86VidModeModeLine DisplayMode; /* Current screen's display settings */\r
+ int DisplayModeClock; /* The display mode's refresh rate */\r
+ int DisplayViewPortX; /* saved X location of the viewport */\r
+ int DisplayViewPortY; /* saved Y location of the viewport */\r
+#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */\r
+\r
+ int DisplayPointerX; /* saved X location of the pointer */\r
+ int DisplayPointerY; /* saved Y location of the pointer */\r
+};\r
+\r
+\r
+/*\r
+ * Make "freeglut" window handle and context types so that we don't need so\r
+ * much conditionally-compiled code later in the library.\r
+ */\r
+typedef Window SFG_WindowHandleType ;\r
+typedef GLXContext SFG_WindowContextType ;\r
+typedef struct tagSFG_PlatformContext SFG_PlatformContext;\r
+struct tagSFG_PlatformContext\r
+{\r
+ GLXFBConfig* FBConfig; /* The window's FBConfig */\r
+};\r
+\r
+\r
+\r
+#endif\r
+#if TARGET_HOST_MS_WINDOWS\r
+#include "../mswin/freeglut_internal_mswin.h"\r
+#endif\r
+\r
+\r
/* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */\r
\r
/* Freeglut callbacks type definitions */\r
typedef struct tagSFG_Display SFG_Display;\r
struct tagSFG_Display\r
{\r
-#if TARGET_HOST_POSIX_X11\r
- Display* Display; /* The display we are being run in. */\r
- int Screen; /* The screen we are about to use. */\r
- Window RootWindow; /* The screen's root window. */\r
- int Connection; /* The display's connection number */\r
- Atom DeleteWindow; /* The window deletion atom */\r
- Atom State; /* The state atom */\r
- Atom StateFullScreen; /* The full screen atom */\r
-\r
-#ifdef HAVE_X11_EXTENSIONS_XRANDR_H\r
- int prev_xsz, prev_ysz;\r
- int prev_refresh;\r
- int prev_size_valid;\r
-#endif /* HAVE_X11_EXTENSIONS_XRANDR_H */\r
-\r
-#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H\r
- /*\r
- * XF86VidMode may be compilable even if it fails at runtime. Therefore,\r
- * the validity of the VidMode has to be tracked\r
- */\r
- int DisplayModeValid; /* Flag that indicates runtime status*/\r
- XF86VidModeModeLine DisplayMode; /* Current screen's display settings */\r
- int DisplayModeClock; /* The display mode's refresh rate */\r
- int DisplayViewPortX; /* saved X location of the viewport */\r
- int DisplayViewPortY; /* saved Y location of the viewport */\r
-#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */\r
-\r
- int DisplayPointerX; /* saved X location of the pointer */\r
- int DisplayPointerY; /* saved Y location of the pointer */\r
-\r
-#elif TARGET_HOST_MS_WINDOWS\r
- HINSTANCE Instance; /* The application's instance */\r
- DEVMODE DisplayMode; /* Desktop's display settings */\r
- char *DisplayName; /* Display name for multi display support*/ \r
-\r
-#endif\r
+ SFG_PlatformDisplay pDisplay;\r
\r
int ScreenWidth; /* The screen's width in pixels */\r
int ScreenHeight; /* The screen's height in pixels */\r
};\r
\r
/*\r
- * Make "freeglut" window handle and context types so that we don't need so\r
- * much conditionally-compiled code later in the library.\r
- */\r
-#if TARGET_HOST_POSIX_X11\r
-\r
-typedef Window SFG_WindowHandleType ;\r
-typedef GLXContext SFG_WindowContextType ;\r
-\r
-#elif TARGET_HOST_MS_WINDOWS\r
-\r
-typedef HWND SFG_WindowHandleType ;\r
-typedef HGLRC SFG_WindowContextType ;\r
-\r
-#endif\r
-\r
-/*\r
* A window and its OpenGL context. The contents of this structure\r
* are highly dependant on the target operating system we aim at...\r
*/\r
SFG_WindowHandleType Handle; /* The window's handle */\r
SFG_WindowContextType Context; /* The window's OpenGL/WGL context */\r
\r
-#if TARGET_HOST_POSIX_X11\r
- GLXFBConfig* FBConfig; /* The window's FBConfig */\r
-#elif TARGET_HOST_MS_WINDOWS\r
- HDC Device; /* The window's device context */\r
-#endif\r
+ SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */\r
\r
int DoubleBuffered; /* Treat the window as double-buffered */\r
};\r
const SFG_StrokeChar** Characters; /* The characters mapping */\r
};\r
\r
+\r
+/* -- JOYSTICK-SPECIFIC STRUCTURES AND TYPES ------------------------------- */\r
+/* XXX It might be better to poll the operating system for the numbers of buttons and\r
+ * XXX axes and then dynamically allocate the arrays.\r
+ */\r
+#define _JS_MAX_BUTTONS 32\r
+\r
+#if TARGET_HOST_MACINTOSH\r
+# define _JS_MAX_AXES 9\r
+#endif\r
+\r
+#if TARGET_HOST_MAC_OSX\r
+# define _JS_MAX_AXES 16\r
+#endif\r
+\r
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)\r
+# define _JS_MAX_AXES 8\r
+#endif\r
+\r
+#if TARGET_HOST_POSIX_X11\r
+# define _JS_MAX_AXES 16\r
+#endif\r
+\r
+/*\r
+ * Definition of "SFG_Joystick" structure -- based on JS's "jsJoystick" object class.\r
+ * See "js.h" lines 80-178.\r
+ */\r
+typedef struct tagSFG_Joystick SFG_Joystick;\r
+struct tagSFG_Joystick\r
+{\r
+#if TARGET_HOST_MACINTOSH\r
+#define ISP_NUM_AXIS 9\r
+#define ISP_NUM_NEEDS 41\r
+ ISpElementReference isp_elem [ ISP_NUM_NEEDS ];\r
+ ISpNeed isp_needs [ ISP_NUM_NEEDS ];\r
+#endif\r
+\r
+#if TARGET_HOST_MAC_OSX\r
+ IOHIDDeviceInterface ** hidDev;\r
+ IOHIDElementCookie buttonCookies[41];\r
+ IOHIDElementCookie axisCookies[_JS_MAX_AXES];\r
+ long minReport[_JS_MAX_AXES],\r
+ maxReport[_JS_MAX_AXES];\r
+#endif\r
+\r
+#if TARGET_HOST_MS_WINDOWS && !defined(_WIN32_WCE)\r
+ JOYCAPS jsCaps;\r
+ JOYINFOEX js;\r
+ UINT js_id;\r
+#endif\r
+\r
+\r
+#if TARGET_HOST_POSIX_X11\r
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)\r
+ struct os_specific_s *os;\r
+# endif\r
+\r
+# ifdef JS_NEW\r
+ struct js_event js;\r
+ int tmp_buttons;\r
+ float tmp_axes [ _JS_MAX_AXES ];\r
+# else\r
+ struct JS_DATA_TYPE js;\r
+# endif\r
+\r
+ char fname [ 128 ];\r
+ int fd;\r
+#endif\r
+\r
+ int id;\r
+ GLboolean error;\r
+ char name [ 128 ];\r
+ int num_axes;\r
+ int num_buttons;\r
+\r
+ float dead_band[ _JS_MAX_AXES ];\r
+ float saturate [ _JS_MAX_AXES ];\r
+ float center [ _JS_MAX_AXES ];\r
+ float max [ _JS_MAX_AXES ];\r
+ float min [ _JS_MAX_AXES ];\r
+};\r
+\r
+\r
+\r
/* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */\r
\r
/* Freeglut display related stuff (initialized once per session) */\r
\r
SFG_Proc fghGetProcAddress( const char *procName );\r
\r
-#if TARGET_HOST_MS_WINDOWS\r
-extern void (__cdecl *__glutExitFunc)( int return_value );\r
-#endif\r
-\r
#endif /* FREEGLUT_INTERNAL_H */\r
\r
/*** END OF FILE ***/\r