diff options
Diffstat (limited to 'src/glut')
-rw-r--r-- | src/glut/directfb/callback.c | 68 | ||||
-rw-r--r-- | src/glut/directfb/events.c | 11 | ||||
-rw-r--r-- | src/glut/directfb/internal.h | 1 | ||||
-rw-r--r-- | src/glut/fbdev/Makefile | 8 | ||||
-rw-r--r-- | src/glut/glx/Makefile | 21 | ||||
-rw-r--r-- | src/glut/glx/Makefile.mgw | 191 | ||||
-rw-r--r-- | src/glut/glx/glut.pc.in | 11 | ||||
-rw-r--r-- | src/glut/glx/glut_dstr.c | 1 | ||||
-rw-r--r-- | src/glut/glx/glut_event.c | 8 | ||||
-rw-r--r-- | src/glut/glx/glut_fbc.c | 4 | ||||
-rw-r--r-- | src/glut/glx/glut_fcb.c | 164 | ||||
-rw-r--r-- | src/glut/glx/glut_input.c | 3 | ||||
-rw-r--r-- | src/glut/glx/glut_joy.c | 3 | ||||
-rw-r--r-- | src/glut/glx/glutint.h | 3 | ||||
-rw-r--r-- | src/glut/glx/win32_util.c | 1 | ||||
-rw-r--r-- | src/glut/glx/win32_winproc.c | 3 | ||||
-rw-r--r-- | src/glut/glx/win32_x11.h | 10 |
17 files changed, 467 insertions, 44 deletions
diff --git a/src/glut/directfb/callback.c b/src/glut/directfb/callback.c index 38cfccbd4f..4f23441167 100644 --- a/src/glut/directfb/callback.c +++ b/src/glut/directfb/callback.c @@ -28,14 +28,13 @@ typedef void (GLUTCALLBACK *__GlutTimerCallback) ( int value ); typedef struct __GlutTimer_s { - unsigned int interval; + struct timeval interval; struct timeval expire; __GlutTimerCallback func; int value; struct __GlutTimer_s *next; - struct __GlutTimer_s *prev; } __GlutTimer; /*****************************************************************************/ @@ -207,8 +206,7 @@ glutIdleFunc( void (GLUTCALLBACK *func) (void) ) void GLUTAPIENTRY glutTimerFunc( unsigned int msec, void (GLUTCALLBACK *func) (int value), int value ) { - __GlutTimer *timer; - struct timeval now; + __GlutTimer *timer; if (!func) return; @@ -217,24 +215,19 @@ glutTimerFunc( unsigned int msec, void (GLUTCALLBACK *func) (int value), int val if (!timer) __glutFatalError( "out of memory" ); - gettimeofday( &now, NULL ); - - timer->interval = msec; - timer->expire.tv_sec = now.tv_sec + (now.tv_usec/1000 + msec) / 1000; - timer->expire.tv_usec = (now.tv_usec + msec*1000) % 1000000; + timer->interval.tv_sec = msec / 1000; + timer->interval.tv_usec = (msec % 1000) * 1000; + + gettimeofday( &timer->expire, NULL ); + timer->expire.tv_usec += timer->interval.tv_usec; + timer->expire.tv_sec += timer->interval.tv_sec + timer->expire.tv_usec/1000000; + timer->expire.tv_usec %= 1000000; timer->func = func; timer->value = value; - if (g_timers) { - timer->prev = g_timers->prev; - g_timers->prev->next = timer; - g_timers->prev = timer; - } - else { - g_timers = timer; - g_timers->prev = timer; - } + timer->next = g_timers; + g_timers = timer; } @@ -254,12 +247,41 @@ __glutHandleTimers( void ) g_idle = GL_FALSE; cur->func( cur->value ); - - cur->expire.tv_sec += (cur->expire.tv_usec/1000 + cur->interval) / 1000; - cur->expire.tv_usec = (cur->expire.tv_usec + cur->interval*1000) % 1000000; + + cur->expire.tv_usec += cur->interval.tv_usec; + cur->expire.tv_sec += cur->interval.tv_sec + cur->expire.tv_usec/1000000; + cur->expire.tv_usec %= 1000000; } } -} +} + + +GLboolean +__glutGetTimeout( int *ret_msec ) +{ + __GlutTimer *cur; + struct timeval *time = NULL; + struct timeval now; + + for (cur = g_timers; cur; cur = cur->next) { + if (time == NULL || + time->tv_sec > cur->expire.tv_sec || + (time->tv_sec == cur->expire.tv_sec && + time->tv_usec > cur->expire.tv_usec)) { + time = &cur->expire; + } + } + + if (time == NULL) + return GL_FALSE; + + gettimeofday( &now, NULL ); + + *ret_msec = (time->tv_sec - now.tv_sec) * 1000 + + (time->tv_usec - now.tv_usec + 500) / 1000; + + return GL_TRUE; +} void @@ -275,4 +297,4 @@ __glutFreeTimers( void ) g_timers = NULL; } - + diff --git a/src/glut/directfb/events.c b/src/glut/directfb/events.c index 4c474710ab..6ebdd166ac 100644 --- a/src/glut/directfb/events.c +++ b/src/glut/directfb/events.c @@ -435,13 +435,14 @@ glutMainLoop( void ) { __glutAssert( events != NULL ); + __glutHandleWindows(); + while (GL_TRUE) { DFBEvent evt, prev; g_idle = GL_TRUE; __glutHandleTimers(); - __glutHandleWindows(); prev.clazz = DFEC_NONE; @@ -471,13 +472,19 @@ glutMainLoop( void ) __glutHandleTimers(); } + __glutHandleWindows(); + if (g_idle) { if (idle_func) { idle_func(); } else { + int msec; __glutSetWindow( NULL ); - usleep( 500 ); + if (__glutGetTimeout( &msec )) + events->WaitForEventWithTimeout( events, msec/1000, msec%1000 ); + else + events->WaitForEvent( events ); } } } diff --git a/src/glut/directfb/internal.h b/src/glut/directfb/internal.h index bc3e20e93e..47311c9342 100644 --- a/src/glut/directfb/internal.h +++ b/src/glut/directfb/internal.h @@ -124,6 +124,7 @@ extern void __glutDestroyWindow( __GlutWindow *window ); extern void __glutDestroyWindows( void ); /* callback.c */ extern void __glutHandleTimers( void ); +extern GLboolean __glutGetTimeout( int *ret_msec ); extern void __glutFreeTimers( void ); diff --git a/src/glut/fbdev/Makefile b/src/glut/fbdev/Makefile index 254ff8c098..d84d52ec48 100644 --- a/src/glut/fbdev/Makefile +++ b/src/glut/fbdev/Makefile @@ -69,10 +69,10 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) $(MKLIB_OPTIONS) $(OBJECTS) install: - $(INSTALL) -d $(INSTALL_DIR)/include/GL - $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR) - $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(INSTALL_DIR)/include/GL - $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(INSTALL_DIR)/$(LIB_DIR) + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) + $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) # Run 'make -f Makefile.solo dep' to update the dependencies if you change # what's included by any source file. diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile index 7e1d56b327..f73158ad38 100644 --- a/src/glut/glx/Makefile +++ b/src/glut/glx/Makefile @@ -36,6 +36,7 @@ SOURCES = \ glut_dstr.c \ glut_event.c \ glut_ext.c \ + glut_fcb.c \ glut_fullscrn.c \ glut_gamemode.c \ glut_get.c \ @@ -96,11 +97,21 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) $(GLUT_LIB_DEPS) $(OBJECTS) -install: - $(INSTALL) -d $(INSTALL_DIR)/include/GL - $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR) - $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(INSTALL_DIR)/include/GL - $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(INSTALL_DIR)/$(LIB_DIR) +# glut pkgconfig file +pcedit = sed \ + -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ + -e 's,@LIB_DIR@,$(LIB_DIR),' \ + -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' +glut.pc: glut.pc.in + $(pcedit) $< > $@ + +install: glut.pc + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig + $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) + $(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig clean: diff --git a/src/glut/glx/Makefile.mgw b/src/glut/glx/Makefile.mgw new file mode 100644 index 0000000000..9fff2e1503 --- /dev/null +++ b/src/glut/glx/Makefile.mgw @@ -0,0 +1,191 @@ +# Mesa 3-D graphics library +# Version: 5.1 +# +# Copyright (C) 1999-2003 Brian Paul All Rights Reserved. +# +# 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 +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# MinGW core makefile v1.4 for Mesa +# +# Copyright (C) 2002 - Daniel Borca +# Email : dborca@users.sourceforge.net +# Web : http://www.geocities.com/dborca + +# MinGW core-glut makefile updated for Mesa 7.0 +# +# Updated : by Heromyth, on 2007-7-21 +# Email : zxpmyth@yahoo.com.cn +# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. +# The others havn't been tested yet. +# 2) The generated DLLs are *not* compatible with the ones built +# with the other compilers like VC8, especially for GLUT. +# 3) Although more tests are needed, it can be used individually! + + +# +# Available options: +# +# Environment variables: +# CFLAGS +# +# GLIDE path to Glide3 SDK; used with FX. +# default = $(TOP)/glide3 +# FX=1 build for 3dfx Glide3. Note that this disables +# compilation of most WMesa code and requires fxMesa. +# As a consequence, you'll need the Win32 Glide3 +# library to build any application. +# default = no +# ICD=1 build the installable client driver interface +# (windows opengl driver interface) +# default = no +# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). +# default = no +# +# Targets: +# all: build GL +# clean: remove object files +# + + + +.PHONY: all clean +.INTERMEDIATE: x86/gen_matypes.exe +.SUFFIXES: .rc .res + +# Set this to the prefix of your build tools, i.e. mingw32- +TOOLS_PREFIX = mingw32- + +TOP = ../../.. + +LIBDIR = $(TOP)/lib + +LIB_NAME = glut32 + +DLL_EXT = .dll +IMP_EXT = .a +LIB_PRE = lib +STRIP = -s + +AR = ar +ARFLAGS = crus +DLLTOOL = dlltool + +GLUT_DLL = $(LIB_NAME)$(DLL_EXT) +GLUT_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT) +GLUT_DEF = $(LIB_NAME).def + +LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32 +LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at + +CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL +CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include + +CC = $(TOOLS_PREFIX)gcc +CXX = $(TOOLS_PREFIX)g++ +CXXFLAGS = $(CFLAGS) + +AR = ar +ARFLAGS = crus + +UNLINK = del $(subst /,\,$(1)) +ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif +ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif + +HDRS = glutint.h glutstroke.h glutbitmap.h glutwin32.h stroke.h win32_glx.h win32_x11.h + +SRCS = \ + glut_bitmap.c \ + glut_bwidth.c \ + glut_cindex.c \ + glut_cmap.c \ + glut_cursor.c \ + glut_dials.c \ + glut_dstr.c \ + glut_event.c \ + glut_ext.c \ + glut_fbc.c \ + glut_fullscrn.c \ + glut_gamemode.c \ + glut_get.c \ + glut_init.c \ + glut_input.c \ + glut_joy.c \ + glut_key.c \ + glut_keyctrl.c \ + glut_keyup.c \ + glut_mesa.c \ + glut_modifier.c \ + glut_overlay.c \ + glut_shapes.c \ + glut_space.c \ + glut_stroke.c \ + glut_swap.c \ + glut_swidth.c \ + glut_tablet.c \ + glut_teapot.c \ + glut_util.c \ + glut_vidresize.c \ + glut_warp.c \ + glut_win.c \ + glut_winmisc.c \ + win32_glx.c \ + win32_menu.c \ + win32_util.c \ + win32_winproc.c \ + win32_x11.c + + +SRCSSEMIGENS = \ + glut_8x13.c \ + glut_9x15.c \ + glut_hel10.c \ + glut_hel12.c \ + glut_hel18.c \ + glut_mroman.c \ + glut_roman.c \ + glut_tr10.c \ + glut_tr24.c + + + +SOURCES = $(SRCS) $(SRCSSEMIGENS) + +OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) + +.c.o: + $(CC) -o $@ $(CFLAGS) -c $< +.cc.o: + $(CXX) -o $@ $(CXXFLAGS) -c $< + + +all: $(LIBDIR) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP) + +$(LIBDIR): + mkdir -p $(LIBDIR) + +$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS) + $(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLUT_DLL) $^ $(LDLIBS) + $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLUT_DEF) $^ + $(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLUT_IMP) --def $(LIBDIR)/$(GLUT_DEF) + +clean: + -$(call UNLINK,*.o)
\ No newline at end of file diff --git a/src/glut/glx/glut.pc.in b/src/glut/glx/glut.pc.in new file mode 100644 index 0000000000..f732f2990d --- /dev/null +++ b/src/glut/glx/glut.pc.in @@ -0,0 +1,11 @@ +prefix=@INSTALL_DIR@ +exec_prefix=${prefix} +libdir=${exec_prefix}/@LIB_DIR@ +includedir=${prefix}/include + +Name: glut +Description: Mesa OpenGL Utility Toolkit library +Requires: gl glu +Version: @VERSION@ +Libs: -L${libdir} -lglut +Cflags: -I${includedir} diff --git a/src/glut/glx/glut_dstr.c b/src/glut/glx/glut_dstr.c index ec9386f3e5..2513af4539 100644 --- a/src/glut/glx/glut_dstr.c +++ b/src/glut/glx/glut_dstr.c @@ -291,6 +291,7 @@ loadVisuals(int *nitems_return) fbmodes = (FrameBufferMode *) malloc(n * sizeof(FrameBufferMode)); if (fbmodes == NULL) { *nitems_return = -1; + free(vlist); return NULL; } for (i = 0; i < n; i++) { diff --git a/src/glut/glx/glut_event.c b/src/glut/glx/glut_event.c index 4e67da674e..b5df7b2311 100644 --- a/src/glut/glx/glut_event.c +++ b/src/glut/glx/glut_event.c @@ -24,7 +24,7 @@ # ifdef __sgi # include <bstring.h> /* prototype for bzero used by FD_ZERO */ # endif -# if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE) +# if (defined(__FreeBSD__) || defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE) # include <sys/select.h> /* select system call interface */ # ifdef luna # include <sysent.h> @@ -172,10 +172,14 @@ handleTimeouts(void) GETTIMEOFDAY(&now); while (IS_AT_OR_AFTER(__glutTimerList->timeout, now)) { timer = __glutTimerList; - __glutTimerList = timer->next; + /* call the timer function */ timer->func(timer->value); + /* remove from the linked list */ + __glutTimerList = timer->next; + /* put this timer on the "free" list */ timer->next = freeTimerList; freeTimerList = timer; + if (!__glutTimerList) break; } diff --git a/src/glut/glx/glut_fbc.c b/src/glut/glx/glut_fbc.c index deb46c3d8d..e93188b862 100644 --- a/src/glut/glx/glut_fbc.c +++ b/src/glut/glx/glut_fbc.c @@ -18,7 +18,7 @@ /* Set a Fortran callback function. */ -void GLUTAPIENTRY +void APIENTRY __glutSetFCB(int which, void *func) { #ifdef SUPPORT_FORTRAN @@ -100,7 +100,7 @@ __glutSetFCB(int which, void *func) /* Get a Fortran callback function. */ -void* GLUTAPIENTRY +void* APIENTRY __glutGetFCB(int which) { #ifdef SUPPORT_FORTRAN diff --git a/src/glut/glx/glut_fcb.c b/src/glut/glx/glut_fcb.c new file mode 100644 index 0000000000..c8a3422b36 --- /dev/null +++ b/src/glut/glx/glut_fcb.c @@ -0,0 +1,164 @@ + +/* Copyright (c) Mark J. Kilgard, 1998. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +/* I appreciate the guidance from William Mitchell + (mitchell@cam.nist.gov) in developing this friend interface + for use by the f90gl package. See ../../README.fortran */ + +#include "glutint.h" + +/* FCB stands for Fortran CallBack. */ + +/* There is only one idleFunc, menuStateFunc, and menuStatusFunc, so they + can be saved in the wrappers for Fortran rather than the C structures. */ + +/* Set a Fortran callback function. */ + +void APIENTRY +__glutSetFCB(int which, GLUTproc func) +{ +#ifdef SUPPORT_FORTRAN + switch (which) { + case GLUT_FCB_DISPLAY: + __glutCurrentWindow->fdisplay = (GLUTdisplayFCB) func; + break; + case GLUT_FCB_RESHAPE: + __glutCurrentWindow->freshape = (GLUTreshapeFCB) func; + break; + case GLUT_FCB_MOUSE: + __glutCurrentWindow->fmouse = (GLUTmouseFCB) func; + break; + case GLUT_FCB_MOTION: + __glutCurrentWindow->fmotion = (GLUTmotionFCB) func; + break; + case GLUT_FCB_PASSIVE: + __glutCurrentWindow->fpassive = (GLUTpassiveFCB) func; + break; + case GLUT_FCB_ENTRY: + __glutCurrentWindow->fentry = (GLUTentryFCB) func; + break; + case GLUT_FCB_KEYBOARD: + __glutCurrentWindow->fkeyboard = (GLUTkeyboardFCB) func; + break; + case GLUT_FCB_KEYBOARD_UP: + __glutCurrentWindow->fkeyboardUp = (GLUTkeyboardFCB) func; + break; + case GLUT_FCB_WINDOW_STATUS: + __glutCurrentWindow->fwindowStatus = (GLUTwindowStatusFCB) func; + break; + case GLUT_FCB_VISIBILITY: + __glutCurrentWindow->fvisibility = (GLUTvisibilityFCB) func; + break; + case GLUT_FCB_SPECIAL: + __glutCurrentWindow->fspecial = (GLUTspecialFCB) func; + break; + case GLUT_FCB_SPECIAL_UP: + __glutCurrentWindow->fspecialUp = (GLUTspecialFCB) func; + break; + case GLUT_FCB_BUTTON_BOX: + __glutCurrentWindow->fbuttonBox = (GLUTbuttonBoxFCB) func; + break; + case GLUT_FCB_DIALS: + __glutCurrentWindow->fdials = (GLUTdialsFCB) func; + break; + case GLUT_FCB_SPACE_MOTION: + __glutCurrentWindow->fspaceMotion = (GLUTspaceMotionFCB) func; + break; + case GLUT_FCB_SPACE_ROTATE: + __glutCurrentWindow->fspaceRotate = (GLUTspaceRotateFCB) func; + break; + case GLUT_FCB_SPACE_BUTTON: + __glutCurrentWindow->fspaceButton = (GLUTspaceButtonFCB) func; + break; + case GLUT_FCB_TABLET_MOTION: + __glutCurrentWindow->ftabletMotion = (GLUTtabletMotionFCB) func; + break; + case GLUT_FCB_TABLET_BUTTON: + __glutCurrentWindow->ftabletButton = (GLUTtabletButtonFCB) func; + break; +#ifdef _WIN32 + case GLUT_FCB_JOYSTICK: + __glutCurrentWindow->fjoystick = (GLUTjoystickFCB) func; + break; +#endif + case GLUT_FCB_OVERLAY_DISPLAY: + __glutCurrentWindow->overlay->fdisplay = (GLUTdisplayFCB) func; + break; + case GLUT_FCB_SELECT: + __glutCurrentMenu->fselect = (GLUTselectFCB) func; + break; + case GLUT_FCB_TIMER: + __glutNewTimer->ffunc = (GLUTtimerFCB) func; + break; + } +#endif +} + +/* Get a Fortran callback function. */ + +GLUTproc APIENTRY +__glutGetFCB(int which) +{ +#ifdef SUPPORT_FORTRAN + switch (which) { + case GLUT_FCB_DISPLAY: + return __glutCurrentWindow->fdisplay; + case GLUT_FCB_RESHAPE: + return __glutCurrentWindow->freshape; + case GLUT_FCB_MOUSE: + return __glutCurrentWindow->fmouse; + case GLUT_FCB_MOTION: + return __glutCurrentWindow->fmotion; + case GLUT_FCB_PASSIVE: + return __glutCurrentWindow->fpassive; + case GLUT_FCB_ENTRY: + return __glutCurrentWindow->fentry; + case GLUT_FCB_KEYBOARD: + return __glutCurrentWindow->fkeyboard; + case GLUT_FCB_KEYBOARD_UP: + return __glutCurrentWindow->fkeyboardUp; + case GLUT_FCB_WINDOW_STATUS: + return __glutCurrentWindow->fwindowStatus; + case GLUT_FCB_VISIBILITY: + return __glutCurrentWindow->fvisibility; + case GLUT_FCB_SPECIAL: + return __glutCurrentWindow->fspecial; + case GLUT_FCB_SPECIAL_UP: + return __glutCurrentWindow->fspecialUp; + case GLUT_FCB_BUTTON_BOX: + return __glutCurrentWindow->fbuttonBox; + case GLUT_FCB_DIALS: + return __glutCurrentWindow->fdials; + case GLUT_FCB_SPACE_MOTION: + return __glutCurrentWindow->fspaceMotion; + case GLUT_FCB_SPACE_ROTATE: + return __glutCurrentWindow->fspaceRotate; + case GLUT_FCB_SPACE_BUTTON: + return __glutCurrentWindow->fspaceButton; + case GLUT_FCB_TABLET_MOTION: + return __glutCurrentWindow->ftabletMotion; + case GLUT_FCB_TABLET_BUTTON: + return __glutCurrentWindow->ftabletButton; + case GLUT_FCB_JOYSTICK: +#ifdef _WIN32 + return __glutCurrentWindow->fjoystick; +#else + return NULL; +#endif + case GLUT_FCB_OVERLAY_DISPLAY: + return __glutCurrentWindow->overlay->fdisplay; + case GLUT_FCB_SELECT: + return __glutCurrentMenu->fselect; + case GLUT_FCB_TIMER: + return __glutTimerList ? __glutTimerList->ffunc : NULL; + default: + return NULL; + } +#else + return NULL; +#endif +} diff --git a/src/glut/glx/glut_input.c b/src/glut/glx/glut_input.c index add3df7c3f..a76ff9a435 100644 --- a/src/glut/glx/glut_input.c +++ b/src/glut/glx/glut_input.c @@ -23,6 +23,9 @@ #endif #include <X11/Xutil.h> #else +#ifdef __MINGW32__ +#include <GL/gl.h> +#endif #include <windows.h> #ifndef __CYGWIN32__ #include <mmsystem.h> /* Win32 Multimedia API header. */ diff --git a/src/glut/glx/glut_joy.c b/src/glut/glx/glut_joy.c index a4528ae1ce..5025607922 100644 --- a/src/glut/glx/glut_joy.c +++ b/src/glut/glx/glut_joy.c @@ -6,6 +6,9 @@ implied. This program is -not- in the public domain. */ #ifdef _WIN32 +#ifdef __MINGW32__ +#include <GL/gl.h> +#endif #include <windows.h> #ifndef __CYGWIN32__ #include <mmsystem.h> /* Win32 Multimedia API header. */ diff --git a/src/glut/glx/glutint.h b/src/glut/glx/glutint.h index 6fe09ffe7e..a962c78023 100644 --- a/src/glut/glx/glutint.h +++ b/src/glut/glx/glutint.h @@ -26,7 +26,10 @@ #include <GL/glx.h> #endif +#ifndef GLUT_BUILDING_LIB #define GLUT_BUILDING_LIB /* Building the GLUT library itself. */ +#endif + #include <GL/glut.h> #if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__) diff --git a/src/glut/glx/win32_util.c b/src/glut/glx/win32_util.c index becd823a40..25af48a112 100644 --- a/src/glut/glx/win32_util.c +++ b/src/glut/glx/win32_util.c @@ -15,6 +15,7 @@ /* The following added by Paul Garceau <pgarceau@teleport.com> */ #if defined(__MINGW32__) +#include <GL/gl.h> #include <time.h> #include <windows.h> struct timeval; diff --git a/src/glut/glx/win32_winproc.c b/src/glut/glx/win32_winproc.c index a54bac75fa..e1fc785ebb 100644 --- a/src/glut/glx/win32_winproc.c +++ b/src/glut/glx/win32_winproc.c @@ -9,6 +9,9 @@ #include "glutint.h" #include <sys/timeb.h> +#ifdef __MINGW32__ +#include <ctype.h> +#endif #if defined(_WIN32) && !defined(__CYGWIN32__) #include <mmsystem.h> /* Win32 Multimedia API header. */ diff --git a/src/glut/glx/win32_x11.h b/src/glut/glx/win32_x11.h index 1d8d048b2e..6f5c3a9aea 100644 --- a/src/glut/glx/win32_x11.h +++ b/src/glut/glx/win32_x11.h @@ -6,16 +6,14 @@ /* This program is freely distributable without licensing fees and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */ - +#ifdef __MINGW32__ +#include <GL/gl.h> +#endif #include <stdlib.h> #include <windows.h> /* These definitions are missing from windows.h */ -WINGDIAPI int WINAPI wglChoosePixelFormat(HDC, PIXELFORMATDESCRIPTOR *); -WINGDIAPI int WINAPI wglDescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR); -WINGDIAPI int WINAPI wglGetPixelFormat(HDC); -WINGDIAPI BOOL WINAPI wglSetPixelFormat(HDC, int, PIXELFORMATDESCRIPTOR *); -WINGDIAPI BOOL WINAPI wglSwapBuffers(HDC); + /* Type definitions (conversions) */ typedef int Visual; /* Win32 equivalent of X11 type */ |