mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-29 11:38:52 +02:00
Removing old libsdl patches as they have all now been applied upstream.
This commit is contained in:
@@ -1,188 +0,0 @@
|
|||||||
Index: src/video/bwindow/SDL_sysyuv.cc
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysyuv.cc (revision 4458)
|
|
||||||
+++ src/video/bwindow/SDL_sysyuv.cc (working copy)
|
|
||||||
@@ -94,7 +94,7 @@
|
|
||||||
|
|
||||||
// See <GraphicsDefs.h> [btw: Cb=U, Cr=V]
|
|
||||||
// See also http://www.fourcc.org/indexyuv.htm
|
|
||||||
-enum color_space convert_color_space(Uint32 format) {
|
|
||||||
+color_space convert_color_space(Uint32 format) {
|
|
||||||
switch (format) {
|
|
||||||
case SDL_YV12_OVERLAY:
|
|
||||||
return B_YUV9;
|
|
||||||
Index: src/video/bwindow/SDL_sysyuv.h
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysyuv.h (revision 4458)
|
|
||||||
+++ src/video/bwindow/SDL_sysyuv.h (working copy)
|
|
||||||
@@ -62,7 +62,7 @@
|
|
||||||
};
|
|
||||||
|
|
||||||
extern BBitmap * BE_GetOverlayBitmap(BRect bounds, color_space cs);
|
|
||||||
-extern SDL_Overlay* BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface* display);
|
|
||||||
+SDL_Overlay* BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface* display);
|
|
||||||
extern int BE_LockYUVOverlay(_THIS, SDL_Overlay* overlay);
|
|
||||||
extern void BE_UnlockYUVOverlay(_THIS, SDL_Overlay* overlay);
|
|
||||||
extern int BE_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* src, SDL_Rect* dst);
|
|
||||||
Index: src/video/bwindow/SDL_sysvideo.cc
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysvideo.cc (revision 4458)
|
|
||||||
+++ src/video/bwindow/SDL_sysvideo.cc (working copy)
|
|
||||||
@@ -57,7 +57,7 @@
|
|
||||||
static void BE_FreeHWSurface(_THIS, SDL_Surface *surface);
|
|
||||||
|
|
||||||
static int BE_ToggleFullScreen(_THIS, int fullscreen);
|
|
||||||
-static SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
+SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
|
|
||||||
/* OpenGL functions */
|
|
||||||
#if SDL_VIDEO_OPENGL
|
|
||||||
@@ -446,8 +446,11 @@
|
|
||||||
* of the BBitmap due to the InhibitResize call above. Thus the
|
|
||||||
* bitmap (pixel data) never changes.
|
|
||||||
*/
|
|
||||||
- SDL_Win->ResizeTo(width, height);
|
|
||||||
bounds = bscreen.Frame();
|
|
||||||
+ if (fullscreen)
|
|
||||||
+ SDL_Win->ResizeTo(bounds.Width(), bounds.Height());
|
|
||||||
+ else
|
|
||||||
+ SDL_Win->ResizeTo(width, height);
|
|
||||||
/* Calculate offsets - used either to center window
|
|
||||||
* (windowed mode) or to set drawing offsets (fullscreen mode)
|
|
||||||
*/
|
|
||||||
@@ -460,10 +463,13 @@
|
|
||||||
} else {
|
|
||||||
SDL_Win->SetXYOffset(0, 0);
|
|
||||||
}
|
|
||||||
- if ( ! needs_unlock || was_fullscreen ) {
|
|
||||||
+ if ( ! needs_unlock || (was_fullscreen && !fullscreen)) {
|
|
||||||
/* Center the window the first time */
|
|
||||||
SDL_Win->MoveTo(cx, cy);
|
|
||||||
}
|
|
||||||
+ if (fullscreen)
|
|
||||||
+ SDL_Win->MoveTo(0,0);
|
|
||||||
+
|
|
||||||
SDL_Win->Show();
|
|
||||||
|
|
||||||
/* Unlock the window manually after the first Show() */
|
|
||||||
@@ -637,8 +643,12 @@
|
|
||||||
int32 cookie = 0;
|
|
||||||
while (get_next_image_info(0,&cookie,&info) == B_OK) {
|
|
||||||
void *location = NULL;
|
|
||||||
- if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) {
|
|
||||||
- _this->gl_config.dll_handle = (void*)cookie;
|
|
||||||
+#ifdef __HAIKU__
|
|
||||||
+ if (get_image_symbol(info.id,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) { // This is how it actually works in Haiku
|
|
||||||
+#else
|
|
||||||
+ if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) { // I don't know if that *did* work in BeOS
|
|
||||||
+#endif
|
|
||||||
+ _this->gl_config.dll_handle = (void*)info.id;
|
|
||||||
_this->gl_config.driver_loaded = 1;
|
|
||||||
SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", SDL_arraysize(_this->gl_config.driver_path));
|
|
||||||
}
|
|
||||||
Index: test/configure.in
|
|
||||||
===================================================================
|
|
||||||
--- test/configure.in (revision 4458)
|
|
||||||
+++ test/configure.in (working copy)
|
|
||||||
@@ -20,7 +20,7 @@
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lopengl32"
|
|
||||||
;;
|
|
||||||
- *-*-beos*)
|
|
||||||
+ *-*-beos* | *-*-haiku*)
|
|
||||||
EXE=""
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lGL"
|
|
||||||
Index: test/testplatform.c
|
|
||||||
===================================================================
|
|
||||||
--- test/testplatform.c (revision 4458)
|
|
||||||
+++ test/testplatform.c (working copy)
|
|
||||||
@@ -162,6 +162,8 @@
|
|
||||||
"Dreamcast"
|
|
||||||
#elif __FREEBSD__
|
|
||||||
"FreeBSD"
|
|
||||||
+#elif __HAIKU__
|
|
||||||
+ "Haiku"
|
|
||||||
#elif __HPUX__
|
|
||||||
"HP-UX"
|
|
||||||
#elif __IRIX__
|
|
||||||
Index: include/begin_code.h
|
|
||||||
===================================================================
|
|
||||||
--- include/begin_code.h (revision 4458)
|
|
||||||
+++ include/begin_code.h (working copy)
|
|
||||||
@@ -33,7 +33,7 @@
|
|
||||||
|
|
||||||
/* Some compilers use a special export keyword */
|
|
||||||
#ifndef DECLSPEC
|
|
||||||
-# if defined(__BEOS__)
|
|
||||||
+# if defined(__BEOS__) || defined(__HAIKU__)
|
|
||||||
# if defined(__GNUC__)
|
|
||||||
# define DECLSPEC __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
Index: include/SDL_platform.h
|
|
||||||
===================================================================
|
|
||||||
--- include/SDL_platform.h (revision 4458)
|
|
||||||
+++ include/SDL_platform.h (working copy)
|
|
||||||
@@ -33,6 +33,10 @@
|
|
||||||
#undef __BEOS__
|
|
||||||
#define __BEOS__ 1
|
|
||||||
#endif
|
|
||||||
+#if defined(__HAIKU__)
|
|
||||||
+#undef __HAIKU__
|
|
||||||
+#define __HAIKU__ 1
|
|
||||||
+#endif
|
|
||||||
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
|
||||||
#undef __BSDI__
|
|
||||||
#define __BSDI__ 1
|
|
||||||
@@ -45,6 +49,10 @@
|
|
||||||
#undef __FREEBSD__
|
|
||||||
#define __FREEBSD__ 1
|
|
||||||
#endif
|
|
||||||
+#if defined(__HAIKU__)
|
|
||||||
+#undef __HAIKU__
|
|
||||||
+#define __HAIKU__ 1
|
|
||||||
+#endif
|
|
||||||
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
|
|
||||||
#undef __HPUX__
|
|
||||||
#define __HPUX__ 1
|
|
||||||
Index: configure.in
|
|
||||||
===================================================================
|
|
||||||
--- configure.in (revision 4458)
|
|
||||||
+++ configure.in (working copy)
|
|
||||||
@@ -40,7 +40,7 @@
|
|
||||||
AC_SUBST(LT_AGE)
|
|
||||||
|
|
||||||
dnl Detect the canonical build and host environments
|
|
||||||
-AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
|
|
||||||
+AC_CONFIG_AUX_DIR([build-scripts])
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
AC_C_BIGENDIAN
|
|
||||||
if test x$ac_cv_c_bigendian = xyes; then
|
|
||||||
@@ -2493,7 +2493,7 @@
|
|
||||||
SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
|
|
||||||
SDL_LIBS="-lSDLmain $SDL_LIBS"
|
|
||||||
;;
|
|
||||||
- *-*-beos*)
|
|
||||||
+ *-*-beos* | *-*-haiku*)
|
|
||||||
ARCH=beos
|
|
||||||
ac_default_prefix=/boot/develop/tools/gnupro
|
|
||||||
CheckDummyVideo
|
|
||||||
@@ -2536,8 +2536,16 @@
|
|
||||||
fi
|
|
||||||
# Set up files for the shared object loading library
|
|
||||||
if test x$enable_loadso = xyes; then
|
|
||||||
- AC_DEFINE(SDL_LOADSO_BEOS)
|
|
||||||
- SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
|
|
||||||
+ case "$host" in
|
|
||||||
+ *-*-beos*)
|
|
||||||
+ AC_DEFINE(SDL_LOADSO_BEOS)
|
|
||||||
+ SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
|
|
||||||
+ ;;
|
|
||||||
+ *-*-haiku*)
|
|
||||||
+ AC_DEFINE(SDL_LOADSO_DLOPEN)
|
|
||||||
+ SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
|
|
||||||
+ ;;
|
|
||||||
+ esac
|
|
||||||
have_loadso=yes
|
|
||||||
fi
|
|
||||||
# The BeOS platform requires special setup.
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
Index: src/video/bwindow/SDL_BWin.h
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_BWin.h (revision 4707)
|
|
||||||
+++ src/video/bwindow/SDL_BWin.h (working copy)
|
|
||||||
@@ -267,6 +267,8 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void DispatchMessage(BMessage *msg, BHandler *target);
|
|
||||||
+
|
|
||||||
+ virtual void DirectConnected(direct_buffer_info *info);
|
|
||||||
|
|
||||||
private:
|
|
||||||
#if SDL_VIDEO_OPENGL
|
|
||||||
Index: src/video/bwindow/SDL_sysevents.cc
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysevents.cc (revision 4707)
|
|
||||||
+++ src/video/bwindow/SDL_sysevents.cc (working copy)
|
|
||||||
@@ -379,3 +379,20 @@
|
|
||||||
}
|
|
||||||
BDirectWindow::DispatchMessage(msg, target);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+void SDL_BWin::DirectConnected(direct_buffer_info *info) {
|
|
||||||
+ switch (info->buffer_state & B_DIRECT_MODE_MASK) {
|
|
||||||
+ case B_DIRECT_START:
|
|
||||||
+ case B_DIRECT_MODIFY:
|
|
||||||
+ {
|
|
||||||
+ int32 width = info->window_bounds.right -
|
|
||||||
+ info->window_bounds.left + 1;
|
|
||||||
+ int32 height = info->window_bounds.bottom -
|
|
||||||
+ info->window_bounds.top + 1;
|
|
||||||
+ SDL_PrivateResize(width, height);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ default:
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
Index: src/video/bwindow/SDL_sysvideo.cc
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysvideo.cc (revision 4707)
|
|
||||||
+++ src/video/bwindow/SDL_sysvideo.cc (working copy)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@
|
|
||||||
static void BE_FreeHWSurface(_THIS, SDL_Surface *surface);
|
|
||||||
|
|
||||||
static int BE_ToggleFullScreen(_THIS, int fullscreen);
|
|
||||||
-SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
+static SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
|
|
||||||
/* OpenGL functions */
|
|
||||||
#if SDL_VIDEO_OPENGL
|
|
||||||
@@ -362,7 +362,7 @@
|
|
||||||
(modes[i]->h > height); ++i ) {
|
|
||||||
/* still looking */
|
|
||||||
}
|
|
||||||
- if ( ! modes[i] || (modes[i]->w < width) || (modes[i]->h < width) ) {
|
|
||||||
+ if ( ! modes[i] || (modes[i]->w < width) || (modes[i]->h < height) ) {
|
|
||||||
--i; /* We went too far */
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -396,88 +396,89 @@
|
|
||||||
|
|
||||||
static int BE_SetFullScreen(_THIS, SDL_Surface *screen, int fullscreen)
|
|
||||||
{
|
|
||||||
- int was_fullscreen;
|
|
||||||
- bool needs_unlock;
|
|
||||||
+ printf("SetFullScreen(%d)\n", fullscreen);
|
|
||||||
BScreen bscreen;
|
|
||||||
- BRect bounds;
|
|
||||||
- display_mode mode;
|
|
||||||
- int width, height, bpp;
|
|
||||||
|
|
||||||
- /* Set the fullscreen mode */
|
|
||||||
- was_fullscreen = SDL_Win->IsFullScreen();
|
|
||||||
- SDL_Win->SetFullScreen(fullscreen);
|
|
||||||
- fullscreen = SDL_Win->IsFullScreen();
|
|
||||||
+ // TODO(bga): We must show the window before doing anything.
|
|
||||||
+ // SetFullSscreen() does not wqork as expected if called in a window
|
|
||||||
+ // that was never shown. This is probably a bug in the Haiku Game Kit that needs
|
|
||||||
+ // to be investigated.
|
|
||||||
+ if (SDL_Win->Lock()) {
|
|
||||||
+ // Show our window.
|
|
||||||
+ SDL_Win->Show();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (SDL_Win->IsLocked()) {
|
|
||||||
+ // Unlock the window if it was locked. This is needed as only the
|
|
||||||
+ // first call to Show() unlocks the looper. All other calls to it
|
|
||||||
+ // will not.
|
|
||||||
+ SDL_Win->Unlock();
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- width = screen->w;
|
|
||||||
- height = screen->h;
|
|
||||||
+ int width = screen->w;
|
|
||||||
+ int height = screen->h;
|
|
||||||
+
|
|
||||||
+ if (fullscreen) {
|
|
||||||
+ // Set resolution to the closest available one that matches the
|
|
||||||
+ // current SDL resolution.
|
|
||||||
+ display_mode mode;
|
|
||||||
+ bscreen.GetMode(&mode);
|
|
||||||
|
|
||||||
- /* Set the appropriate video mode */
|
|
||||||
- if ( fullscreen ) {
|
|
||||||
- bpp = screen->format->BitsPerPixel;
|
|
||||||
- bscreen.GetMode(&mode);
|
|
||||||
- if ( (bpp != ColorSpaceToBitsPerPixel(mode.space)) ||
|
|
||||||
- (width != mode.virtual_width) ||
|
|
||||||
- (height != mode.virtual_height)) {
|
|
||||||
+ int bpp = screen->format->BitsPerPixel;
|
|
||||||
+ if (bpp != ColorSpaceToBitsPerPixel(mode.space) ||
|
|
||||||
+ width != mode.virtual_width || height != mode.virtual_height) {
|
|
||||||
if(BE_FindClosestFSMode(_this, width, height, bpp, &mode)) {
|
|
||||||
bscreen.SetMode(&mode);
|
|
||||||
- /* This simply stops the next resize event from being
|
|
||||||
- * sent to the SDL handler.
|
|
||||||
- */
|
|
||||||
- SDL_Win->InhibitResize();
|
|
||||||
} else {
|
|
||||||
- fullscreen = 0;
|
|
||||||
- SDL_Win->SetFullScreen(fullscreen);
|
|
||||||
- }
|
|
||||||
+ printf("Could not set new mode.\n");
|
|
||||||
+ return(0);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
+ } else {
|
|
||||||
+ // Reset to the previous known resolution as we are now in window
|
|
||||||
+ // mode.
|
|
||||||
+ bscreen.SetMode(&saved_mode);
|
|
||||||
}
|
|
||||||
- if ( was_fullscreen && ! fullscreen ) {
|
|
||||||
- bscreen.SetMode(&saved_mode);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if ( SDL_Win->Lock() ) {
|
|
||||||
- int cx, cy;
|
|
||||||
- if ( SDL_Win->Shown() ) {
|
|
||||||
- needs_unlock = 1;
|
|
||||||
- SDL_Win->Hide();
|
|
||||||
- } else {
|
|
||||||
- needs_unlock = 0;
|
|
||||||
- }
|
|
||||||
- /* This resizes the window and view area, but inhibits resizing
|
|
||||||
- * of the BBitmap due to the InhibitResize call above. Thus the
|
|
||||||
- * bitmap (pixel data) never changes.
|
|
||||||
- */
|
|
||||||
+
|
|
||||||
+ // Effectivelly set/reset full screen mode. If we are already in
|
|
||||||
+ // full screen mode, we reset back to windowed mode first so the
|
|
||||||
+ // window can resize when going fullscreen.
|
|
||||||
+ if (fullscreen)
|
|
||||||
+ printf("Going fullscreen\n");
|
|
||||||
+ else
|
|
||||||
+ printf("Going windowed\n");
|
|
||||||
+ SDL_Win->SetFullScreen(fullscreen);
|
|
||||||
+
|
|
||||||
+ // Calculate offsets for centering the window (in window mode) and for
|
|
||||||
+ // dentering the bitmap (in full screen mode).
|
|
||||||
+ BRect bounds = bscreen.Frame();
|
|
||||||
+ bounds.PrintToStream();
|
|
||||||
+ int32 cx = (bounds.IntegerWidth() - width)/2;
|
|
||||||
+ int32 cy = (bounds.IntegerHeight() - height)/2;
|
|
||||||
+
|
|
||||||
+ printf ("cx = %d, cy = %d\n", cx, cy);
|
|
||||||
+ if (!SDL_Win->IsFullScreen()) {
|
|
||||||
+ printf("Doing not fullscreen stuff.\n");
|
|
||||||
+ // We are not in full screen mode, so we want to change the window
|
|
||||||
+ // size to match the resolution in SDL.
|
|
||||||
SDL_Win->ResizeTo(width, height);
|
|
||||||
- bounds = bscreen.Frame();
|
|
||||||
- /* Calculate offsets - used either to center window
|
|
||||||
- * (windowed mode) or to set drawing offsets (fullscreen mode)
|
|
||||||
- */
|
|
||||||
- cx = (bounds.IntegerWidth() - width)/2;
|
|
||||||
- cy = (bounds.IntegerHeight() - height)/2;
|
|
||||||
-
|
|
||||||
- if ( fullscreen ) {
|
|
||||||
- /* Set offset for drawing */
|
|
||||||
- SDL_Win->SetXYOffset(cx, cy);
|
|
||||||
- } else {
|
|
||||||
- SDL_Win->SetXYOffset(0, 0);
|
|
||||||
- }
|
|
||||||
- if ( ! needs_unlock || was_fullscreen ) {
|
|
||||||
- /* Center the window the first time */
|
|
||||||
- SDL_Win->MoveTo(cx, cy);
|
|
||||||
- }
|
|
||||||
- SDL_Win->Show();
|
|
||||||
|
|
||||||
- /* Unlock the window manually after the first Show() */
|
|
||||||
- if ( needs_unlock ) {
|
|
||||||
- SDL_Win->Unlock();
|
|
||||||
- }
|
|
||||||
+ // And also center the window and reset the drawing offset.
|
|
||||||
+ SDL_Win->MoveTo(cx, cy);
|
|
||||||
+ SDL_Win->SetXYOffset(0, 0);
|
|
||||||
+ } else {
|
|
||||||
+ printf("Doing fullscreen stuff.");
|
|
||||||
+ // Center the bitmap whenever we are in full screen mode.
|
|
||||||
+ SDL_Win->SetXYOffset(cx, cy);
|
|
||||||
}
|
|
||||||
-
|
|
||||||
- /* Set the fullscreen flag in the screen surface */
|
|
||||||
- if ( fullscreen ) {
|
|
||||||
+
|
|
||||||
+ // Set relevant internal SDL screen flags.
|
|
||||||
+ if (SDL_Win->IsFullScreen()) {
|
|
||||||
screen->flags |= SDL_FULLSCREEN;
|
|
||||||
} else {
|
|
||||||
screen->flags &= ~SDL_FULLSCREEN;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
diff -urN SDL-1.2.13/README.Haiku SDL-1.2.13-haiku/README.Haiku
|
|
||||||
--- SDL-1.2.13/README.Haiku 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ SDL-1.2.13-haiku/README.Haiku 2009-02-15 23:35:54.000000000 +0000
|
|
||||||
@@ -0,0 +1,13 @@
|
|
||||||
+
|
|
||||||
+SDL on Haiku
|
|
||||||
+==============
|
|
||||||
+
|
|
||||||
+You can build SDL on Haiku like any other GNU style package.
|
|
||||||
+e.g. ./configure && make && make install
|
|
||||||
+By default it is installed in /boot/develop/tools/gnupro/{bin,lib,etc.}
|
|
||||||
+
|
|
||||||
+Once you install SDL, you need to copy libSDL.so to /boot/home/config/lib,
|
|
||||||
+so it can be found by the dynamic linker.
|
|
||||||
+
|
|
||||||
+Enjoy!
|
|
||||||
+ Sam Lantinga (slouken@libsdl.org)
|
|
||||||
diff -urN SDL-1.2.13/configure.in SDL-1.2.13-haiku/configure.in
|
|
||||||
--- SDL-1.2.13/configure.in 2009-02-15 23:41:29.000000000 +0000
|
|
||||||
+++ SDL-1.2.13-haiku/configure.in 2009-02-15 23:35:54.000000000 +0000
|
|
||||||
@@ -40,7 +40,7 @@
|
|
||||||
AC_SUBST(LT_AGE)
|
|
||||||
|
|
||||||
dnl Detect the canonical build and host environments
|
|
||||||
-AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
|
|
||||||
+AC_CONFIG_AUX_DIR([build-scripts])
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
AC_C_BIGENDIAN
|
|
||||||
if test x$ac_cv_c_bigendian = xyes; then
|
|
||||||
@@ -2456,7 +2456,7 @@
|
|
||||||
SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
|
|
||||||
SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
|
|
||||||
;;
|
|
||||||
- *-*-beos*)
|
|
||||||
+ *-*-beos* | *-*-haiku*)
|
|
||||||
ARCH=beos
|
|
||||||
ac_default_prefix=/boot/develop/tools/gnupro
|
|
||||||
CheckDummyVideo
|
|
||||||
diff -urN SDL-1.2.13/include/SDL_platform.h SDL-1.2.13-haiku/include/SDL_platform.h
|
|
||||||
--- SDL-1.2.13/include/SDL_platform.h 2009-02-15 23:41:29.000000000 +0000
|
|
||||||
+++ SDL-1.2.13-haiku/include/SDL_platform.h 2009-02-15 23:39:24.000000000 +0000
|
|
||||||
@@ -33,6 +33,10 @@
|
|
||||||
#undef __BEOS__
|
|
||||||
#define __BEOS__ 1
|
|
||||||
#endif
|
|
||||||
+#if defined(__HAIKU__)
|
|
||||||
+#undef __HAIKU__
|
|
||||||
+#define __HAIKU__ 1
|
|
||||||
+#endif
|
|
||||||
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
|
||||||
#undef __BSDI__
|
|
||||||
#define __BSDI__ 1
|
|
||||||
diff -urN SDL-1.2.13/include/begin_code.h SDL-1.2.13-haiku/include/begin_code.h
|
|
||||||
--- SDL-1.2.13/include/begin_code.h 2009-02-15 23:41:28.000000000 +0000
|
|
||||||
+++ SDL-1.2.13-haiku/include/begin_code.h 2009-02-15 23:35:54.000000000 +0000
|
|
||||||
@@ -33,7 +33,7 @@
|
|
||||||
|
|
||||||
/* Some compilers use a special export keyword */
|
|
||||||
#ifndef DECLSPEC
|
|
||||||
-# if defined(__BEOS__)
|
|
||||||
+# if defined(__BEOS__) || defined(__HAIKU__)
|
|
||||||
# if defined(__GNUC__)
|
|
||||||
# define DECLSPEC __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
diff -urN SDL-1.2.13/src/video/bwindow/SDL_sysvideo.cc SDL-1.2.13-haiku/src/video/bwindow/SDL_sysvideo.cc
|
|
||||||
--- SDL-1.2.13/src/video/bwindow/SDL_sysvideo.cc 2009-02-15 23:41:31.000000000 +0000
|
|
||||||
+++ SDL-1.2.13-haiku/src/video/bwindow/SDL_sysvideo.cc 2009-02-15 23:36:16.000000000 +0000
|
|
||||||
static void BE_FreeHWSurface(_THIS, SDL_Surface *surface);
|
|
||||||
|
|
||||||
static int BE_ToggleFullScreen(_THIS, int fullscreen);
|
|
||||||
-static SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
+SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
|
|
||||||
/* OpenGL functions */
|
|
||||||
#if SDL_VIDEO_OPENGL
|
|
||||||
@@ -637,8 +637,12 @@
|
|
||||||
int32 cookie = 0;
|
|
||||||
while (get_next_image_info(0,&cookie,&info) == B_OK) {
|
|
||||||
void *location = NULL;
|
|
||||||
- if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) {
|
|
||||||
- _this->gl_config.dll_handle = (void*)cookie;
|
|
||||||
+#ifdef __HAIKU__
|
|
||||||
+ if (get_image_symbol(info.id,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) { // This is how it actually works in Haiku
|
|
||||||
+#else
|
|
||||||
+ if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) { // I don't know if that *did* work in BeOS
|
|
||||||
+#endif
|
|
||||||
+ _this->gl_config.dll_handle = (void*)info.id;
|
|
||||||
_this->gl_config.driver_loaded = 1;
|
|
||||||
SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", SDL_arraysize(_this->gl_config.driver_path));
|
|
||||||
}
|
|
||||||
diff -urN SDL-1.2.13/test/configure.in SDL-1.2.13-haiku/test/configure.in
|
|
||||||
--- SDL-1.2.13/test/configure.in 2009-02-15 23:41:29.000000000 +0000
|
|
||||||
+++ SDL-1.2.13-haiku/test/configure.in 2009-02-15 23:35:54.000000000 +0000
|
|
||||||
@@ -20,7 +20,7 @@
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lopengl32"
|
|
||||||
;;
|
|
||||||
- *-*-beos*)
|
|
||||||
+ *-*-beos* | *-*-haiku*)
|
|
||||||
EXE=""
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lGL"
|
|
||||||
diff -urN SDL-1.2.13/test/testplatform.c SDL-1.2.13-haiku/test/testplatform.c
|
|
||||||
--- SDL-1.2.13/test/testplatform.c 2009-02-15 23:41:29.000000000 +0000
|
|
||||||
+++ SDL-1.2.13-haiku/test/testplatform.c 2009-02-15 23:48:14.000000000 +0000
|
|
||||||
@@ -162,6 +162,8 @@
|
|
||||||
"Dreamcast"
|
|
||||||
#elif __FREEBSD__
|
|
||||||
"FreeBSD"
|
|
||||||
+#elif __HAIKU__
|
|
||||||
+ "Haiku"
|
|
||||||
#elif __HPUX__
|
|
||||||
"HP-UX"
|
|
||||||
#elif __IRIX__
|
|
||||||
diff -rup SDL-1.2.13/src/video/bwindow/SDL_sysyuv.cc SDL-1.2.13-haiku/src/video/bwindow/SDL_sysyuv.cc
|
|
||||||
--- SDL-1.2.13/src/video/bwindow/SDL_sysyuv.cc 2009-02-25 15:32:44.000000000 +0100
|
|
||||||
+++ SDL-1.2.13-haiku/src/video/bwindow/SDL_sysyuv.cc 2009-02-25 15:29:59.000000000 +0100
|
|
||||||
@@ -94,7 +94,7 @@ BBitmap * BE_GetOverlayBitmap(BRect boun
|
|
||||||
|
|
||||||
// See <GraphicsDefs.h> [btw: Cb=U, Cr=V]
|
|
||||||
// See also http://www.fourcc.org/indexyuv.htm
|
|
||||||
-enum color_space convert_color_space(Uint32 format) {
|
|
||||||
+color_space convert_color_space(Uint32 format) {
|
|
||||||
switch (format) {
|
|
||||||
case SDL_YV12_OVERLAY:
|
|
||||||
return B_YUV9;
|
|
||||||
@@ -1,160 +0,0 @@
|
|||||||
Index: src/video/bwindow/SDL_sysyuv.cc
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysyuv.cc (revision 4456)
|
|
||||||
+++ src/video/bwindow/SDL_sysyuv.cc (working copy)
|
|
||||||
@@ -94,7 +94,7 @@
|
|
||||||
|
|
||||||
// See <GraphicsDefs.h> [btw: Cb=U, Cr=V]
|
|
||||||
// See also http://www.fourcc.org/indexyuv.htm
|
|
||||||
-enum color_space convert_color_space(Uint32 format) {
|
|
||||||
+color_space convert_color_space(Uint32 format) {
|
|
||||||
switch (format) {
|
|
||||||
case SDL_YV12_OVERLAY:
|
|
||||||
return B_YUV9;
|
|
||||||
Index: src/video/bwindow/SDL_sysyuv.h
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysyuv.h (revision 4456)
|
|
||||||
+++ src/video/bwindow/SDL_sysyuv.h (working copy)
|
|
||||||
@@ -62,7 +62,7 @@
|
|
||||||
};
|
|
||||||
|
|
||||||
extern BBitmap * BE_GetOverlayBitmap(BRect bounds, color_space cs);
|
|
||||||
-extern SDL_Overlay* BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface* display);
|
|
||||||
+SDL_Overlay* BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface* display);
|
|
||||||
extern int BE_LockYUVOverlay(_THIS, SDL_Overlay* overlay);
|
|
||||||
extern void BE_UnlockYUVOverlay(_THIS, SDL_Overlay* overlay);
|
|
||||||
extern int BE_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* src, SDL_Rect* dst);
|
|
||||||
Index: src/video/bwindow/SDL_sysvideo.cc
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysvideo.cc (revision 4456)
|
|
||||||
+++ src/video/bwindow/SDL_sysvideo.cc (working copy)
|
|
||||||
@@ -57,7 +57,7 @@
|
|
||||||
static void BE_FreeHWSurface(_THIS, SDL_Surface *surface);
|
|
||||||
|
|
||||||
static int BE_ToggleFullScreen(_THIS, int fullscreen);
|
|
||||||
-static SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
+SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
|
|
||||||
/* OpenGL functions */
|
|
||||||
#if SDL_VIDEO_OPENGL
|
|
||||||
@@ -637,8 +637,12 @@
|
|
||||||
int32 cookie = 0;
|
|
||||||
while (get_next_image_info(0,&cookie,&info) == B_OK) {
|
|
||||||
void *location = NULL;
|
|
||||||
- if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) {
|
|
||||||
- _this->gl_config.dll_handle = (void*)cookie;
|
|
||||||
+#ifdef __HAIKU__
|
|
||||||
+ if (get_image_symbol(info.id,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) { // This is how it actually works in Haiku
|
|
||||||
+#else
|
|
||||||
+ if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) { // I don't know if that *did* work in BeOS
|
|
||||||
+#endif
|
|
||||||
+ _this->gl_config.dll_handle = (void*)info.id;
|
|
||||||
_this->gl_config.driver_loaded = 1;
|
|
||||||
SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", SDL_arraysize(_this->gl_config.driver_path));
|
|
||||||
}
|
|
||||||
Index: test/configure.in
|
|
||||||
===================================================================
|
|
||||||
--- test/configure.in (revision 4456)
|
|
||||||
+++ test/configure.in (working copy)
|
|
||||||
@@ -20,7 +20,7 @@
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lopengl32"
|
|
||||||
;;
|
|
||||||
- *-*-beos*)
|
|
||||||
+ *-*-beos* | *-*-haiku*)
|
|
||||||
EXE=""
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lGL"
|
|
||||||
Index: test/testplatform.c
|
|
||||||
===================================================================
|
|
||||||
--- test/testplatform.c (revision 4456)
|
|
||||||
+++ test/testplatform.c (working copy)
|
|
||||||
@@ -162,6 +162,8 @@
|
|
||||||
"Dreamcast"
|
|
||||||
#elif __FREEBSD__
|
|
||||||
"FreeBSD"
|
|
||||||
+#elif __HAIKU__
|
|
||||||
+ "Haiku"
|
|
||||||
#elif __HPUX__
|
|
||||||
"HP-UX"
|
|
||||||
#elif __IRIX__
|
|
||||||
Index: include/begin_code.h
|
|
||||||
===================================================================
|
|
||||||
--- include/begin_code.h (revision 4456)
|
|
||||||
+++ include/begin_code.h (working copy)
|
|
||||||
@@ -33,7 +33,7 @@
|
|
||||||
|
|
||||||
/* Some compilers use a special export keyword */
|
|
||||||
#ifndef DECLSPEC
|
|
||||||
-# if defined(__BEOS__)
|
|
||||||
+# if defined(__BEOS__) || defined(__HAIKU__)
|
|
||||||
# if defined(__GNUC__)
|
|
||||||
# define DECLSPEC __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
Index: include/SDL_platform.h
|
|
||||||
===================================================================
|
|
||||||
--- include/SDL_platform.h (revision 4456)
|
|
||||||
+++ include/SDL_platform.h (working copy)
|
|
||||||
@@ -33,6 +33,10 @@
|
|
||||||
#undef __BEOS__
|
|
||||||
#define __BEOS__ 1
|
|
||||||
#endif
|
|
||||||
+#if defined(__HAIKU__)
|
|
||||||
+#undef __HAIKU__
|
|
||||||
+#define __HAIKU__ 1
|
|
||||||
+#endif
|
|
||||||
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
|
||||||
#undef __BSDI__
|
|
||||||
#define __BSDI__ 1
|
|
||||||
@@ -45,6 +49,10 @@
|
|
||||||
#undef __FREEBSD__
|
|
||||||
#define __FREEBSD__ 1
|
|
||||||
#endif
|
|
||||||
+#if defined(__HAIKU__)
|
|
||||||
+#undef __HAIKU__
|
|
||||||
+#define __HAIKU__ 1
|
|
||||||
+#endif
|
|
||||||
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
|
|
||||||
#undef __HPUX__
|
|
||||||
#define __HPUX__ 1
|
|
||||||
Index: configure.in
|
|
||||||
===================================================================
|
|
||||||
--- configure.in (revision 4456)
|
|
||||||
+++ configure.in (working copy)
|
|
||||||
@@ -40,7 +40,7 @@
|
|
||||||
AC_SUBST(LT_AGE)
|
|
||||||
|
|
||||||
dnl Detect the canonical build and host environments
|
|
||||||
-AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
|
|
||||||
+AC_CONFIG_AUX_DIR([build-scripts])
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
AC_C_BIGENDIAN
|
|
||||||
if test x$ac_cv_c_bigendian = xyes; then
|
|
||||||
@@ -2493,7 +2493,7 @@
|
|
||||||
SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
|
|
||||||
SDL_LIBS="-lSDLmain $SDL_LIBS"
|
|
||||||
;;
|
|
||||||
- *-*-beos*)
|
|
||||||
+ *-*-beos* | *-*-haiku*)
|
|
||||||
ARCH=beos
|
|
||||||
ac_default_prefix=/boot/develop/tools/gnupro
|
|
||||||
CheckDummyVideo
|
|
||||||
@@ -2536,8 +2536,16 @@
|
|
||||||
fi
|
|
||||||
# Set up files for the shared object loading library
|
|
||||||
if test x$enable_loadso = xyes; then
|
|
||||||
- AC_DEFINE(SDL_LOADSO_BEOS)
|
|
||||||
- SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
|
|
||||||
+ case "$host" in
|
|
||||||
+ *-*-beos*)
|
|
||||||
+ AC_DEFINE(SDL_LOADSO_BEOS)
|
|
||||||
+ SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
|
|
||||||
+ ;;
|
|
||||||
+ *-*-haiku*)
|
|
||||||
+ AC_DEFINE(SDL_LOADSO_DLOPEN)
|
|
||||||
+ SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
|
|
||||||
+ ;;
|
|
||||||
+ esac
|
|
||||||
have_loadso=yes
|
|
||||||
fi
|
|
||||||
# The BeOS platform requires special setup.
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
Index: src/video/bwindow/SDL_BWin.h
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_BWin.h (revision 4901)
|
|
||||||
+++ src/video/bwindow/SDL_BWin.h (working copy)
|
|
||||||
@@ -267,6 +267,8 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void DispatchMessage(BMessage *msg, BHandler *target);
|
|
||||||
+
|
|
||||||
+ virtual void DirectConnected(direct_buffer_info *info);
|
|
||||||
|
|
||||||
private:
|
|
||||||
#if SDL_VIDEO_OPENGL
|
|
||||||
Index: src/video/bwindow/SDL_sysevents.cc
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysevents.cc (revision 4901)
|
|
||||||
+++ src/video/bwindow/SDL_sysevents.cc (working copy)
|
|
||||||
@@ -379,3 +379,20 @@
|
|
||||||
}
|
|
||||||
BDirectWindow::DispatchMessage(msg, target);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+void SDL_BWin::DirectConnected(direct_buffer_info *info) {
|
|
||||||
+ switch (info->buffer_state & B_DIRECT_MODE_MASK) {
|
|
||||||
+ case B_DIRECT_START:
|
|
||||||
+ case B_DIRECT_MODIFY:
|
|
||||||
+ {
|
|
||||||
+ int32 width = info->window_bounds.right -
|
|
||||||
+ info->window_bounds.left + 1;
|
|
||||||
+ int32 height = info->window_bounds.bottom -
|
|
||||||
+ info->window_bounds.top + 1;
|
|
||||||
+ SDL_PrivateResize(width, height);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ default:
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
Index: src/video/bwindow/SDL_sysvideo.cc
|
|
||||||
===================================================================
|
|
||||||
--- src/video/bwindow/SDL_sysvideo.cc (revision 4901)
|
|
||||||
+++ src/video/bwindow/SDL_sysvideo.cc (working copy)
|
|
||||||
@@ -57,7 +57,7 @@
|
|
||||||
static void BE_FreeHWSurface(_THIS, SDL_Surface *surface);
|
|
||||||
|
|
||||||
static int BE_ToggleFullScreen(_THIS, int fullscreen);
|
|
||||||
-SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
+static SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
|
|
||||||
|
|
||||||
/* OpenGL functions */
|
|
||||||
#if SDL_VIDEO_OPENGL
|
|
||||||
@@ -358,16 +358,25 @@
|
|
||||||
(current.timing.h_total * current.timing.v_total);
|
|
||||||
|
|
||||||
modes = SDL_modelist[((bpp+7)/8)-1];
|
|
||||||
- for ( i=0; modes[i] && (modes[i]->w > width) &&
|
|
||||||
- (modes[i]->h > height); ++i ) {
|
|
||||||
- /* still looking */
|
|
||||||
+
|
|
||||||
+ // find end of list (lowest-resolution mode; modes are ordered
|
|
||||||
+ // highest-to-lowest).
|
|
||||||
+ i = 0; while(modes[i]) i++;
|
|
||||||
+ if (!i) return false; // what? no modes at all?
|
|
||||||
+
|
|
||||||
+ // find first mode with resolution >= requested in both dimensions
|
|
||||||
+ for (--i; i >= 0; --i)
|
|
||||||
+ {
|
|
||||||
+ if (modes[i]->w >= width && modes[i]->h >= height)
|
|
||||||
+ break;
|
|
||||||
}
|
|
||||||
- if ( ! modes[i] || (modes[i]->w < width) || (modes[i]->h < width) ) {
|
|
||||||
- --i; /* We went too far */
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
+
|
|
||||||
+ // unable to find any mode with that high a resolution!
|
|
||||||
+ if (i < 0)
|
|
||||||
+ return false;
|
|
||||||
+
|
|
||||||
width = modes[i]->w;
|
|
||||||
- height = modes[i]->h;
|
|
||||||
+ height = modes[i]->h;
|
|
||||||
|
|
||||||
bscreen.GetModeList(&dmodes, &nmodes);
|
|
||||||
for ( i = 0; i < nmodes; ++i ) {
|
|
||||||
@@ -396,88 +405,88 @@
|
|
||||||
|
|
||||||
static int BE_SetFullScreen(_THIS, SDL_Surface *screen, int fullscreen)
|
|
||||||
{
|
|
||||||
- int was_fullscreen;
|
|
||||||
- bool needs_unlock;
|
|
||||||
+ // printf("SetFullScreen(%d)\n", fullscreen);
|
|
||||||
BScreen bscreen;
|
|
||||||
- BRect bounds;
|
|
||||||
- display_mode mode;
|
|
||||||
- int width, height, bpp;
|
|
||||||
|
|
||||||
- /* Set the fullscreen mode */
|
|
||||||
- was_fullscreen = SDL_Win->IsFullScreen();
|
|
||||||
- SDL_Win->SetFullScreen(fullscreen);
|
|
||||||
- fullscreen = SDL_Win->IsFullScreen();
|
|
||||||
+ // SetFullSscreen() does not work as expected if called in a window
|
|
||||||
+ // that was never shown. This is probably a bug in the Haiku Game Kit that needs
|
|
||||||
+ // to be investigated.
|
|
||||||
+ if (SDL_Win->Lock()) {
|
|
||||||
+ // Show our window.
|
|
||||||
+ SDL_Win->Show();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (SDL_Win->IsLocked()) {
|
|
||||||
+ // Unlock the window if it was locked. This is needed as only the
|
|
||||||
+ // first call to Show() unlocks the looper. All other calls to it
|
|
||||||
+ // will not.
|
|
||||||
+ SDL_Win->Unlock();
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- width = screen->w;
|
|
||||||
- height = screen->h;
|
|
||||||
+ int width = screen->w;
|
|
||||||
+ int height = screen->h;
|
|
||||||
+
|
|
||||||
+ if (fullscreen) {
|
|
||||||
+ // Set resolution to the closest available one that matches the
|
|
||||||
+ // current SDL resolution.
|
|
||||||
+ display_mode mode;
|
|
||||||
+ bscreen.GetMode(&mode);
|
|
||||||
|
|
||||||
- /* Set the appropriate video mode */
|
|
||||||
- if ( fullscreen ) {
|
|
||||||
- bpp = screen->format->BitsPerPixel;
|
|
||||||
- bscreen.GetMode(&mode);
|
|
||||||
- if ( (bpp != ColorSpaceToBitsPerPixel(mode.space)) ||
|
|
||||||
- (width != mode.virtual_width) ||
|
|
||||||
- (height != mode.virtual_height)) {
|
|
||||||
+ int bpp = screen->format->BitsPerPixel;
|
|
||||||
+ if (bpp != ColorSpaceToBitsPerPixel(mode.space) ||
|
|
||||||
+ width != mode.virtual_width || height != mode.virtual_height) {
|
|
||||||
if(BE_FindClosestFSMode(_this, width, height, bpp, &mode)) {
|
|
||||||
bscreen.SetMode(&mode);
|
|
||||||
- /* This simply stops the next resize event from being
|
|
||||||
- * sent to the SDL handler.
|
|
||||||
- */
|
|
||||||
- SDL_Win->InhibitResize();
|
|
||||||
} else {
|
|
||||||
- fullscreen = 0;
|
|
||||||
- SDL_Win->SetFullScreen(fullscreen);
|
|
||||||
- }
|
|
||||||
+ // printf("Could not set new mode.\n");
|
|
||||||
+ return(0);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
+ } else {
|
|
||||||
+ // Reset to the previous known resolution as we are now in window
|
|
||||||
+ // mode.
|
|
||||||
+ bscreen.SetMode(&saved_mode);
|
|
||||||
}
|
|
||||||
- if ( was_fullscreen && ! fullscreen ) {
|
|
||||||
- bscreen.SetMode(&saved_mode);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if ( SDL_Win->Lock() ) {
|
|
||||||
- int cx, cy;
|
|
||||||
- if ( SDL_Win->Shown() ) {
|
|
||||||
- needs_unlock = 1;
|
|
||||||
- SDL_Win->Hide();
|
|
||||||
- } else {
|
|
||||||
- needs_unlock = 0;
|
|
||||||
- }
|
|
||||||
- /* This resizes the window and view area, but inhibits resizing
|
|
||||||
- * of the BBitmap due to the InhibitResize call above. Thus the
|
|
||||||
- * bitmap (pixel data) never changes.
|
|
||||||
- */
|
|
||||||
+
|
|
||||||
+ // Effectivelly set/reset full screen mode. If we are already in
|
|
||||||
+ // full screen mode, we reset back to windowed mode first so the
|
|
||||||
+ // window can resize when going fullscreen.
|
|
||||||
+ // if (fullscreen)
|
|
||||||
+ // printf("Going fullscreen\n");
|
|
||||||
+ // else
|
|
||||||
+ // printf("Going windowed\n");
|
|
||||||
+ SDL_Win->SetFullScreen(fullscreen);
|
|
||||||
+
|
|
||||||
+ // Calculate offsets for centering the window (in window mode) and for
|
|
||||||
+ // dentering the bitmap (in full screen mode).
|
|
||||||
+ BRect bounds = bscreen.Frame();
|
|
||||||
+ bounds.PrintToStream();
|
|
||||||
+ int32 cx = (bounds.IntegerWidth() - width)/2;
|
|
||||||
+ int32 cy = (bounds.IntegerHeight() - height)/2;
|
|
||||||
+
|
|
||||||
+ // printf ("cx = %d, cy = %d\n", cx, cy);
|
|
||||||
+ if (!SDL_Win->IsFullScreen()) {
|
|
||||||
+ // printf("Doing not fullscreen stuff.\n");
|
|
||||||
+ // We are not in full screen mode, so we want to change the window
|
|
||||||
+ // size to match the resolution in SDL.
|
|
||||||
SDL_Win->ResizeTo(width, height);
|
|
||||||
- bounds = bscreen.Frame();
|
|
||||||
- /* Calculate offsets - used either to center window
|
|
||||||
- * (windowed mode) or to set drawing offsets (fullscreen mode)
|
|
||||||
- */
|
|
||||||
- cx = (bounds.IntegerWidth() - width)/2;
|
|
||||||
- cy = (bounds.IntegerHeight() - height)/2;
|
|
||||||
-
|
|
||||||
- if ( fullscreen ) {
|
|
||||||
- /* Set offset for drawing */
|
|
||||||
- SDL_Win->SetXYOffset(cx, cy);
|
|
||||||
- } else {
|
|
||||||
- SDL_Win->SetXYOffset(0, 0);
|
|
||||||
- }
|
|
||||||
- if ( ! needs_unlock || was_fullscreen ) {
|
|
||||||
- /* Center the window the first time */
|
|
||||||
- SDL_Win->MoveTo(cx, cy);
|
|
||||||
- }
|
|
||||||
- SDL_Win->Show();
|
|
||||||
|
|
||||||
- /* Unlock the window manually after the first Show() */
|
|
||||||
- if ( needs_unlock ) {
|
|
||||||
- SDL_Win->Unlock();
|
|
||||||
- }
|
|
||||||
+ // And also center the window and reset the drawing offset.
|
|
||||||
+ SDL_Win->MoveTo(cx, cy);
|
|
||||||
+ SDL_Win->SetXYOffset(0, 0);
|
|
||||||
+ } else {
|
|
||||||
+ // printf("Doing fullscreen stuff.");
|
|
||||||
+ // Center the bitmap whenever we are in full screen mode.
|
|
||||||
+ SDL_Win->SetXYOffset(cx, cy);
|
|
||||||
}
|
|
||||||
-
|
|
||||||
- /* Set the fullscreen flag in the screen surface */
|
|
||||||
- if ( fullscreen ) {
|
|
||||||
+
|
|
||||||
+ // Set relevant internal SDL screen flags.
|
|
||||||
+ if (SDL_Win->IsFullScreen()) {
|
|
||||||
screen->flags |= SDL_FULLSCREEN;
|
|
||||||
} else {
|
|
||||||
screen->flags &= ~SDL_FULLSCREEN;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
diff -urN SDL-1.2.13/src/video/bwindow/SDL_sysvideo.cc SDL-1.2.13-haiku/src/video/bwindow/SDL_sysvideo.cc
|
|
||||||
--- SDL-1.2.13/src/video/bwindow/SDL_sysvideo.cc 2007-12-31 04:48:12.000000000 +0000
|
|
||||||
+++ SDL-1.2.13-haiku/src/video/bwindow/SDL_sysvideo.cc 2009-09-19 21:01:51.000000000 +0000
|
|
||||||
@@ -358,16 +358,25 @@
|
|
||||||
(current.timing.h_total * current.timing.v_total);
|
|
||||||
|
|
||||||
modes = SDL_modelist[((bpp+7)/8)-1];
|
|
||||||
- for ( i=0; modes[i] && (modes[i]->w > width) &&
|
|
||||||
- (modes[i]->h > height); ++i ) {
|
|
||||||
- /* still looking */
|
|
||||||
- }
|
|
||||||
- if ( ! modes[i] || (modes[i]->w < width) || (modes[i]->h < width) ) {
|
|
||||||
- --i; /* We went too far */
|
|
||||||
+
|
|
||||||
+ // find end of list (lowest-resolution mode; modes are ordered
|
|
||||||
+ // highest-to-lowest).
|
|
||||||
+ i = 0; while(modes[i]) i++;
|
|
||||||
+ if (!i) return false; // what? no modes at all?
|
|
||||||
+
|
|
||||||
+ // find first mode with resolution >= requested in both dimensions
|
|
||||||
+ for (--i; i >= 0; --i)
|
|
||||||
+ {
|
|
||||||
+ if (modes[i]->w >= width && modes[i]->h >= height)
|
|
||||||
+ break;
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+
|
|
||||||
+ // unable to find any mode with that high a resolution!
|
|
||||||
+ if (i < 0)
|
|
||||||
+ return false;
|
|
||||||
+
|
|
||||||
width = modes[i]->w;
|
|
||||||
- height = modes[i]->h;
|
|
||||||
+ height = modes[i]->h;
|
|
||||||
|
|
||||||
bscreen.GetModeList(&dmodes, &nmodes);
|
|
||||||
for ( i = 0; i < nmodes; ++i ) {
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
Index: test/configure.in
|
|
||||||
===================================================================
|
|
||||||
--- test/configure.in (revision 4114)
|
|
||||||
+++ test/configure.in (working copy)
|
|
||||||
@@ -20,7 +20,7 @@
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lopengl32"
|
|
||||||
;;
|
|
||||||
- *-*-beos*)
|
|
||||||
+ *-*-beos* | *-*-haiku*)
|
|
||||||
EXE=""
|
|
||||||
MATHLIB=""
|
|
||||||
SYS_GL_LIBS="-lGL"
|
|
||||||
Index: test/testplatform.c
|
|
||||||
===================================================================
|
|
||||||
--- test/testplatform.c (revision 4114)
|
|
||||||
+++ test/testplatform.c (working copy)
|
|
||||||
@@ -154,7 +154,11 @@
|
|
||||||
printf("This system is running %s\n",
|
|
||||||
#if __AIX__
|
|
||||||
"AIX"
|
|
||||||
-#elif __BEOS__
|
|
||||||
+#elif __HAIKU__
|
|
||||||
+ "Haiku"
|
|
||||||
+ /* Haiku must appear here before BeOS,
|
|
||||||
+ since it also defines __BEOS__ */
|
|
||||||
+#elif __BEOS__
|
|
||||||
"BeOS"
|
|
||||||
#elif __BSDI__
|
|
||||||
"BSDI"
|
|
||||||
Index: include/begin_code.h
|
|
||||||
===================================================================
|
|
||||||
--- include/begin_code.h (revision 4114)
|
|
||||||
+++ include/begin_code.h (working copy)
|
|
||||||
@@ -33,7 +33,7 @@
|
|
||||||
|
|
||||||
/* Some compilers use a special export keyword */
|
|
||||||
#ifndef DECLSPEC
|
|
||||||
-# if defined(__BEOS__)
|
|
||||||
+# if defined(__BEOS__) || defined(__HAIKU__)
|
|
||||||
# if defined(__GNUC__)
|
|
||||||
# define DECLSPEC __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
Index: include/SDL_platform.h
|
|
||||||
===================================================================
|
|
||||||
--- include/SDL_platform.h (revision 4114)
|
|
||||||
+++ include/SDL_platform.h (working copy)
|
|
||||||
@@ -29,10 +29,14 @@
|
|
||||||
#undef __AIX__
|
|
||||||
#define __AIX__ 1
|
|
||||||
#endif
|
|
||||||
-#if defined(__BEOS__)
|
|
||||||
+#if defined(__BEOS__) && !defined(__HAIKU__)
|
|
||||||
#undef __BEOS__
|
|
||||||
#define __BEOS__ 1
|
|
||||||
#endif
|
|
||||||
+#if defined(__HAIKU__)
|
|
||||||
+#undef __HAIKU__
|
|
||||||
+#define __HAIKU__ 1
|
|
||||||
+#endif
|
|
||||||
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
|
||||||
#undef __BSDI__
|
|
||||||
#define __BSDI__ 1
|
|
||||||
Index: configure.in
|
|
||||||
===================================================================
|
|
||||||
--- configure.in (revision 4114)
|
|
||||||
+++ configure.in (working copy)
|
|
||||||
@@ -40,7 +40,7 @@
|
|
||||||
AC_SUBST(LT_AGE)
|
|
||||||
|
|
||||||
dnl Detect the canonical build and host environments
|
|
||||||
-AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
|
|
||||||
+AC_CONFIG_AUX_DIR([build-scripts])
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
AC_C_BIGENDIAN
|
|
||||||
if test x$ac_cv_c_bigendian = xyes; then
|
|
||||||
@@ -2493,7 +2493,7 @@
|
|
||||||
SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
|
|
||||||
SDL_LIBS="-lSDLmain $SDL_LIBS"
|
|
||||||
;;
|
|
||||||
- *-*-beos*)
|
|
||||||
+ *-*-beos* | *-*-haiku*)
|
|
||||||
ARCH=beos
|
|
||||||
ac_default_prefix=/boot/develop/tools/gnupro
|
|
||||||
CheckDummyVideo
|
|
||||||
Reference in New Issue
Block a user