[Commits] SDL: haiku: Various fixes from haikuports.

libsdl.org revision control commits-owner at libsdl.org
Mon May 1 15:40:34 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/9f9160df4f1f
changeset: 10983:9f9160df4f1f
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Mon May 01 18:39:05 2017 -0400
description:
haiku: Various fixes from haikuports.

Based on patch here:

https://github.com/haikuports/haikuports/blob/master/media-libs/libsdl2/patches/libsdl2-2.0.5.patchset

diffstat:

 configure                          |  17 +++++++++++------
 configure.in                       |  12 ++++++------
 src/main/haiku/SDL_BeApp.cc        |  21 ++++++++++++++++++++-
 src/thread/pthread/SDL_systhread.c |   2 +-
 src/video/haiku/SDL_BWin.h         |   4 ++--
 src/video/haiku/SDL_bopengl.cc     |   3 ++-
 6 files changed, 42 insertions(+), 17 deletions(-)

diffs (199 lines):

diff -r d49da5f38a14 -r 9f9160df4f1f configure
--- a/configure	Sat Apr 29 22:50:35 2017 +0200
+++ b/configure	Mon May 01 18:39:05 2017 -0400
@@ -16744,7 +16744,8 @@
     ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include <signal.h>
 "
 if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes; then :
-  $as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h
+
+$as_echo "#define HAVE_SA_SIGACTION /**/" >>confdefs.h
 
 fi
 
@@ -20173,7 +20174,8 @@
 if ac_fn_c_try_compile "$LINENO"; then :
 
             have_const_param_XextAddDisplay=yes
-            $as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1" >>confdefs.h
+
+$as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY /**/" >>confdefs.h
 
 
 fi
@@ -20207,7 +20209,8 @@
 if ac_fn_c_try_compile "$LINENO"; then :
 
                 have_XGenericEvent=yes
-                $as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h
+
+$as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS /**/" >>confdefs.h
 
 
 fi
@@ -20552,7 +20555,8 @@
 if ac_fn_c_try_compile "$LINENO"; then :
 
             	have_xinput2_multitouch=yes
-            	$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h
+
+$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /**/" >>confdefs.h
 
                 SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
 
@@ -22278,7 +22282,8 @@
 if ac_fn_c_try_link "$LINENO"; then :
 
                 have_sem_timedwait=yes
-                $as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h
+
+$as_echo "#define HAVE_SEM_TIMEDWAIT /**/" >>confdefs.h
 
 
 fi
@@ -23670,7 +23675,7 @@
         fi
         # The Haiku platform requires special setup.
         SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding -lstdc++.r4"
         ;;
     arm*-apple-darwin*|*-ios-*)
         ARCH=ios
diff -r d49da5f38a14 -r 9f9160df4f1f configure.in
--- a/configure.in	Sat Apr 29 22:50:35 2017 +0200
+++ b/configure.in	Mon May 01 18:39:05 2017 -0400
@@ -276,7 +276,7 @@
     AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
     AC_CHECK_FUNCS(iconv)
 
-    AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include <signal.h>])
+    AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], [], [Description])], ,[#include <signal.h>])
 fi
 
 dnl AC_CHECK_SIZEOF(void*)
@@ -1619,7 +1619,7 @@
             ],[
             ],[
             have_const_param_XextAddDisplay=yes
-            AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY)
+            AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], [], [Description])
             ])
             AC_MSG_RESULT($have_const_param_XextAddDisplay)
 
@@ -1637,7 +1637,7 @@
 XFreeEventData(display, cookie);
             ],[
                 have_XGenericEvent=yes
-                AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
+                AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], [], [Description])
             ])
             AC_MSG_RESULT($have_XGenericEvent)
 
@@ -1751,7 +1751,7 @@
 XITouchClassInfo *t;
             	],[
             	have_xinput2_multitouch=yes
-            	AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
+            	AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], [], [Description])
                 SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
             	])
             	AC_MSG_RESULT($have_xinput2_multitouch)
