Index: head/graphics/freeglut/Makefile =================================================================== --- head/graphics/freeglut/Makefile (revision 482976) +++ head/graphics/freeglut/Makefile (revision 482977) @@ -1,57 +1,57 @@ # Created by: thierry@pompo.net # $FreeBSD$ PORTNAME= freeglut PORTVERSION= 3.0.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= graphics MASTER_SITES= SF MAINTAINER= x11@FreeBSD.org COMMENT= open source implementation of the GLUT library LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING USES= cmake pathfix USE_LDCONFIG= yes USE_XORG= ice x11 xi xrandr USE_GL= gl glu CPPFLAGS+= -I${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib -lusbhid -lm INSTALL_TARGET= install/strip DOCS= download.html freeglut.html freeglut_logo.png \ freeglut_user_interface.html index.html ogl_sm.png \ progress.html structure.html BINS= CallbackMaker Fractals Fractals_random Lorenz One Resizer \ multi-touch shapes smooth_opengl3 spaceball subwin timer OPTIONS_DEFINE= DOCS EXAMPLES .include pre-configure: .for fract in Fractals/fractals.c Fractals_random/fractals_random.c @${REINPLACE_CMD} -e "s|/usr/local|${PREFIX}|g" \ ${WRKSRC}/progs/demos/${fract} .endfor post-install: .if ${PORT_OPTIONS:MDOCS} @${MKDIR} ${STAGEDIR}${DOCSDIR} .for FILE in ${DOCS} ${INSTALL_DATA} ${WRKSRC}/doc/${FILE} ${STAGEDIR}${DOCSDIR} .endfor @${ECHO_MSG} "===> Documentation installed in ${DOCSDIR}." .endif .if ${PORT_OPTIONS:MEXAMPLES} @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} ${INSTALL_DATA} ${WRKSRC}/progs/demos/Fractals/fractals.dat ${STAGEDIR}${EXAMPLESDIR} .for prog in ${BINS} ${INSTALL_PROGRAM} ${WRKSRC}/bin/${prog} ${STAGEDIR}${EXAMPLESDIR} .endfor @${ECHO_MSG} "===> Examples installed in ${EXAMPLESDIR}." .endif .include Index: head/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h =================================================================== --- head/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h (revision 482976) +++ head/graphics/freeglut/files/patch-src_x11_fg__internal__x11.h (revision 482977) @@ -1,76 +1,85 @@ --- src/x11/fg_internal_x11.h.orig 2014-10-20 15:27:04 UTC +++ src/x11/fg_internal_x11.h -@@ -136,8 +136,42 @@ struct tagSFG_PlatformWindowState +@@ -136,11 +136,50 @@ struct tagSFG_PlatformWindowState #include # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) + +static int hatmap_x[9] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 }; +static int hatmap_y[9] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 }; + +/* Idents lower than USB_IDENT_OFFSET are for analog joysticks. */ +# define USB_IDENT_OFFSET 2 + +# define USBDEV "/dev/usb" +# define UHIDDEV "/dev/uhid" +# define AJSDEV "/dev/joy" + /* XXX The below hack is done until freeglut's autoconf is updated. */ # define HAVE_USB_JS 1 +# if defined(__NetBSD__) +/* XXX The below hack is done until freeglut's autoconf is updated. */ +# define HAVE_USBHID_H 1 +# ifdef HAVE_USBHID_H +# include +# else +# include +# endif +# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +# ifdef HAVE_USBHID_H +# include +# else +# include +# endif +# include +# endif +# include +# include -+ + +/* Compatibility with older usb.h revisions */ +# if !defined(USB_MAX_DEVNAMES) && defined(MAXDEVNAMES) +# define USB_MAX_DEVNAMES MAXDEVNAMES +# endif - ++ # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - # include -@@ -189,6 +223,30 @@ struct tagSFG_PlatformWindowState +-# include ++struct joystick { ++ int x; ++ int y; ++ int b1; ++ int b2; ++}; + # else + /* + * XXX NetBSD/amd64 systems may find that they have to steal the +@@ -189,6 +228,30 @@ struct tagSFG_PlatformWindowState */ # define _JS_MAX_AXES 16 typedef struct tagSFG_PlatformJoystick SFG_PlatformJoystick; + +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) +struct os_specific_s { + char fname [128 ]; + int fd; + int is_analog; + /* The following structure members are specific to analog joysticks */ + struct joystick ajs; +# ifdef HAVE_USB_JS + /* The following structure members are specific to USB joysticks */ + struct hid_item *hids; + int hid_dlen; + int hid_offset; + char *hid_data_buf; + int axes_usage [ _JS_MAX_AXES ]; +# endif + /* We keep button and axes state ourselves, as they might not be updated + * on every read of a USB device + */ + int cache_buttons; + float cache_axes [ _JS_MAX_AXES ]; +}; +# endif + struct tagSFG_PlatformJoystick { # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)