From eeccaba1d365f8ce622c38cbd59c07ef28d9c335 Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Wed, 15 Jan 2014 00:55:06 -0600
Subject: Haiku: Clean up includes

* Remove random references to be/os/

diff --git a/src/joystick/beos/SDL_bejoystick.cc b/src/joystick/beos/SDL_bejoystick.cc
index c324581..2b93d09 100644
--- a/src/joystick/beos/SDL_bejoystick.cc
+++ b/src/joystick/beos/SDL_bejoystick.cc
@@ -24,8 +24,8 @@
 
 /* This is the system specific header for the SDL joystick API */
 
-#include <be/support/String.h>
-#include <be/device/Joystick.h>
+#include <String.h>
+#include <Joystick.h>
 
 extern "C"
 {
diff --git a/src/loadso/beos/SDL_sysloadso.c b/src/loadso/beos/SDL_sysloadso.c
index 524cd71..0679bcb 100644
--- a/src/loadso/beos/SDL_sysloadso.c
+++ b/src/loadso/beos/SDL_sysloadso.c
@@ -26,7 +26,7 @@
 /* System dependent library loading routines                           */
 
 #include <stdio.h>
-#include <be/kernel/image.h>
+#include <image.h>
 
 #include "SDL_loadso.h"
 
diff --git a/src/thread/beos/SDL_syssem.c b/src/thread/beos/SDL_syssem.c
index 9661f90..269557e 100644
--- a/src/thread/beos/SDL_syssem.c
+++ b/src/thread/beos/SDL_syssem.c
@@ -24,7 +24,7 @@
 
 /* Semaphores in the BeOS environment */
 
-#include <be/kernel/OS.h>
+#include <OS.h>
 
 #include "SDL_thread.h"
 
diff --git a/src/thread/beos/SDL_systhread.c b/src/thread/beos/SDL_systhread.c
index 11646f9..7371f0a 100644
--- a/src/thread/beos/SDL_systhread.c
+++ b/src/thread/beos/SDL_systhread.c
@@ -26,7 +26,7 @@
 
 #include <stdio.h>
 #include <signal.h>
-#include <be/kernel/OS.h>
+#include <OS.h>
 
 #include "SDL_mutex.h"
 #include "SDL_thread.h"
diff --git a/src/thread/beos/SDL_systhread_c.h b/src/thread/beos/SDL_systhread_c.h
index a350ab5..65ef60d 100644
--- a/src/thread/beos/SDL_systhread_c.h
+++ b/src/thread/beos/SDL_systhread_c.h
@@ -21,7 +21,7 @@
 #include "SDL_config.h"
 
 #include <signal.h>
-#include <be/kernel/OS.h>
+#include <OS.h>
 
 typedef thread_id SYS_ThreadHandle;
 
diff --git a/src/timer/beos/SDL_systimer.c b/src/timer/beos/SDL_systimer.c
index fd22e44..370e2d9 100644
--- a/src/timer/beos/SDL_systimer.c
+++ b/src/timer/beos/SDL_systimer.c
@@ -22,7 +22,7 @@
 
 #ifdef SDL_TIMER_BEOS
 
-#include <be/kernel/OS.h>
+#include <OS.h>
 
 #include "SDL_timer.h"
 
diff --git a/src/video/bwindow/SDL_BWin.h b/src/video/bwindow/SDL_BWin.h
index 6b6a71e..fc034ed 100644
--- a/src/video/bwindow/SDL_BWin.h
+++ b/src/video/bwindow/SDL_BWin.h
@@ -38,9 +38,9 @@ extern "C" {
 #include <stdio.h>
 #include <AppKit.h>
 #include <InterfaceKit.h>
-#include <be/game/DirectWindow.h>
+#include <DirectWindow.h>
 #if SDL_VIDEO_OPENGL
-#include <be/opengl/GLView.h>
+#include <GLView.h>
 #endif
 #include "SDL_events.h"
 #include "../../main/beos/SDL_BApp.h"
-- 
1.8.3.4


From ca4d682e5434f5ca262d01c70f9db522b24c6844 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 10 Jul 2014 15:07:01 +0200
Subject: Initialize variable to avoid crash.


diff --git a/src/video/bwindow/SDL_BWin.h b/src/video/bwindow/SDL_BWin.h
index fc034ed..3246bad 100644
--- a/src/video/bwindow/SDL_BWin.h
+++ b/src/video/bwindow/SDL_BWin.h
@@ -83,6 +83,7 @@ class SDL_BWin:public BDirectWindow
         _trash_window_buffer = false;
         _buffer_locker = new BLocker();
         _bitmap = NULL;
+		_clips = NULL;
 #ifdef DRAWTHREAD
         _draw_thread_id = spawn_thread(BE_DrawThread, "drawing_thread",
                             B_NORMAL_PRIORITY, (void*) this);
-- 
1.8.3.4


From ffd12eaadf11ce7b2ec606cbbf8a29913f9681b8 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 10 Jul 2014 17:22:57 +0200
Subject: Use dlopen for SDL loadso.

* This works fine, no need for platform specific implementation.

diff --git a/configure.in b/configure.in
index 5c56f00..3b024ac 100644
--- a/configure.in
+++ b/configure.in
@@ -2616,6 +2616,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
     *-*-beos* | *-*-haiku*)
         ARCH=beos
         ac_default_prefix=/boot/common
+        CheckDLOPEN
         CheckDummyVideo
         CheckDiskAudio
         CheckDummyAudio
@@ -2647,12 +2648,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
             have_timers=yes
         fi
-        # Set up files for the shared object loading library
-        if test x$enable_loadso = xyes; then
-            AC_DEFINE(SDL_LOADSO_BEOS, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
-            have_loadso=yes
-        fi
         # Set up files for the system power library
         if test x$enable_power = xyes; then
             AC_DEFINE(SDL_POWER_BEOS, 1, [ ])
diff --git a/src/loadso/beos/SDL_sysloadso.c b/src/loadso/beos/SDL_sysloadso.c
deleted file mode 100644
index 0679bcb..0000000
--- a/src/loadso/beos/SDL_sysloadso.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "SDL_config.h"
-
-#ifdef SDL_LOADSO_BEOS
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines                           */
-
-#include <stdio.h>
-#include <image.h>
-
-#include "SDL_loadso.h"
-
-void *
-SDL_LoadObject(const char *sofile)
-{
-    void *handle = NULL;
-    image_id library_id = load_add_on(sofile);
-    if (library_id < 0) {
-        SDL_SetError(strerror((int) library_id));
-    } else {
-        handle = (void *) (library_id);
-    }
-    return (handle);
-}
-
-void *
-SDL_LoadFunction(void *handle, const char *name)
-{
-    void *sym = NULL;
-    image_id library_id = (image_id) handle;
-    status_t rc =
-        get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym);
-    if (rc != B_NO_ERROR) {
-        SDL_SetError(strerror(rc));
-    }
-    return (sym);
-}
-
-void
-SDL_UnloadObject(void *handle)
-{
-    image_id library_id;
-    if (handle != NULL) {
-        library_id = (image_id) handle;
-        unload_add_on(library_id);
-    }
-}
-
-#endif /* SDL_LOADSO_BEOS */
-
-/* vi: set ts=4 sw=4 expandtab: */
-- 
1.8.3.4


From 077d0aedbb3e593a62aabc2933addbfe9fef1bb0 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 11 Jul 2014 11:54:17 +0200
Subject: SDL_thread: gcc2 fix.


diff --git a/include/SDL_thread.h b/include/SDL_thread.h
index f248c3d..1e1ccec 100644
--- a/include/SDL_thread.h
+++ b/include/SDL_thread.h
@@ -228,7 +228,8 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
  *  \sa SDL_TLSCreate()
  *  \sa SDL_TLSGet()
  */
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
+typedef void(*Destructor)(void*);
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, Destructor destructor);
 
 
 /* Ends C function definitions when using C++ */
-- 
1.8.3.4