@@ -2605,7 +2605,7 @@
                   sem_timedwait(NULL, NULL);
                 ],[
                 have_sem_timedwait=yes
-                AC_DEFINE(HAVE_SEM_TIMEDWAIT)
+                AC_DEFINE([HAVE_SEM_TIMEDWAIT], [], [Description])
                 ])
                 AC_MSG_RESULT($have_sem_timedwait)
             fi
@@ -3345,7 +3345,7 @@
         fi
         # The Haiku platform requires special setup.
         SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding -lstdc++.r4"
         ;;
     arm*-apple-darwin*|*-ios-*)
         ARCH=ios
diff -r d49da5f38a14 -r 9f9160df4f1f src/main/haiku/SDL_BeApp.cc
--- a/src/main/haiku/SDL_BeApp.cc	Sat Apr 29 22:50:35 2017 +0200
+++ b/src/main/haiku/SDL_BeApp.cc	Mon May 01 18:39:05 2017 -0400
@@ -25,8 +25,10 @@
 /* Handle the BeApp specific portions of the application */
 
 #include <AppKit.h>
+#include <storage/AppFileInfo.h>
 #include <storage/Path.h>
 #include <storage/Entry.h>
+#include <storage/File.h>
 #include <unistd.h>
 
 #include "SDL_BApp.h"	/* SDL_BApp class definition */
@@ -51,7 +53,24 @@
 {
     BApplication *App;
 
-    App = new SDL_BApp("application/x-SDL-executable");
+	// default application signature
+	const char *signature = "application/x-SDL-executable";
+	// dig resources for correct signature
+	image_info info;
+	int32 cookie = 0;
+	if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
+		BFile f(info.name, O_RDONLY);
+		if (f.InitCheck() == B_OK) {
+			BAppFileInfo app_info(&f);
+			if (app_info.InitCheck() == B_OK) {
+				char sig[B_MIME_TYPE_LENGTH];
+				if (app_info.GetSignature(sig) == B_OK)
+					signature = strndup(sig, B_MIME_TYPE_LENGTH);
+			}
+		}
+	}
+
+	App = new SDL_BApp(signature);
 
     App->Run();
     delete App;
diff -r d49da5f38a14 -r 9f9160df4f1f src/thread/pthread/SDL_systhread.c
--- a/src/thread/pthread/SDL_systhread.c	Sat Apr 29 22:50:35 2017 +0200
+++ b/src/thread/pthread/SDL_systhread.c	Mon May 01 18:39:05 2017 -0400
@@ -52,7 +52,7 @@
 #endif
 
 #ifdef __HAIKU__
-#include <be/kernel/OS.h>
+#include <kernel/OS.h>
 #endif
 
 #include "SDL_assert.h"
diff -r d49da5f38a14 -r 9f9160df4f1f src/video/haiku/SDL_BWin.h
--- a/src/video/haiku/SDL_BWin.h	Sat Apr 29 22:50:35 2017 +0200
+++ b/src/video/haiku/SDL_BWin.h	Mon May 01 18:39:05 2017 -0400
@@ -38,9 +38,9 @@
 #include <stdio.h>
 #include <AppKit.h>
 #include <InterfaceKit.h>
-#include <be/game/DirectWindow.h>
+#include <game/DirectWindow.h>
 #if SDL_VIDEO_OPENGL
-#include <be/opengl/GLView.h>
+#include <opengl/GLView.h>
 #endif
 #include "SDL_events.h"
 #include "../../main/haiku/SDL_BApp.h"
diff -r d49da5f38a14 -r 9f9160df4f1f src/video/haiku/SDL_bopengl.cc
--- a/src/video/haiku/SDL_bopengl.cc	Sat Apr 29 22:50:35 2017 +0200
+++ b/src/video/haiku/SDL_bopengl.cc	Mon May 01 18:39:05 2017 -0400
@@ -94,7 +94,8 @@
 }
 
 int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
-    _GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView());
+    SDL_BWin* win = (SDL_BWin*)context;
+    _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL);
     return 0;
 }
 


More information about the commits mailing list