projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reworked the X11 part of glutSetCursor, fixing bug #764187 (Variable mouse
[freeglut]
/
src
/
freeglut_main.c
diff --git
a/src/freeglut_main.c
b/src/freeglut_main.c
index
5726571
..
d1ba612
100644
(file)
--- a/
src/freeglut_main.c
+++ b/
src/freeglut_main.c
@@
-25,23
+25,21
@@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <GL/freeglut.h>
#include "freeglut_internal.h"
#include <GL/freeglut.h>
#include "freeglut_internal.h"
+#if HAVE_ERRNO_H
+# include <errno.h>
+#endif
+#include <stdarg.h>
+#if HAVE_VPRINTF
+# define VFPRINTF(s,f,a) vfprintf((s),(f),(a))
+#elif HAVE_DOPRNT
+# define VFPRINTF(s,f,a) _doprnt((f),(a),(s))
+#else
+# define VFPRINTF(s,f,a)
+#endif
-#include <limits.h>
-#if TARGET_HOST_UNIX_X11
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/stat.h>
-#elif TARGET_HOST_WIN32
-#elif TARGET_HOST_WINCE
+#if TARGET_HOST_WINCE
typedef struct GXDisplayProperties GXDisplayProperties;
typedef struct GXKeyList GXKeyList;
typedef struct GXDisplayProperties GXDisplayProperties;
typedef struct GXKeyList GXKeyList;
@@
-57,8
+55,15
@@
struct GXKeyList gxKeyList;
#endif
#endif
-#ifndef MAX
-#define MAX(a,b) (((a)>(b)) ? (a) : (b))
+/*
+ * Try to get the maximum value allowed for ints, falling back to the minimum
+ * guaranteed by ISO C99 if there is no suitable header.
+ */
+#if HAVE_LIMITS_H
+# include <limits.h>
+#endif
+#ifndef INT_MAX
+# define INT_MAX 32767
#endif
#ifndef MIN
#endif
#ifndef MIN
@@
-351,8
+356,8
@@
void fgError( const char *fmt, ... )
fprintf( stderr, "freeglut ");
if( fgState.ProgramName )
fprintf( stderr, "freeglut ");
if( fgState.ProgramName )
- fprintf (stderr, "(%s): ", fgState.ProgramName);
- vfprintf( stderr, fmt, ap );
+ fprintf( stderr, "(%s): ", fgState.ProgramName );
+ VFPRINTF( stderr, fmt, ap );
fprintf( stderr, "\n" );
va_end( ap );
fprintf( stderr, "\n" );
va_end( ap );
@@
-372,7
+377,7
@@
void fgWarning( const char *fmt, ... )
fprintf( stderr, "freeglut ");
if( fgState.ProgramName )
fprintf( stderr, "(%s): ", fgState.ProgramName );
fprintf( stderr, "freeglut ");
if( fgState.ProgramName )
fprintf( stderr, "(%s): ", fgState.ProgramName );
- vfprintf( stderr, fmt, ap );
+ VFPRINTF( stderr, fmt, ap );
fprintf( stderr, "\n" );
va_end( ap );
fprintf( stderr, "\n" );
va_end( ap );
@@
-453,8
+458,10
@@
static void fghSleepForEvents( void )
return;
msec = fghNextTimer( );
return;
msec = fghNextTimer( );
- if( fghHaveJoystick( ) ) /* XXX Use GLUT timers for joysticks... */
- msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */
+ /* XXX Use GLUT timers for joysticks... */
+ /* XXX Dumb; forces granularity to .01sec */
+ if( fghHaveJoystick( ) && ( msec < 10 ) )
+ msec = 10;
#if TARGET_HOST_UNIX_X11
/*
#if TARGET_HOST_UNIX_X11
/*