]> Sergey Matveev's repositories - bass.git/commitdiff
MuPDF with working Unicode-aware FreeGLUT
authorSergey Matveev <stargrave@stargrave.org>
Wed, 4 Mar 2026 10:56:08 +0000 (13:56 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 4 Mar 2026 13:08:54 +0000 (16:08 +0300)
build/skel/graphics/mupdf-1.27.2.do
build/skel/graphics/mupdf-freeglut-fg_joystick.c [new file with mode: 0644]
build/skel/graphics/mupdf-freeglut-fg_joystick_x11.c [new file with mode: 0644]

index 7d74b0e8df9de2f47d1310ffacd92bbe2291de6da16658f4009839c0e4a9b88e..1d58815fe645390985d4c2dad9d363ba831bffb375d0ec4d2e79ac7cf04e336f 100644 (file)
@@ -24,9 +24,12 @@ $TAR xf "$DISTFILES"/$NAME.tar.zst --options read_concatenated_archives
 "$BASS_ROOT"/bin/rm-r "$SKELBINS"/$ARCH/$NAME-$hsh
 
 cd $NAME
+# use dummy joystick handlers, as does not work on FreeBSD
+cp "$BASS_ROOT"/build/skel/graphics/mupdf-freeglut-fg_joystick.c thirdparty/freeglut/src/fg_joystick.c
+cp "$BASS_ROOT"/build/skel/graphics/mupdf-freeglut-fg_joystick_x11.c thirdparty/freeglut/src/x11/fg_joystick_x11.c
 perl -i -npe "s/-lfreetype2/-lfreetype/" Makerules
 XCFLAGS=-fPIC gmake -j$MAKE_JOBS \
-    HAVE_GLUT=no \
+    HAVE_X11=no \
     HAVE_CURL=no \
     USE_SYSTEM_FREETYPE=yes \
     USE_SYSTEM_HARFBUZZ=yes \
diff --git a/build/skel/graphics/mupdf-freeglut-fg_joystick.c b/build/skel/graphics/mupdf-freeglut-fg_joystick.c
new file mode 100644 (file)
index 0000000..a009776
--- /dev/null
@@ -0,0 +1,140 @@
+#include <GL/freeglut.h>
+#include "fg_internal.h"
+#ifdef HAVE_SYS_PARAM_H
+#    include <sys/param.h>
+#endif
+
+#define JS_TRUE  1
+#define JS_FALSE 0
+
+/* External function declarations (mostly platform-specific) */
+extern void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes );
+extern void fgPlatformJoystickOpen( SFG_Joystick* joy );
+extern void fgPlatformJoystickInit( SFG_Joystick *fgJoystick[], int ident );
+extern void fgPlatformJoystickClose ( int ident );
+
+#define MAX_NUM_JOYSTICKS  2
+SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
+
+void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
+{
+}
+
+void fgPlatformJoystickOpen( SFG_Joystick* joy )
+{
+    joy->error = GL_TRUE;
+}
+
+void fgPlatformJoystickInit( SFG_Joystick *fgJoystick[], int ident )
+{
+    fgJoystick[ ident ]->id = ident;
+    fgJoystick[ ident ]->error = GL_FALSE;
+}
+
+void fgPlatformJoystickClose ( int ident )
+{
+}
+
+void fgInitialiseJoysticks ( void )
+{
+}
+
+void fgJoystickClose( void )
+{
+}
+
+void fgJoystickPollWindow( SFG_Window* window )
+{
+}
+
+int fgJoystickDetect( void )
+{
+    return 0;
+}
+
+void FGAPIENTRY glutForceJoystickFunc( void )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutForceJoystickFunc" );
+#if !defined(_WIN32_WCE)
+    freeglut_return_if_fail( fgStructure.CurrentWindow != NULL );
+    freeglut_return_if_fail( FETCH_WCB( *( fgStructure.CurrentWindow ), Joystick ) );
+    fgJoystickPollWindow( fgStructure.CurrentWindow );
+#endif /* !defined(_WIN32_WCE) */
+}
+int  glutJoystickGetNumAxes( int ident )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickGetNumAxes" );
+    return fgJoystick[ ident ]->num_axes;
+}
+int  glutJoystickGetNumButtons( int ident )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickGetNumButtons" );
+    return fgJoystick[ ident ]->num_buttons;
+}
+int  glutJoystickNotWorking( int ident )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickNotWorking" );
+    return fgJoystick[ ident ]->error;
+}
+
+float glutJoystickGetDeadBand( int ident, int axis )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickGetDeadBand" );
+    return fgJoystick[ ident ]->dead_band [ axis ];
+}
+void  glutJoystickSetDeadBand( int ident, int axis, float db )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickSetDeadBand" );
+    fgJoystick[ ident ]->dead_band[ axis ] = db;
+}
+
+float glutJoystickGetSaturation( int ident, int axis )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickGetSaturation" );
+    return fgJoystick[ ident ]->saturate[ axis ];
+}
+void  glutJoystickSetSaturation( int ident, int axis, float st )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickSetSaturation" );
+    fgJoystick[ ident ]->saturate [ axis ] = st;
+}
+
+void glutJoystickSetMinRange( int ident, float *axes )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickSetMinRange" );
+    memcpy( fgJoystick[ ident ]->min, axes,
+            fgJoystick[ ident ]->num_axes * sizeof( float ) );
+}
+void glutJoystickSetMaxRange( int ident, float *axes )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickSetMaxRange" );
+    memcpy( fgJoystick[ ident ]->max, axes,
+            fgJoystick[ ident ]->num_axes * sizeof( float ) );
+}
+void glutJoystickSetCenter( int ident, float *axes )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickSetCenter" );
+    memcpy( fgJoystick[ ident ]->center, axes,
+            fgJoystick[ ident ]->num_axes * sizeof( float ) );
+}
+
+void glutJoystickGetMinRange( int ident, float *axes )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickGetMinRange" );
+    memcpy( axes, fgJoystick[ ident ]->min,
+            fgJoystick[ ident ]->num_axes * sizeof( float ) );
+}
+void glutJoystickGetMaxRange( int ident, float *axes )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickGetMaxRange" );
+    memcpy( axes, fgJoystick[ ident ]->max,
+            fgJoystick[ ident ]->num_axes * sizeof( float ) );
+}
+void glutJoystickGetCenter( int ident, float *axes )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutJoystickGetCenter" );
+    memcpy( axes, fgJoystick[ ident ]->center,
+            fgJoystick[ ident ]->num_axes * sizeof( float ) );
+}
+
+/*** END OF FILE ***/
diff --git a/build/skel/graphics/mupdf-freeglut-fg_joystick_x11.c b/build/skel/graphics/mupdf-freeglut-fg_joystick_x11.c
new file mode 100644 (file)
index 0000000..89212ac
--- /dev/null
@@ -0,0 +1,31 @@
+#include <GL/freeglut.h>
+#include "../fg_internal.h"
+#ifdef HAVE_SYS_PARAM_H
+#    include <sys/param.h>
+#endif
+
+#include <fcntl.h>
+
+#define MAX_NUM_JOYSTICKS  2
+extern SFG_Joystick *fgJoystick [ MAX_NUM_JOYSTICKS ];
+
+void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
+{
+    joy->error = GL_TRUE;
+    return;
+}
+
+void fgPlatformJoystickOpen( SFG_Joystick* joy )
+{
+    joy->error = 1;
+}
+
+void fgPlatformJoystickInit( SFG_Joystick *fgJoystick[], int ident )
+{
+    fgJoystick[ ident ]->id = ident;
+    fgJoystick[ ident ]->error = GL_TRUE;
+}
+
+void fgPlatformJoystickClose ( int ident )
+{
+}