Renamed all .c files in src/video/bwindow to .cc files.
authorNathan Heisey <nathanheisey@gmail.com>
Wed, 13 Jul 2011 09:29:43 +0000
changeset 5918 2063df37190b
parent 5917 cfd6c08e2326
child 5919 e19c4c44f224
Renamed all .c files in src/video/bwindow to .cc files.
src/video/bwindow/SDL_bclipboard.c
src/video/bwindow/SDL_bclipboard.cc
src/video/bwindow/SDL_bmodes.c
src/video/bwindow/SDL_bmodes.cc
src/video/bwindow/SDL_bopengl.c
src/video/bwindow/SDL_bopengl.cc
src/video/bwindow/SDL_bvideo.c
src/video/bwindow/SDL_bvideo.cc
src/video/bwindow/SDL_bwindow.c
src/video/bwindow/SDL_bwindow.cc
--- a/src/video/bwindow/SDL_bclipboard.c	Tue Jul 12 15:09:44 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 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.
-*/
-
-
-/* BWindow based framebuffer implementation */
-#include "SDL_config.h"
-
-#include <unistd.h>
-#include <TypeConstants.h>
-
-#include "SDL_BWin.h"
-#include "SDL_timer.h"
-#include "../SDL_sysvideo.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int BE_SetClipboardText(_THIS, const char *text) {
-#if 0
-	BMessage *clip = NULL;
-	if(be_clipboard->Lock()) {
-		be_clipboard->Clear();
-		if((clip = be_clipboard->Data())) {
-			/* Presumably the string of characters is ascii-format */
-			ssize_t asciiLength = 0;
-			for(; text[asciiLength] != 0; ++asciiLength) {}
-			clip->AddData("text/plain", B_MIME_TYPE, &text, asciiLength);
-			be_clipboard->Commit();
-		}
-		be_clipboard->Unlock();
-	}
-#else
-return -1;
-#endif
-}
-
-char *BE_GetClipboardText(_THIS) {
-#if 0
-	BMessage *clip = NULL;
-	const char *text;
-	ssize_t length;
-	if(be_clipboard->Lock()) {
-		if((clip = be_clipboard->Data())) {
-			/* Presumably the string of characters is ascii-format */
-			clip->FindData("text/plain", B_MIME_TYPE, (void**)&text, &length);
-		} else {
-			be_clipboard->Unlock();
-			return NULL;
-		}
-		be_clipboard->Unlock();
-	} else {
-		return NULL;
-	}
-	
-	/* Copy the data and pass on to SDL */
-	char *result = (char*)SDL_calloc(1, sizeof(char*)*length);
-	SDL_strlcpy(result, text, length);
-	
-	return result;
-#else
-return NULL;
-#endif;
-}
-
-SDL_bool BE_HasClipboardText(_THIS) {
-#if 0
-	BMessage *clip = NULL;
-	const char *text;
-	ssize_t length;
-	SDL_bool retval = SDL_FALSE;
-	
-	if(be_clipboard->Lock()) {
-		if((clip = be_clipboard->Data())) {
-			/* Presumably the string of characters is ascii-format */
-			clip->FindData("text/plain", B_MIME_TYPE, (void**)&text, &length);
-			if( text ) retval = SDL_TRUE;
-		}
-		be_clipboard->Unlock();
-	}
-	return retval;
-#else
-return SDL_FALSE;
-#endif
-
-}
-
-#ifdef __cplusplus
-}					/* Extern C */
-#endif
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/bwindow/SDL_bclipboard.cc	Wed Jul 13 09:29:43 2011 +0000
@@ -0,0 +1,109 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2011 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.
+*/
+
+
+/* BWindow based framebuffer implementation */
+#include "SDL_config.h"
+
+#include <unistd.h>
+#include <TypeConstants.h>
+
+#include "SDL_BWin.h"
+#include "SDL_timer.h"
+#include "../SDL_sysvideo.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int BE_SetClipboardText(_THIS, const char *text) {
+#if 0
+	BMessage *clip = NULL;
+	if(be_clipboard->Lock()) {
+		be_clipboard->Clear();
+		if((clip = be_clipboard->Data())) {
+			/* Presumably the string of characters is ascii-format */
+			ssize_t asciiLength = 0;
+			for(; text[asciiLength] != 0; ++asciiLength) {}
+			clip->AddData("text/plain", B_MIME_TYPE, &text, asciiLength);
+			be_clipboard->Commit();
+		}
+		be_clipboard->Unlock();
+	}
+#else
+return -1;
+#endif
+}
+
+char *BE_GetClipboardText(_THIS) {
+#if 0
+	BMessage *clip = NULL;
+	const char *text;
+	ssize_t length;
+	if(be_clipboard->Lock()) {
+		if((clip = be_clipboard->Data())) {
+			/* Presumably the string of characters is ascii-format */
+			clip->FindData("text/plain", B_MIME_TYPE, (void**)&text, &length);
+		} else {
+			be_clipboard->Unlock();
+			return NULL;
+		}
+		be_clipboard->Unlock();
+	} else {
+		return NULL;
+	}
+	
+	/* Copy the data and pass on to SDL */
+	char *result = (char*)SDL_calloc(1, sizeof(char*)*length);
+	SDL_strlcpy(result, text, length);
+	
+	return result;
+#else
+return NULL;
+#endif;
+}
+
+SDL_bool BE_HasClipboardText(_THIS) {
+#if 0
+	BMessage *clip = NULL;
+	const char *text;
+	ssize_t length;
+	SDL_bool retval = SDL_FALSE;
+	
+	if(be_clipboard->Lock()) {
+		if((clip = be_clipboard->Data())) {
+			/* Presumably the string of characters is ascii-format */
+			clip->FindData("text/plain", B_MIME_TYPE, (void**)&text, &length);
+			if( text ) retval = SDL_TRUE;
+		}
+		be_clipboard->Unlock();
+	}
+	return retval;
+#else
+return SDL_FALSE;
+#endif
+
+}
+
+#ifdef __cplusplus
+}					/* Extern C */
+#endif
+
--- a/src/video/bwindow/SDL_bmodes.c	Tue Jul 12 15:09:44 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 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_sysvideo.h"
-
-int BE_InitModes(_THIS) {
-#if 0
-	display_mode *modes;
-	uint32 i, nmodes;
-	int bpp;
-
-	/* It is important that this be created after SDL_InitBeApp() */
-	BScreen bscreen;
-
-	/* Save the current display mode */
-	bscreen.GetMode(&saved_mode);
-	_this->info.current_w = saved_mode.virtual_width;
-	_this->info.current_h = saved_mode.virtual_height;
-        
-	/* Get the video modes we can switch to in fullscreen mode */
-	bscreen.GetModeList(&modes, &nmodes);
-	SDL_qsort(modes, nmodes, sizeof *modes, CompareModes);
-	for (i = 0; i < nmodes; ++i) {
-		bpp = ColorSpaceToBitsPerPixel(modes[i].space);
-		//if ( bpp != 0 ) { // There are bugs in changing colorspace
-		if (modes[i].space == saved_mode.space) {
-			BE_AddMode(_this, ((bpp + 7) / 8) - 1,
-				modes[i].virtual_width, modes[i].virtual_height);
-		}
-	}
-#else
-return -1;
-#endif
-}
-
-int BE_QuitModes(_THIS) {
-#if 0
-    int i, j;
-	for (i = 0; i < NUM_MODELISTS; ++i) {
-		if (SDL_modelist[i]) {
-			for (j = 0; SDL_modelist[i][j]; ++j) {
-				SDL_free(SDL_modelist[i][j]);
-			}
-			SDL_free(SDL_modelist[i]);
-			SDL_modelist[i] = NULL;
-		}
-	}
-
-	/* Restore the original video mode */
-	if (_this->screen) {
-		if ((_this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
-			BScreen bscreen;
-			bscreen.SetMode(&saved_mode);
-		}
-		_this->screen->pixels = NULL;
-	}
-#else
-return -1;
-#endif
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/bwindow/SDL_bmodes.cc	Wed Jul 13 09:29:43 2011 +0000
@@ -0,0 +1,78 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2011 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_sysvideo.h"
+
+int BE_InitModes(_THIS) {
+#if 0
+	display_mode *modes;
+	uint32 i, nmodes;
+	int bpp;
+
+	/* It is important that this be created after SDL_InitBeApp() */
+	BScreen bscreen;
+
+	/* Save the current display mode */
+	bscreen.GetMode(&saved_mode);
+	_this->info.current_w = saved_mode.virtual_width;
+	_this->info.current_h = saved_mode.virtual_height;
+        
+	/* Get the video modes we can switch to in fullscreen mode */
+	bscreen.GetModeList(&modes, &nmodes);
+	SDL_qsort(modes, nmodes, sizeof *modes, CompareModes);
+	for (i = 0; i < nmodes; ++i) {
+		bpp = ColorSpaceToBitsPerPixel(modes[i].space);
+		//if ( bpp != 0 ) { // There are bugs in changing colorspace
+		if (modes[i].space == saved_mode.space) {
+			BE_AddMode(_this, ((bpp + 7) / 8) - 1,
+				modes[i].virtual_width, modes[i].virtual_height);
+		}
+	}
+#else
+return -1;
+#endif
+}
+
+int BE_QuitModes(_THIS) {
+#if 0
+    int i, j;
+	for (i = 0; i < NUM_MODELISTS; ++i) {
+		if (SDL_modelist[i]) {
+			for (j = 0; SDL_modelist[i][j]; ++j) {
+				SDL_free(SDL_modelist[i][j]);
+			}
+			SDL_free(SDL_modelist[i]);
+			SDL_modelist[i] = NULL;
+		}
+	}
+
+	/* Restore the original video mode */
+	if (_this->screen) {
+		if ((_this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
+			BScreen bscreen;
+			bscreen.SetMode(&saved_mode);
+		}
+		_this->screen->pixels = NULL;
+	}
+#else
+return -1;
+#endif
+}
--- a/src/video/bwindow/SDL_bopengl.c	Tue Jul 12 15:09:44 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 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_bopengl.h"
-#include "../SDL_sysvideo.h"
-
-
-/* Passing a NULL path means load pointers from the application */
-int BE_GL_LoadLibrary(_THIS, const char *path)
-{
-#if 0
-	if (path == NULL) {
-		if (_this->gl_config.dll_handle == NULL) {
-			image_info info;
-			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;
-					_this->gl_config.driver_loaded = 1;
-					SDL_strlcpy(_this->gl_config.driver_path,
-					"libGL.so",
-					SDL_arraysize(_this->
-					gl_config.driver_path));
-				}
-			}
-		}
-	} else {
-        /*
-           FIXME None of BeOS libGL.so implementations have exported functions 
-           to load BGLView, which should be reloaded from new lib.
-           So for now just "load" linked libGL.so :(
-        */
-        if (_this->gl_config.dll_handle == NULL) {
-        	return BE_GL_LoadLibrary(_this, NULL);
-        }
-
-            /* Unload old first */
-            /*if (_this->gl_config.dll_handle != NULL) { */
-            /* Do not try to unload application itself (if LoadLibrary was called before with NULL ;) */
-            /*      image_info info;
-               if (get_image_info((image_id)_this->gl_config.dll_handle, &info) == B_OK) {
-               if (info.type != B_APP_IMAGE) {
-               unload_add_on((image_id)_this->gl_config.dll_handle);
-               }
-               }
-
-               }
-
-               if ((_this->gl_config.dll_handle = (void*)load_add_on(path)) != (void*)B_ERROR) {
-               _this->gl_config.driver_loaded = 1;
-               SDL_strlcpy(_this->gl_config.driver_path, path, SDL_arraysize(_this->gl_config.driver_path));
-               } */
-	}
-	
-	if (_this->gl_config.dll_handle != NULL) {
-		return 0;
-	} else {
-		_this->gl_config.dll_handle = NULL;
-		_this->gl_config.driver_loaded = 0;
-		*_this->gl_config.driver_path = '\0';
-		return -1;
-	}
-#endif
-}
-
-void *BE_GL_GetProcAddress(_THIS, const char *proc)
-{
-#if 0
-	if (_this->gl_config.dll_handle != NULL) {
-		void *location = NULL;
-		status_t err;
-		if ((err =
-			get_image_symbol((image_id) _this->gl_config.dll_handle,
-                              proc, B_SYMBOL_TYPE_ANY,
-                              &location)) == B_OK) {
-            return location;
-        } else {
-                SDL_SetError("Couldn't find OpenGL symbol");
-                return NULL;
-        }
-	} else {
-		SDL_SetError("OpenGL library not loaded");
-		return NULL;
-	}
-#endif
-}
-
-
-
-
-int BE_GL_MakeCurrent(_THIS)
-{
-	/* FIXME: should we glview->unlock and then glview->lock()? */
-	return 0;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-#if 0 /* Functions from 1.2 that do not appear to be used in 1.3 */
-
-    int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
-    {
-        /*
-           FIXME? Right now BE_GL_GetAttribute shouldn't be called between glBegin() and glEnd() - it doesn't use "cached" values
-         */
-        switch (attrib) {
-        case SDL_GL_RED_SIZE:
-            glGetIntegerv(GL_RED_BITS, (GLint *) value);
-            break;
-        case SDL_GL_GREEN_SIZE:
-            glGetIntegerv(GL_GREEN_BITS, (GLint *) value);
-            break;
-        case SDL_GL_BLUE_SIZE:
-            glGetIntegerv(GL_BLUE_BITS, (GLint *) value);
-            break;
-        case SDL_GL_ALPHA_SIZE:
-            glGetIntegerv(GL_ALPHA_BITS, (GLint *) value);
-            break;
-        case SDL_GL_DOUBLEBUFFER:
-            glGetBooleanv(GL_DOUBLEBUFFER, (GLboolean *) value);
-            break;
-        case SDL_GL_BUFFER_SIZE:
-            int v;
-            glGetIntegerv(GL_RED_BITS, (GLint *) & v);
-            *value = v;
-            glGetIntegerv(GL_GREEN_BITS, (GLint *) & v);
-            *value += v;
-            glGetIntegerv(GL_BLUE_BITS, (GLint *) & v);
-            *value += v;
-            glGetIntegerv(GL_ALPHA_BITS, (GLint *) & v);
-            *value += v;
-            break;
-        case SDL_GL_DEPTH_SIZE:
-            glGetIntegerv(GL_DEPTH_BITS, (GLint *) value);      /* Mesa creates 16 only? r5 always 32 */
-            break;
-        case SDL_GL_STENCIL_SIZE:
-            glGetIntegerv(GL_STENCIL_BITS, (GLint *) value);
-            break;
-        case SDL_GL_ACCUM_RED_SIZE:
-            glGetIntegerv(GL_ACCUM_RED_BITS, (GLint *) value);
-            break;
-        case SDL_GL_ACCUM_GREEN_SIZE:
-            glGetIntegerv(GL_ACCUM_GREEN_BITS, (GLint *) value);
-            break;
-        case SDL_GL_ACCUM_BLUE_SIZE:
-            glGetIntegerv(GL_ACCUM_BLUE_BITS, (GLint *) value);
-            break;
-        case SDL_GL_ACCUM_ALPHA_SIZE:
-            glGetIntegerv(GL_ACCUM_ALPHA_BITS, (GLint *) value);
-            break;
-        case SDL_GL_STEREO:
-        case SDL_GL_MULTISAMPLEBUFFERS:
-        case SDL_GL_MULTISAMPLESAMPLES:
-        default:
-            *value = 0;
-            return (-1);
-        }
-        return 0;
-    }
-
-    void BE_GL_SwapBuffers(_THIS)
-    {
-        SDL_Win->SwapBuffers();
-    }
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/bwindow/SDL_bopengl.cc	Wed Jul 13 09:29:43 2011 +0000
@@ -0,0 +1,195 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2011 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_bopengl.h"
+#include "../SDL_sysvideo.h"
+
+
+/* Passing a NULL path means load pointers from the application */
+int BE_GL_LoadLibrary(_THIS, const char *path)
+{
+#if 0
+	if (path == NULL) {
+		if (_this->gl_config.dll_handle == NULL) {
+			image_info info;
+			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;
+					_this->gl_config.driver_loaded = 1;
+					SDL_strlcpy(_this->gl_config.driver_path,
+					"libGL.so",
+					SDL_arraysize(_this->
+					gl_config.driver_path));
+				}
+			}
+		}
+	} else {
+        /*
+           FIXME None of BeOS libGL.so implementations have exported functions 
+           to load BGLView, which should be reloaded from new lib.
+           So for now just "load" linked libGL.so :(
+        */
+        if (_this->gl_config.dll_handle == NULL) {
+        	return BE_GL_LoadLibrary(_this, NULL);
+        }
+
+            /* Unload old first */
+            /*if (_this->gl_config.dll_handle != NULL) { */
+            /* Do not try to unload application itself (if LoadLibrary was called before with NULL ;) */
+            /*      image_info info;
+               if (get_image_info((image_id)_this->gl_config.dll_handle, &info) == B_OK) {
+               if (info.type != B_APP_IMAGE) {
+               unload_add_on((image_id)_this->gl_config.dll_handle);
+               }
+               }
+
+               }
+
+               if ((_this->gl_config.dll_handle = (void*)load_add_on(path)) != (void*)B_ERROR) {
+               _this->gl_config.driver_loaded = 1;
+               SDL_strlcpy(_this->gl_config.driver_path, path, SDL_arraysize(_this->gl_config.driver_path));
+               } */
+	}
+	
+	if (_this->gl_config.dll_handle != NULL) {
+		return 0;
+	} else {
+		_this->gl_config.dll_handle = NULL;
+		_this->gl_config.driver_loaded = 0;
+		*_this->gl_config.driver_path = '\0';
+		return -1;
+	}
+#endif
+}
+
+void *BE_GL_GetProcAddress(_THIS, const char *proc)
+{
+#if 0
+	if (_this->gl_config.dll_handle != NULL) {
+		void *location = NULL;
+		status_t err;
+		if ((err =
+			get_image_symbol((image_id) _this->gl_config.dll_handle,
+                              proc, B_SYMBOL_TYPE_ANY,
+                              &location)) == B_OK) {
+            return location;
+        } else {
+                SDL_SetError("Couldn't find OpenGL symbol");
+                return NULL;
+        }
+	} else {
+		SDL_SetError("OpenGL library not loaded");
+		return NULL;
+	}
+#endif
+}
+
+
+
+
+int BE_GL_MakeCurrent(_THIS)
+{
+	/* FIXME: should we glview->unlock and then glview->lock()? */
+	return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+#if 0 /* Functions from 1.2 that do not appear to be used in 1.3 */
+
+    int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
+    {
+        /*
+           FIXME? Right now BE_GL_GetAttribute shouldn't be called between glBegin() and glEnd() - it doesn't use "cached" values
+         */
+        switch (attrib) {
+        case SDL_GL_RED_SIZE:
+            glGetIntegerv(GL_RED_BITS, (GLint *) value);
+            break;
+        case SDL_GL_GREEN_SIZE:
+            glGetIntegerv(GL_GREEN_BITS, (GLint *) value);
+            break;
+        case SDL_GL_BLUE_SIZE:
+            glGetIntegerv(GL_BLUE_BITS, (GLint *) value);
+            break;
+        case SDL_GL_ALPHA_SIZE:
+            glGetIntegerv(GL_ALPHA_BITS, (GLint *) value);
+            break;
+        case SDL_GL_DOUBLEBUFFER:
+            glGetBooleanv(GL_DOUBLEBUFFER, (GLboolean *) value);
+            break;
+        case SDL_GL_BUFFER_SIZE:
+            int v;
+            glGetIntegerv(GL_RED_BITS, (GLint *) & v);
+            *value = v;
+            glGetIntegerv(GL_GREEN_BITS, (GLint *) & v);
+            *value += v;
+            glGetIntegerv(GL_BLUE_BITS, (GLint *) & v);
+            *value += v;
+            glGetIntegerv(GL_ALPHA_BITS, (GLint *) & v);
+            *value += v;
+            break;
+        case SDL_GL_DEPTH_SIZE:
+            glGetIntegerv(GL_DEPTH_BITS, (GLint *) value);      /* Mesa creates 16 only? r5 always 32 */
+            break;
+        case SDL_GL_STENCIL_SIZE:
+            glGetIntegerv(GL_STENCIL_BITS, (GLint *) value);
+            break;
+        case SDL_GL_ACCUM_RED_SIZE:
+            glGetIntegerv(GL_ACCUM_RED_BITS, (GLint *) value);
+            break;
+        case SDL_GL_ACCUM_GREEN_SIZE:
+            glGetIntegerv(GL_ACCUM_GREEN_BITS, (GLint *) value);
+            break;
+        case SDL_GL_ACCUM_BLUE_SIZE:
+            glGetIntegerv(GL_ACCUM_BLUE_BITS, (GLint *) value);
+            break;
+        case SDL_GL_ACCUM_ALPHA_SIZE:
+            glGetIntegerv(GL_ACCUM_ALPHA_BITS, (GLint *) value);
+            break;
+        case SDL_GL_STEREO:
+        case SDL_GL_MULTISAMPLEBUFFERS:
+        case SDL_GL_MULTISAMPLESAMPLES:
+        default:
+            *value = 0;
+            return (-1);
+        }
+        return 0;
+    }
+
+    void BE_GL_SwapBuffers(_THIS)
+    {
+        SDL_Win->SwapBuffers();
+    }
+#endif
--- a/src/video/bwindow/SDL_bvideo.c	Tue Jul 12 15:09:44 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 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_bwindow.h"
-#include "SDL_bclipboard.h"
-#include "SDL_bvideo.h"
-#include "SDL_bopengl.h"
-#include "SDL_bmodes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* FIXME: Undefined functions */
-//    #define BE_VideoInit NULL
-//    #define BE_VideoQuit NULL
-    #define BE_GetDisplayBounds NULL
-    #define BE_GetDisplayModes NULL
-    #define BE_SetDisplayMode NULL
-    #define BE_PumpEvents NULL
-    
-#if SDL_VIDEO_OPENGL_WGL	/* FIXME: Replace with BeOs's SDL OPENGL stuff */
-//    #define BE_GL_LoadLibrary NULL
-//    #define BE_GL_GetProcAddress NULL
-    #define BE_GL_UnloadLibrary NULL
-    #define BE_GL_CreateContext NULL
-//    #define BE_GL_MakeCurrent NULL
-    #define BE_GL_SetSwapInterval NULL
-    #define BE_GL_GetSwapInterval NULL
-    #define BE_GL_SwapWindow NULL
-    #define BE_GL_DeleteContext NULL
-#endif
-    #define BE_StartTextInput NULL
-    #define BE_StopTextInput NULL
-    #define BE_SetTextInputRect NULL
-
-//    #define BE_DeleteDevice NULL
-
-/* End undefined functions */
-
-static SDL_VideoDevice *
-BE_CreateDevice(int devindex)
-{
-    SDL_VideoDevice *device;
-    SDL_VideoData *data;
-
-    /* Initialize all variables that we clean on shutdown */
-    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
-    if (device) {
-        data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
-    } else {
-        data = NULL;
-    }
-    if (!data) {
-        SDL_OutOfMemory();
-        if (device) {
-            SDL_free(device);
-        }
-        return NULL;
-    }
-    device->driverdata = data;
-
-/* TODO: Figure out what sort of initialization needs to go here */
-
-    /* Set the function pointers */
-    device->VideoInit = BE_VideoInit;
-    device->VideoQuit = BE_VideoQuit;
-    device->GetDisplayBounds = BE_GetDisplayBounds;
-    device->GetDisplayModes = BE_GetDisplayModes;
-    device->SetDisplayMode = BE_SetDisplayMode;
-    device->PumpEvents = BE_PumpEvents;
-
-    device->CreateWindow = BE_CreateWindow;
-    device->CreateWindowFrom = BE_CreateWindowFrom;
-    device->SetWindowTitle = BE_SetWindowTitle;
-    device->SetWindowIcon = BE_SetWindowIcon;
-    device->SetWindowPosition = BE_SetWindowPosition;
-    device->SetWindowSize = BE_SetWindowSize;
-    device->ShowWindow = BE_ShowWindow;
-    device->HideWindow = BE_HideWindow;
-    device->RaiseWindow = BE_RaiseWindow;
-    device->MaximizeWindow = BE_MaximizeWindow;
-    device->MinimizeWindow = BE_MinimizeWindow;
-    device->RestoreWindow = BE_RestoreWindow;
-    device->SetWindowFullscreen = BE_SetWindowFullscreen;
-    device->SetWindowGammaRamp = BE_SetWindowGammaRamp;
-    device->GetWindowGammaRamp = BE_GetWindowGammaRamp;
-    device->SetWindowGrab = BE_SetWindowGrab;
-    device->DestroyWindow = BE_DestroyWindow;
-    device->GetWindowWMInfo = BE_GetWindowWMInfo;
-    device->CreateWindowFramebuffer = BE_CreateWindowFramebuffer;
-    device->UpdateWindowFramebuffer = BE_UpdateWindowFramebuffer;
-    device->DestroyWindowFramebuffer = BE_DestroyWindowFramebuffer;
-    
-    device->shape_driver.CreateShaper = NULL;
-    device->shape_driver.SetWindowShape = NULL;
-    device->shape_driver.ResizeWindowShape = NULL;
-    
-#if SDL_VIDEO_OPENGL_WGL	/* FIXME: Replace with BeOs's SDL OPENGL stuff */
-    device->GL_LoadLibrary = BE_GL_LoadLibrary;
-    device->GL_GetProcAddress = BE_GL_GetProcAddress;
-    device->GL_UnloadLibrary = BE_GL_UnloadLibrary;
-    device->GL_CreateContext = BE_GL_CreateContext;
-    device->GL_MakeCurrent = BE_GL_MakeCurrent;
-    device->GL_SetSwapInterval = BE_GL_SetSwapInterval;
-    device->GL_GetSwapInterval = BE_GL_GetSwapInterval;
-    device->GL_SwapWindow = BE_GL_SwapWindow;
-    device->GL_DeleteContext = BE_GL_DeleteContext;
-#endif
-    device->StartTextInput = BE_StartTextInput;
-    device->StopTextInput = BE_StopTextInput;
-    device->SetTextInputRect = BE_SetTextInputRect;
-
-    device->SetClipboardText = BE_SetClipboardText;
-    device->GetClipboardText = BE_GetClipboardText;
-    device->HasClipboardText = BE_HasClipboardText;
-
-    device->free = BE_DeleteDevice;
-
-    return device;
-}
-
-static void BE_DeleteDevice(SDL_VideoDevice * device)
-{
-	SDL_free(device->driverdata);
-	SDL_free(device);
-}
-
-/* FIXME: This is the 1.2 function at the moment.  Read through it and
-  o understand what it does. */
-int BE_VideoInit(_THIS)
-{
-	/* Initialize the Be Application for appserver interaction */
-	if (SDL_InitBeApp() < 0) {
-		return -1;
-	}
-	
-	BE_InitModes(_this);
-
-#if SDL_VIDEO_OPENGL
-        /* testgl application doesn't load library, just tries to load symbols */
-        /* is it correct? if so we have to load library here */
-    BE_GL_LoadLibrary(_this, NULL);
-#endif
-
-        /* Fill in some window manager capabilities */
-//    _this->info.wm_available = 1;
-
-        /* We're done! */
-    return (0);
-}
-
-static int BE_Available(void)
-{
-    return (1);
-}
-
-void BE_VideoQuit(_THIS)
-{
-
-#if 0
-        SDL_Win->Quit();
-        SDL_Win = NULL;
-#endif
-#if 0
-        if (SDL_BlankCursor != NULL) {
-            BE_FreeWMCursor(_this, SDL_BlankCursor);
-            SDL_BlankCursor = NULL;
-        }
-#endif
-
-    BE_QuitModes(_this);
-
-#if SDL_VIDEO_OPENGL
-//    if (_this->gl_config.dll_handle != NULL)
-//        unload_add_on((image_id) _this->gl_config.dll_handle);
-#endif
-
-    SDL_QuitBeApp();
-}
-
-#ifdef __cplusplus
-}
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/bwindow/SDL_bvideo.cc	Wed Jul 13 09:29:43 2011 +0000
@@ -0,0 +1,202 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2011 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_bwindow.h"
+#include "SDL_bclipboard.h"
+#include "SDL_bvideo.h"
+#include "SDL_bopengl.h"
+#include "SDL_bmodes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* FIXME: Undefined functions */
+//    #define BE_VideoInit NULL
+//    #define BE_VideoQuit NULL
+    #define BE_GetDisplayBounds NULL
+    #define BE_GetDisplayModes NULL
+    #define BE_SetDisplayMode NULL
+    #define BE_PumpEvents NULL
+    
+#if SDL_VIDEO_OPENGL_WGL	/* FIXME: Replace with BeOs's SDL OPENGL stuff */
+//    #define BE_GL_LoadLibrary NULL
+//    #define BE_GL_GetProcAddress NULL
+    #define BE_GL_UnloadLibrary NULL
+    #define BE_GL_CreateContext NULL
+//    #define BE_GL_MakeCurrent NULL
+    #define BE_GL_SetSwapInterval NULL
+    #define BE_GL_GetSwapInterval NULL
+    #define BE_GL_SwapWindow NULL
+    #define BE_GL_DeleteContext NULL
+#endif
+    #define BE_StartTextInput NULL
+    #define BE_StopTextInput NULL
+    #define BE_SetTextInputRect NULL
+
+//    #define BE_DeleteDevice NULL
+
+/* End undefined functions */
+
+static SDL_VideoDevice *
+BE_CreateDevice(int devindex)
+{
+    SDL_VideoDevice *device;
+    SDL_VideoData *data;
+
+    /* Initialize all variables that we clean on shutdown */
+    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+    if (device) {
+        data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+    } else {
+        data = NULL;
+    }
+    if (!data) {
+        SDL_OutOfMemory();
+        if (device) {
+            SDL_free(device);
+        }
+        return NULL;
+    }
+    device->driverdata = data;
+
+/* TODO: Figure out what sort of initialization needs to go here */
+
+    /* Set the function pointers */
+    device->VideoInit = BE_VideoInit;
+    device->VideoQuit = BE_VideoQuit;
+    device->GetDisplayBounds = BE_GetDisplayBounds;
+    device->GetDisplayModes = BE_GetDisplayModes;
+    device->SetDisplayMode = BE_SetDisplayMode;
+    device->PumpEvents = BE_PumpEvents;
+
+    device->CreateWindow = BE_CreateWindow;
+    device->CreateWindowFrom = BE_CreateWindowFrom;
+    device->SetWindowTitle = BE_SetWindowTitle;
+    device->SetWindowIcon = BE_SetWindowIcon;
+    device->SetWindowPosition = BE_SetWindowPosition;
+    device->SetWindowSize = BE_SetWindowSize;
+    device->ShowWindow = BE_ShowWindow;
+    device->HideWindow = BE_HideWindow;
+    device->RaiseWindow = BE_RaiseWindow;
+    device->MaximizeWindow = BE_MaximizeWindow;
+    device->MinimizeWindow = BE_MinimizeWindow;
+    device->RestoreWindow = BE_RestoreWindow;
+    device->SetWindowFullscreen = BE_SetWindowFullscreen;
+    device->SetWindowGammaRamp = BE_SetWindowGammaRamp;
+    device->GetWindowGammaRamp = BE_GetWindowGammaRamp;
+    device->SetWindowGrab = BE_SetWindowGrab;
+    device->DestroyWindow = BE_DestroyWindow;
+    device->GetWindowWMInfo = BE_GetWindowWMInfo;
+    device->CreateWindowFramebuffer = BE_CreateWindowFramebuffer;
+    device->UpdateWindowFramebuffer = BE_UpdateWindowFramebuffer;
+    device->DestroyWindowFramebuffer = BE_DestroyWindowFramebuffer;
+    
+    device->shape_driver.CreateShaper = NULL;
+    device->shape_driver.SetWindowShape = NULL;
+    device->shape_driver.ResizeWindowShape = NULL;
+    
+#if SDL_VIDEO_OPENGL_WGL	/* FIXME: Replace with BeOs's SDL OPENGL stuff */
+    device->GL_LoadLibrary = BE_GL_LoadLibrary;
+    device->GL_GetProcAddress = BE_GL_GetProcAddress;
+    device->GL_UnloadLibrary = BE_GL_UnloadLibrary;
+    device->GL_CreateContext = BE_GL_CreateContext;
+    device->GL_MakeCurrent = BE_GL_MakeCurrent;
+    device->GL_SetSwapInterval = BE_GL_SetSwapInterval;
+    device->GL_GetSwapInterval = BE_GL_GetSwapInterval;
+    device->GL_SwapWindow = BE_GL_SwapWindow;
+    device->GL_DeleteContext = BE_GL_DeleteContext;
+#endif
+    device->StartTextInput = BE_StartTextInput;
+    device->StopTextInput = BE_StopTextInput;
+    device->SetTextInputRect = BE_SetTextInputRect;
+
+    device->SetClipboardText = BE_SetClipboardText;
+    device->GetClipboardText = BE_GetClipboardText;
+    device->HasClipboardText = BE_HasClipboardText;
+
+    device->free = BE_DeleteDevice;
+
+    return device;
+}
+
+static void BE_DeleteDevice(SDL_VideoDevice * device)
+{
+	SDL_free(device->driverdata);
+	SDL_free(device);
+}
+
+/* FIXME: This is the 1.2 function at the moment.  Read through it and
+  o understand what it does. */
+int BE_VideoInit(_THIS)
+{
+	/* Initialize the Be Application for appserver interaction */
+	if (SDL_InitBeApp() < 0) {
+		return -1;
+	}
+	
+	BE_InitModes(_this);
+
+#if SDL_VIDEO_OPENGL
+        /* testgl application doesn't load library, just tries to load symbols */
+        /* is it correct? if so we have to load library here */
+    BE_GL_LoadLibrary(_this, NULL);
+#endif
+
+        /* Fill in some window manager capabilities */
+//    _this->info.wm_available = 1;
+
+        /* We're done! */
+    return (0);
+}
+
+static int BE_Available(void)
+{
+    return (1);
+}
+
+void BE_VideoQuit(_THIS)
+{
+
+#if 0
+        SDL_Win->Quit();
+        SDL_Win = NULL;
+#endif
+#if 0
+        if (SDL_BlankCursor != NULL) {
+            BE_FreeWMCursor(_this, SDL_BlankCursor);
+            SDL_BlankCursor = NULL;
+        }
+#endif
+
+    BE_QuitModes(_this);
+
+#if SDL_VIDEO_OPENGL
+//    if (_this->gl_config.dll_handle != NULL)
+//        unload_add_on((image_id) _this->gl_config.dll_handle);
+#endif
+
+    SDL_QuitBeApp();
+}
+
+#ifdef __cplusplus
+}
+#endif
--- a/src/video/bwindow/SDL_bwindow.c	Tue Jul 12 15:09:44 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2011 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"
-#include "../SDL_sysvideo.h"
-
-#include "SDL_BWin.h"
-#include <new>
-
-/* Define a path to window's BWIN data */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static inline SDL_BWin *_ToBeWin(SDL_Window *window) {
-	return ((SDL_BWin*)(window->driverdata));
-}
-
-static inline SDL_BApp *_GetBeApp() {
-	return ((SDL_BApp*)be_app);
-}
-
-int _InitWindow(_THIS, SDL_Window *window) {
-	BRect bounds(
-        window->x,
-        window->y,
-        window->x + window->w - 1,	//BeWindows have an off-by-one px w/h thing
-        window->y + window->h - 1
-    );
-    
-    SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds);
-    if(bwin == NULL)
-    	return ENOMEM;
-    
-    window->driverdata = bwin;
-    int32 winID = _GetBeApp()->GetID(window);
-    bwin->SetID(winID);
-    return 0;
-}
-
-int BE_CreateWindow(_THIS, SDL_Window *window) {
-	if(_InitWindow(_this, window) == ENOMEM)
-		return ENOMEM;
-	
-	/* Start window loop */
-    _ToBeWin(window)->Show();
-    return 0;
-}
-
-int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
-
-	SDL_BWin *otherBWin = (SDL_BWin*)data;
-	if(!otherBWin->LockLooper())
-		return -1;
-	
-	/* Create the new window and initialize its members */
-	window->x = (int)otherBWin->Frame().left;
-	window->y = (int)otherBWin->Frame().top;
-	window->w = (int)otherBWin->Frame().Width();
-	window->h = (int)otherBWin->Frame().Height();
-	
-	/* If we are out of memory, return the error code */
-	if(_InitWindow(_this, window) == ENOMEM)
-		return ENOMEM;
-	
-	/* TODO: Add any other SDL-supported window attributes here */
-    _ToBeWin(window)->SetTitle(otherBWin->Title());
-    
-    /* Start window loop and unlock the other window */
-    _ToBeWin(window)->Show();
-    
-    otherBWin->UnlockLooper();
-    return 0;
-}
-
-void BE_SetWindowTitle(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_SET_TITLE);
-	msg.AddString("window-title", window->title);
-	_ToBeWin(window)->PostMessage(&msg);
-}
-
-void BE_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) {
-	/* FIXME: Icons not supported by BeOs/Haiku */
-}
-
-void BE_SetWindowPosition(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_MOVE_WINDOW);
-	msg.AddInt32("window-x", window->x);
-	msg.AddInt32("window-y", window->y);
-	_ToBeWin(window)->PostMessage(&msg);
-}
-
-void BE_SetWindowSize(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_RESIZE_WINDOW);
-	msg.AddInt32("window-w", window->w - 1);
-	msg.AddInt32("window-h", window->h - 1);
-	_ToBeWin(window)->PostMessage(&msg);
-}
-
-void BE_ShowWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_SHOW_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
-}
-
-void BE_HideWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_HIDE_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
-}
-
-void BE_RaiseWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_SHOW_WINDOW);	/* Activate this window and move to front */
-	_ToBeWin(window)->PostMessage(&msg);
-}
-
-void BE_MaximizeWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_MAXIMIZE_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
-}
-
-void BE_MinimizeWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_MINIMIZE_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
-}
-
-void BE_RestoreWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_RESTORE_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
-}
-
-void BE_SetWindowFullscreen(_THIS, SDL_Window * window,
-		SDL_VideoDisplay * display, SDL_bool fullscreen) {
-	/* Haiku tracks all video display information */
-	BMessage msg(BWIN_FULLSCREEN);
-	msg.AddBool("fullscreen", fullscreen);
-	_ToBeWin(window)->PostMessage(&msg);
-	
-}
-
-int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
-	/* FIXME: Not BeOs/Haiku supported */
-}
-
-int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
-	/* FIXME: Not BeOs/Haiku supported */
-}
-
-
-void BE_SetWindowGrab(_THIS, SDL_Window * window) {
-	/* TODO: Implement this! */
-}
-
-void BE_DestroyWindow(_THIS, SDL_Window * window) {
-	_ToBeWin(window)->LockLooper();	/* This MUST be locked */
-	_GetBeApp()->ClearID(_ToBeWin(window));
-	_ToBeWin(window)->Quit();
-	window->driverdata = NULL;
-}
-
-SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window,
-                                    struct SDL_SysWMinfo *info) {
-	/* FIXME: What is the point of this? What information should be included? */
-}
-
-
-extern int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
-                                       Uint32 * format,
-                                       void ** pixels, int *pitch) {
-	/* FIXME: Not BeOs/Haiku supported */
-	return -1;
-}
-
-extern int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
-                                       SDL_Rect * rects, int numrects) {
-	/* FIXME: Not BeOs/Haiku supported */
-	return -1;
-}
-
-extern void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
-	/* FIXME: Not BeOs/Haiku supported */
-}
-
- 
-#ifdef __cplusplus
-}
-#endif
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/bwindow/SDL_bwindow.cc	Wed Jul 13 09:29:43 2011 +0000
@@ -0,0 +1,203 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2011 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"
+#include "../SDL_sysvideo.h"
+
+#include "SDL_BWin.h"
+#include <new>
+
+/* Define a path to window's BWIN data */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static inline SDL_BWin *_ToBeWin(SDL_Window *window) {
+	return ((SDL_BWin*)(window->driverdata));
+}
+
+static inline SDL_BApp *_GetBeApp() {
+	return ((SDL_BApp*)be_app);
+}
+
+int _InitWindow(_THIS, SDL_Window *window) {
+	BRect bounds(
+        window->x,
+        window->y,
+        window->x + window->w - 1,	//BeWindows have an off-by-one px w/h thing
+        window->y + window->h - 1
+    );
+    
+    SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds);
+    if(bwin == NULL)
+    	return ENOMEM;
+    
+    window->driverdata = bwin;
+    int32 winID = _GetBeApp()->GetID(window);
+    bwin->SetID(winID);
+    return 0;
+}
+
+int BE_CreateWindow(_THIS, SDL_Window *window) {
+	if(_InitWindow(_this, window) == ENOMEM)
+		return ENOMEM;
+	
+	/* Start window loop */
+    _ToBeWin(window)->Show();
+    return 0;
+}
+
+int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
+
+	SDL_BWin *otherBWin = (SDL_BWin*)data;
+	if(!otherBWin->LockLooper())
+		return -1;
+	
+	/* Create the new window and initialize its members */
+	window->x = (int)otherBWin->Frame().left;
+	window->y = (int)otherBWin->Frame().top;
+	window->w = (int)otherBWin->Frame().Width();
+	window->h = (int)otherBWin->Frame().Height();
+	
+	/* If we are out of memory, return the error code */
+	if(_InitWindow(_this, window) == ENOMEM)
+		return ENOMEM;
+	
+	/* TODO: Add any other SDL-supported window attributes here */
+    _ToBeWin(window)->SetTitle(otherBWin->Title());
+    
+    /* Start window loop and unlock the other window */
+    _ToBeWin(window)->Show();
+    
+    otherBWin->UnlockLooper();
+    return 0;
+}
+
+void BE_SetWindowTitle(_THIS, SDL_Window * window) {
+	BMessage msg(BWIN_SET_TITLE);
+	msg.AddString("window-title", window->title);
+	_ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) {
+	/* FIXME: Icons not supported by BeOs/Haiku */
+}
+
+void BE_SetWindowPosition(_THIS, SDL_Window * window) {
+	BMessage msg(BWIN_MOVE_WINDOW);
+	msg.AddInt32("window-x", window->x);
+	msg.AddInt32("window-y", window->y);
+	_ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_SetWindowSize(_THIS, SDL_Window * window) {
+	BMessage msg(BWIN_RESIZE_WINDOW);
+	msg.AddInt32("window-w", window->w - 1);
+	msg.AddInt32("window-h", window->h - 1);
+	_ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_ShowWindow(_THIS, SDL_Window * window) {
+	BMessage msg(BWIN_SHOW_WINDOW);
+	_ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_HideWindow(_THIS, SDL_Window * window) {
+	BMessage msg(BWIN_HIDE_WINDOW);
+	_ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_RaiseWindow(_THIS, SDL_Window * window) {
+	BMessage msg(BWIN_SHOW_WINDOW);	/* Activate this window and move to front */
+	_ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_MaximizeWindow(_THIS, SDL_Window * window) {
+	BMessage msg(BWIN_MAXIMIZE_WINDOW);
+	_ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_MinimizeWindow(_THIS, SDL_Window * window) {
+	BMessage msg(BWIN_MINIMIZE_WINDOW);
+	_ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_RestoreWindow(_THIS, SDL_Window * window) {
+	BMessage msg(BWIN_RESTORE_WINDOW);
+	_ToBeWin(window)->PostMessage(&msg);
+}
+
+void BE_SetWindowFullscreen(_THIS, SDL_Window * window,
+		SDL_VideoDisplay * display, SDL_bool fullscreen) {
+	/* Haiku tracks all video display information */
+	BMessage msg(BWIN_FULLSCREEN);
+	msg.AddBool("fullscreen", fullscreen);
+	_ToBeWin(window)->PostMessage(&msg);
+	
+}
+
+int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
+	/* FIXME: Not BeOs/Haiku supported */
+}
+
+int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
+	/* FIXME: Not BeOs/Haiku supported */
+}
+
+
+void BE_SetWindowGrab(_THIS, SDL_Window * window) {
+	/* TODO: Implement this! */
+}
+
+void BE_DestroyWindow(_THIS, SDL_Window * window) {
+	_ToBeWin(window)->LockLooper();	/* This MUST be locked */
+	_GetBeApp()->ClearID(_ToBeWin(window));
+	_ToBeWin(window)->Quit();
+	window->driverdata = NULL;
+}
+
+SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window,
+                                    struct SDL_SysWMinfo *info) {
+	/* FIXME: What is the point of this? What information should be included? */
+}
+
+
+extern int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
+                                       Uint32 * format,
+                                       void ** pixels, int *pitch) {
+	/* FIXME: Not BeOs/Haiku supported */
+	return -1;
+}
+
+extern int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
+                                       SDL_Rect * rects, int numrects) {
+	/* FIXME: Not BeOs/Haiku supported */
+	return -1;
+}
+
+extern void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
+	/* FIXME: Not BeOs/Haiku supported */
+}
+
+ 
+#ifdef __cplusplus
+}
+#endif
+