aboutsummaryrefslogtreecommitdiffstats
path: root/distrib/sdl-1.2.12/src/video/bwindow
diff options
context:
space:
mode:
Diffstat (limited to 'distrib/sdl-1.2.12/src/video/bwindow')
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_BView.h116
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_BWin.h282
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_lowvideo.h58
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_sysevents.cc381
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_sysevents_c.h31
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_sysmouse.cc153
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_sysmouse_c.h33
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_sysvideo.cc829
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_syswm.cc91
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_syswm_c.h32
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_sysyuv.cc314
-rw-r--r--distrib/sdl-1.2.12/src/video/bwindow/SDL_sysyuv.h73
12 files changed, 0 insertions, 2393 deletions
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_BView.h b/distrib/sdl-1.2.12/src/video/bwindow/SDL_BView.h
deleted file mode 100644
index 564d064..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_BView.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#ifndef _SDL_BView_h
-#define _SDL_BView_h
-
-/* This is the event handling and graphics update portion of SDL_BWin */
-
-extern "C" {
-#include "../../events/SDL_events_c.h"
-};
-
-class SDL_BView : public BView
-{
-public:
- SDL_BView(BRect frame) :
- BView(frame, "SDL View", B_FOLLOW_ALL_SIDES,
- (B_WILL_DRAW|B_FRAME_EVENTS)) {
- image = NULL;
- xoff = yoff = 0;
- SetViewColor(0,0,0,0);
- SetHighColor(0,0,0,0);
- }
- virtual ~SDL_BView() {
- SetBitmap(NULL);
- }
- /* Set drawing offsets for fullscreen mode */
- virtual void SetXYOffset(int x, int y) {
- xoff = x;
- yoff = y;
- }
- virtual void GetXYOffset(int &x, int &y) {
- x = xoff;
- y = yoff;
- }
- virtual void GetXYOffset(float &x, float &y) {
- x = (float)xoff;
- y = (float)yoff;
- }
- /* The view changed size. If it means we're in fullscreen, we
- * draw a nice black box in the entire view to get black borders.
- */
- virtual void FrameResized(float width, float height) {
- BRect bounds;
- bounds.top = bounds.left = 0;
- bounds.right = width;
- bounds.bottom = height;
- /* Fill the entire view with black */
- FillRect(bounds, B_SOLID_HIGH);
- /* And if there's an image, redraw it. */
- if( image ) {
- bounds = image->Bounds();
- Draw(bounds);
- }
- }
-
- /* Drawing portion of this complete breakfast. :) */
- virtual void SetBitmap(BBitmap *bitmap) {
- if ( image ) {
- delete image;
- }
- image = bitmap;
- }
- virtual void Draw(BRect updateRect) {
- if ( image ) {
- if(xoff || yoff) {
- BRect dest;
- dest.top = updateRect.top + yoff;
- dest.left = updateRect.left + xoff;
- dest.bottom = updateRect.bottom + yoff;
- dest.right = updateRect.right + xoff;
- DrawBitmap(image, updateRect, dest);
- } else {
- DrawBitmap(image, updateRect, updateRect);
- }
- }
- }
- virtual void DrawAsync(BRect updateRect) {
- if(xoff || yoff) {
- BRect dest;
- dest.top = updateRect.top + yoff;
- dest.left = updateRect.left + xoff;
- dest.bottom = updateRect.bottom + yoff;
- dest.right = updateRect.right + xoff;;
- DrawBitmapAsync(image, updateRect, dest);
- } else {
- DrawBitmapAsync(image, updateRect, updateRect);
- }
- }
-
-private:
- BBitmap *image;
- int xoff, yoff;
-};
-
-#endif /* _SDL_BView_h */
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_BWin.h b/distrib/sdl-1.2.12/src/video/bwindow/SDL_BWin.h
deleted file mode 100644
index 952d5a2..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_BWin.h
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_BWin_h
-#define _SDL_BWin_h
-
-#include "SDL_config.h"
-
-#include <stdio.h>
-#include <AppKit.h>
-#include <InterfaceKit.h>
-#include <be/game/DirectWindow.h>
-#if SDL_VIDEO_OPENGL
-#include <be/opengl/GLView.h>
-#endif
-#include <support/UTF8.h>
-
-#include "../../main/beos/SDL_BeApp.h"
-#include "SDL_events.h"
-#include "SDL_BView.h"
-
-extern "C" {
-#include "../../events/SDL_events_c.h"
-
-extern int mouse_relative;
-};
-
-class SDL_BWin : public BDirectWindow
-{
-public:
- SDL_BWin(BRect bounds) :
- BDirectWindow(bounds, "Untitled", B_TITLED_WINDOW, 0) {
- last_buttons = 0;
- the_view = NULL;
-#if SDL_VIDEO_OPENGL
- SDL_GLView = NULL;
-#endif
- SDL_View = NULL;
- Unlock();
- shown = false;
- inhibit_resize = false;
- }
-
- virtual ~SDL_BWin() {
- Lock();
- if ( the_view ) {
-#if SDL_VIDEO_OPENGL
- if ( the_view == SDL_GLView ) {
- SDL_GLView->UnlockGL();
- }
-#endif
- RemoveChild(the_view);
- the_view = NULL;
- }
- Unlock();
-#if SDL_VIDEO_OPENGL
- if ( SDL_GLView ) {
- delete SDL_GLView;
- }
-#endif
- if ( SDL_View ) {
- delete SDL_View;
- }
- }
-
-
- /* Override the Show() method so we can tell when we've been shown */
- virtual void Show(void) {
- BWindow::Show();
- shown = true;
- }
- virtual bool Shown(void) {
- return (shown);
- }
- /* If called, the next resize event will not be forwarded to SDL. */
- virtual void InhibitResize(void) {
- inhibit_resize=true;
- }
- /* Handle resizing of the window */
- virtual void FrameResized(float width, float height) {
- if(inhibit_resize)
- inhibit_resize = false;
- else
- SDL_PrivateResize((int)width, (int)height);
- }
- virtual int CreateView(Uint32 flags, Uint32 gl_flags) {
- int retval;
-
- retval = 0;
- Lock();
- if ( flags & SDL_OPENGL ) {
-#if SDL_VIDEO_OPENGL
- if ( SDL_GLView == NULL ) {
- SDL_GLView = new BGLView(Bounds(), "SDL GLView",
- B_FOLLOW_ALL_SIDES, (B_WILL_DRAW|B_FRAME_EVENTS),
- gl_flags);
- SDL_GLView->EnableDirectMode(true);
- }
- if ( the_view != SDL_GLView ) {
- if ( the_view ) {
- RemoveChild(the_view);
- }
- AddChild(SDL_GLView);
- SDL_GLView->LockGL();
- the_view = SDL_GLView;
- }
-#else
- SDL_SetError("OpenGL support not enabled");
- retval = -1;
-#endif
- } else {
- if ( SDL_View == NULL ) {
- SDL_View = new SDL_BView(Bounds());
- }
- if ( the_view != SDL_View ) {
- if ( the_view ) {
-#if SDL_VIDEO_OPENGL
- if ( the_view == SDL_GLView ) {
- SDL_GLView->UnlockGL();
- }
-#endif
- RemoveChild(the_view);
- }
- AddChild(SDL_View);
- the_view = SDL_View;
- }
- }
- Unlock();
- return(retval);
- }
- virtual void SetBitmap(BBitmap *bitmap) {
- SDL_View->SetBitmap(bitmap);
- }
- virtual void SetXYOffset(int x, int y) {
-#if SDL_VIDEO_OPENGL
- if ( the_view == SDL_GLView ) {
- return;
- }
-#endif
- SDL_View->SetXYOffset(x, y);
- }
- virtual void GetXYOffset(int &x, int &y) {
-#if SDL_VIDEO_OPENGL
- if ( the_view == SDL_GLView ) {
- x = 0;
- y = 0;
- return;
- }
-#endif
- SDL_View->GetXYOffset(x, y);
- }
- virtual void GetXYOffset(float &x, float &y) {
-#if SDL_VIDEO_OPENGL
- if ( the_view == SDL_GLView ) {
- x = 0.0f;
- y = 0.0f;
- return;
- }
-#endif
- SDL_View->GetXYOffset(x, y);
- }
- virtual bool BeginDraw(void) {
- return(Lock());
- }
- virtual void DrawAsync(BRect updateRect) {
- SDL_View->DrawAsync(updateRect);
- }
- virtual void EndDraw(void) {
- SDL_View->Sync();
- Unlock();
- }
-#if SDL_VIDEO_OPENGL
- virtual void SwapBuffers(void) {
- SDL_GLView->UnlockGL();
- SDL_GLView->LockGL();
- SDL_GLView->SwapBuffers();
- }
-#endif
- virtual BView *View(void) {
- return(the_view);
- }
-
- /* Hook functions -- overridden */
- virtual void Minimize(bool minimize) {
- /* This is only called when mimimized, not when restored */
- //SDL_PrivateAppActive(minimize, SDL_APPACTIVE);
- BWindow::Minimize(minimize);
- }
- virtual void WindowActivated(bool active) {
- SDL_PrivateAppActive(active, SDL_APPINPUTFOCUS);
- }
- virtual bool QuitRequested(void) {
- if ( SDL_BeAppActive > 0 ) {
- SDL_PrivateQuit();
- /* We don't ever actually close the window here because
- the application should respond to the quit request,
- or ignore it as desired.
- */
- return(false);
- }
- return(true); /* Close the app window */
- }
- virtual void Quit() {
- if (!IsLocked())
- Lock();
- BDirectWindow::Quit();
- }
-
- virtual int16 Translate2Unicode(const char *buf) {
- int32 state, srclen, dstlen;
- unsigned char destbuf[2];
- Uint16 unicode = 0;
-
- if ((uchar)buf[0] > 127) {
- state = 0;
- srclen = SDL_strlen(buf);
- dstlen = sizeof(destbuf);
- convert_from_utf8(B_UNICODE_CONVERSION, buf, &srclen, (char *)destbuf, &dstlen, &state);
- unicode = destbuf[0];
- unicode <<= 8;
- unicode |= destbuf[1];
- } else
- unicode = buf[0];
-
- /* For some reason function keys map to control characters */
-# define CTRL(X) ((X)-'@')
- switch (unicode) {
- case CTRL('A'):
- case CTRL('B'):
- case CTRL('C'):
- case CTRL('D'):
- case CTRL('E'):
- case CTRL('K'):
- case CTRL('L'):
- case CTRL('P'):
- if ( ! (SDL_GetModState() & KMOD_CTRL) )
- unicode = 0;
- break;
- /* Keyboard input maps newline to carriage return */
- case '\n':
- unicode = '\r';
- break;
- default:
- break;
- }
-
- return unicode;
- }
-
- virtual void DispatchMessage(BMessage *msg, BHandler *target);
-
-private:
-#if SDL_VIDEO_OPENGL
- BGLView *SDL_GLView;
-#endif
- SDL_BView *SDL_View;
- BView *the_view;
- bool shown;
- bool inhibit_resize;
- int32 last_buttons;
-};
-
-#endif /* _SDL_BWin_h */
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_lowvideo.h b/distrib/sdl-1.2.12/src/video/bwindow/SDL_lowvideo.h
deleted file mode 100644
index 7af004b..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_lowvideo.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#ifndef _SDL_lowvideo_h
-#define _SDL_lowvideo_h
-
-#include "SDL_BWin.h"
-#include "SDL_mouse.h"
-#include "../SDL_sysvideo.h"
-
-/* Hidden "this" pointer for the video functions */
-#define _THIS SDL_VideoDevice *_this
-
-/* Private display data */
-struct SDL_PrivateVideoData {
- /* The main window */
- SDL_BWin *SDL_Win;
-
- /* The fullscreen mode list */
- display_mode saved_mode;
-#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
- int SDL_nummodes[NUM_MODELISTS];
- SDL_Rect **SDL_modelist[NUM_MODELISTS];
-
- /* A completely clear cursor */
- WMcursor *BlankCursor;
-
- SDL_Overlay *overlay;
-};
-/* Old variable names */
-#define SDL_Win (_this->hidden->SDL_Win)
-#define saved_mode (_this->hidden->saved_mode)
-#define SDL_nummodes (_this->hidden->SDL_nummodes)
-#define SDL_modelist (_this->hidden->SDL_modelist)
-#define SDL_BlankCursor (_this->hidden->BlankCursor)
-#define current_overlay (_this->hidden->overlay)
-
-#endif /* _SDL_lowvideo_h */
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysevents.cc b/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysevents.cc
deleted file mode 100644
index f011c57..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysevents.cc
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#include <support/UTF8.h>
-#include <stdio.h>
-#include <string.h>
-#include "SDL_error.h"
-#include "SDL_events.h"
-#include "SDL_BWin.h"
-#include "SDL_lowvideo.h"
-
-static SDLKey keymap[128];
-int mouse_relative = 0;
-extern "C" {
-
-#include "../../events/SDL_sysevents.h"
-#include "../../events/SDL_events_c.h"
-#include "SDL_sysevents_c.h"
-
-void BE_PumpEvents(_THIS)
-{
-}
-
-void BE_InitOSKeymap(_THIS)
-{
- for ( uint i=0; i<SDL_TABLESIZE(keymap); ++i )
- keymap[i] = SDLK_UNKNOWN;
-
- keymap[0x01] = SDLK_ESCAPE;
- keymap[B_F1_KEY] = SDLK_F1;
- keymap[B_F2_KEY] = SDLK_F2;
- keymap[B_F3_KEY] = SDLK_F3;
- keymap[B_F4_KEY] = SDLK_F4;
- keymap[B_F5_KEY] = SDLK_F5;
- keymap[B_F6_KEY] = SDLK_F6;
- keymap[B_F7_KEY] = SDLK_F7;
- keymap[B_F8_KEY] = SDLK_F8;
- keymap[B_F9_KEY] = SDLK_F9;
- keymap[B_F10_KEY] = SDLK_F10;
- keymap[B_F11_KEY] = SDLK_F11;
- keymap[B_F12_KEY] = SDLK_F12;
- keymap[B_PRINT_KEY] = SDLK_PRINT;
- keymap[B_SCROLL_KEY] = SDLK_SCROLLOCK;
- keymap[B_PAUSE_KEY] = SDLK_PAUSE;
- keymap[0x11] = SDLK_BACKQUOTE;
- keymap[0x12] = SDLK_1;
- keymap[0x13] = SDLK_2;
- keymap[0x14] = SDLK_3;
- keymap[0x15] = SDLK_4;
- keymap[0x16] = SDLK_5;
- keymap[0x17] = SDLK_6;
- keymap[0x18] = SDLK_7;
- keymap[0x19] = SDLK_8;
- keymap[0x1a] = SDLK_9;
- keymap[0x1b] = SDLK_0;
- keymap[0x1c] = SDLK_MINUS;
- keymap[0x1d] = SDLK_EQUALS;
- keymap[0x1e] = SDLK_BACKSPACE;
- keymap[0x1f] = SDLK_INSERT;
- keymap[0x20] = SDLK_HOME;
- keymap[0x21] = SDLK_PAGEUP;
- keymap[0x22] = SDLK_NUMLOCK;
- keymap[0x23] = SDLK_KP_DIVIDE;
- keymap[0x24] = SDLK_KP_MULTIPLY;
- keymap[0x25] = SDLK_KP_MINUS;
- keymap[0x26] = SDLK_TAB;
- keymap[0x27] = SDLK_q;
- keymap[0x28] = SDLK_w;
- keymap[0x29] = SDLK_e;
- keymap[0x2a] = SDLK_r;
- keymap[0x2b] = SDLK_t;
- keymap[0x2c] = SDLK_y;
- keymap[0x2d] = SDLK_u;
- keymap[0x2e] = SDLK_i;
- keymap[0x2f] = SDLK_o;
- keymap[0x30] = SDLK_p;
- keymap[0x31] = SDLK_LEFTBRACKET;
- keymap[0x32] = SDLK_RIGHTBRACKET;
- keymap[0x33] = SDLK_BACKSLASH;
- keymap[0x34] = SDLK_DELETE;
- keymap[0x35] = SDLK_END;
- keymap[0x36] = SDLK_PAGEDOWN;
- keymap[0x37] = SDLK_KP7;
- keymap[0x38] = SDLK_KP8;
- keymap[0x39] = SDLK_KP9;
- keymap[0x3a] = SDLK_KP_PLUS;
- keymap[0x3b] = SDLK_CAPSLOCK;
- keymap[0x3c] = SDLK_a;
- keymap[0x3d] = SDLK_s;
- keymap[0x3e] = SDLK_d;
- keymap[0x3f] = SDLK_f;
- keymap[0x40] = SDLK_g;
- keymap[0x41] = SDLK_h;
- keymap[0x42] = SDLK_j;
- keymap[0x43] = SDLK_k;
- keymap[0x44] = SDLK_l;
- keymap[0x45] = SDLK_SEMICOLON;
- keymap[0x46] = SDLK_QUOTE;
- keymap[0x47] = SDLK_RETURN;
- keymap[0x48] = SDLK_KP4;
- keymap[0x49] = SDLK_KP5;
- keymap[0x4a] = SDLK_KP6;
- keymap[0x4b] = SDLK_LSHIFT;
- keymap[0x4c] = SDLK_z;
- keymap[0x4d] = SDLK_x;
- keymap[0x4e] = SDLK_c;
- keymap[0x4f] = SDLK_v;
- keymap[0x50] = SDLK_b;
- keymap[0x51] = SDLK_n;
- keymap[0x52] = SDLK_m;
- keymap[0x53] = SDLK_COMMA;
- keymap[0x54] = SDLK_PERIOD;
- keymap[0x55] = SDLK_SLASH;
- keymap[0x56] = SDLK_RSHIFT;
- keymap[0x57] = SDLK_UP;
- keymap[0x58] = SDLK_KP1;
- keymap[0x59] = SDLK_KP2;
- keymap[0x5a] = SDLK_KP3;
- keymap[0x5b] = SDLK_KP_ENTER;
- keymap[0x5c] = SDLK_LCTRL;
- keymap[0x5d] = SDLK_LALT;
- keymap[0x5e] = SDLK_SPACE;
- keymap[0x5f] = SDLK_RALT;
- keymap[0x60] = SDLK_RCTRL;
- keymap[0x61] = SDLK_LEFT;
- keymap[0x62] = SDLK_DOWN;
- keymap[0x63] = SDLK_RIGHT;
- keymap[0x64] = SDLK_KP0;
- keymap[0x65] = SDLK_KP_PERIOD;
- keymap[0x66] = SDLK_LMETA;
- keymap[0x67] = SDLK_RMETA;
- keymap[0x68] = SDLK_MENU;
- keymap[0x69] = SDLK_EURO;
- keymap[0x6a] = SDLK_KP_EQUALS;
- keymap[0x6b] = SDLK_POWER;
-}
-
-}; /* Extern C */
-
-void SDL_BWin::DispatchMessage(BMessage *msg, BHandler *target)
-{
- switch (msg->what) {
- case B_MOUSE_MOVED:
- {
- SDL_VideoDevice *view = current_video;
- BPoint where;
- int32 transit;
- if (msg->FindPoint("where", &where) == B_OK && msg->FindInt32("be:transit", &transit) == B_OK) {
- int x, y;
-
- GetXYOffset(x, y);
- x = (int)where.x - x;
- y = (int)where.y - y;
-
- //BeSman: I need another method for cursor catching !!!
- if (view->input_grab != SDL_GRAB_OFF)
- {
- bool clipped = false;
- if ( x < 0 ) {
- x = 0;
- clipped = true;
- } else if ( x >= SDL_VideoSurface->w ) {
- x = (SDL_VideoSurface->w-1);
- clipped = true;
- }
- if ( y < 0 ) {
- y = 0;
- clipped = true;
- } else if ( y >= SDL_VideoSurface->h ) {
- y = (SDL_VideoSurface->h-1);
- clipped = true;
- }
- if ( clipped ) {
- BPoint edge;
- GetXYOffset(edge.x, edge.y);
- edge.x += x;
- edge.y += y;
- ConvertToScreen(&edge);
- set_mouse_position((int)edge.x, (int)edge.y);
- }
- transit = B_INSIDE_VIEW;
- }
- if (transit == B_EXITED_VIEW) {
- if ( SDL_GetAppState() & SDL_APPMOUSEFOCUS ) {
- SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
- be_app->SetCursor(B_HAND_CURSOR);
- }
- } else {
- if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
- SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
- SDL_SetCursor(NULL);
- }
-
- if ( mouse_relative ) {
- int half_w = (SDL_VideoSurface->w/2);
- int half_h = (SDL_VideoSurface->h/2);
- x -= half_w;
- y -= half_h;
- if ( x || y ) {
- BPoint center;
- GetXYOffset(center.x, center.y);
- center.x += half_w;
- center.y += half_h;
- ConvertToScreen(&center);
- set_mouse_position((int)center.x, (int)center.y);
- SDL_PrivateMouseMotion(0, 1, x, y);
- }
- } else {
- SDL_PrivateMouseMotion(0, 0, x, y);
- }
- }
- }
- break;
- }
-
- case B_MOUSE_DOWN:
- {
- /* it looks like mouse down is send only for first clicked
- button, each next is not send while last one is holded */
- int32 buttons;
- int sdl_buttons = 0;
- if (msg->FindInt32("buttons", &buttons) == B_OK) {
- /* Add any mouse button events */
- if (buttons & B_PRIMARY_MOUSE_BUTTON) {
- sdl_buttons |= SDL_BUTTON_LEFT;
- }
- if (buttons & B_SECONDARY_MOUSE_BUTTON) {
- sdl_buttons |= SDL_BUTTON_RIGHT;
- }
- if (buttons & B_TERTIARY_MOUSE_BUTTON) {
- sdl_buttons |= SDL_BUTTON_MIDDLE;
- }
- SDL_PrivateMouseButton(SDL_PRESSED, sdl_buttons, 0, 0);
-
- last_buttons = buttons;
- }
- break;
- }
-
- case B_MOUSE_UP:
- {
- /* mouse up doesn't give which button was released,
- only state of buttons (after release, so it's always = 0),
- which is not what we need ;]
- So we need to store button in mouse down, and restore
- in mouse up :(
- mouse up is (similarly to mouse down) send only for
- first button down (ie. it's no send if we click another button
- without releasing previous one first) - but that's probably
- because of how drivers are written?, not BeOS itself. */
- int32 buttons;
- int sdl_buttons = 0;
- if (msg->FindInt32("buttons", &buttons) == B_OK) {
- /* Add any mouse button events */
- if ((buttons ^ B_PRIMARY_MOUSE_BUTTON) & last_buttons) {
- sdl_buttons |= SDL_BUTTON_LEFT;
- }
- if ((buttons ^ B_SECONDARY_MOUSE_BUTTON) & last_buttons) {
- sdl_buttons |= SDL_BUTTON_RIGHT;
- }
- if ((buttons ^ B_TERTIARY_MOUSE_BUTTON) & last_buttons) {
- sdl_buttons |= SDL_BUTTON_MIDDLE;
- }
- SDL_PrivateMouseButton(SDL_RELEASED, sdl_buttons, 0, 0);
-
- last_buttons = buttons;
- }
- break;
- }
-
- case B_MOUSE_WHEEL_CHANGED:
- {
- float x, y;
- x = y = 0;
- if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
- if (x < 0 || y < 0) {
- SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0);
- SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
- } else if (x > 0 || y > 0) {
- SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELUP, 0, 0);
- SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELUP, 0, 0);
- }
- }
- break;
- }
-
- case B_KEY_DOWN:
- case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */
- {
- int32 key;
- int32 modifiers;
- int32 key_repeat;
- /* Workaround for SDL message queue being filled too fast because of BeOS own key-repeat mechanism */
- if (msg->FindInt32("be:key_repeat", &key_repeat) == B_OK && key_repeat > 0)
- break;
-
- if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) {
- SDL_keysym keysym;
- keysym.scancode = key;
- if (key < 128) {
- keysym.sym = keymap[key];
- } else {
- keysym.sym = SDLK_UNKNOWN;
- }
- /* FIX THIS?
- it seems SDL_PrivateKeyboard() changes mod value
- anyway, and doesn't care about what we setup here */
- keysym.mod = KMOD_NONE;
- keysym.unicode = 0;
- if (SDL_TranslateUNICODE) {
- const char *bytes;
- if (msg->FindString("bytes", &bytes) == B_OK) {
- /* FIX THIS?
- this cares only about first "letter",
- so if someone maps some key to print
- "BeOS rulez!" only "B" will be used. */
- keysym.unicode = Translate2Unicode(bytes);
- }
- }
- SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
- }
- break;
- }
-
- case B_KEY_UP:
- case B_UNMAPPED_KEY_UP: /* modifier keys are unmapped */
- {
- int32 key;
- int32 modifiers;
- if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) {
- SDL_keysym keysym;
- keysym.scancode = key;
- if (key < 128) {
- keysym.sym = keymap[key];
- } else {
- keysym.sym = SDLK_UNKNOWN;
- }
- keysym.mod = KMOD_NONE; /* FIX THIS? */
- keysym.unicode = 0;
- if (SDL_TranslateUNICODE) {
- const char *bytes;
- if (msg->FindString("bytes", &bytes) == B_OK) {
- keysym.unicode = Translate2Unicode(bytes);
- }
- }
- SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
- }
- break;
- }
-
- default:
- /* move it after switch{} so it's always handled
- that way we keep BeOS feautures like:
- - CTRL+Q to close window (and other shortcuts)
- - PrintScreen to make screenshot into /boot/home
- - etc.. */
- //BDirectWindow::DispatchMessage(msg, target);
- break;
- }
- BDirectWindow::DispatchMessage(msg, target);
-}
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysevents_c.h b/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysevents_c.h
deleted file mode 100644
index e2ef3f5..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysevents_c.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#include "SDL_lowvideo.h"
-
-/* Variables and functions exported by SDL_sysevents.c to other parts
- of the native video subsystem (SDL_sysvideo.c)
-*/
-
-extern void BE_InitOSKeymap(_THIS);
-extern void BE_PumpEvents(_THIS);
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysmouse.cc b/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysmouse.cc
deleted file mode 100644
index 232186d..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysmouse.cc
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#include <AppKit.h>
-#include <GameKit.h>
-
-#include "SDL_BWin.h"
-
-extern "C" {
-#include "../SDL_cursor_c.h"
-#include "SDL_sysmouse_c.h"
-
-/* Convert bits to padded bytes */
-#define PADDED_BITS(bits) ((bits+7)/8)
-
-/* The implementation dependent data for the window manager cursor */
-struct WMcursor {
- char *bits;
-};
-
-/* Can this be done in the BeOS? */
-WMcursor *BE_CreateWMCursor(_THIS,
- Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
-{
- WMcursor *cursor;
- int allowed_x;
- int allowed_y;
- int run, pad, i;
- char *cptr;
-
- allowed_x = 16; /* BeOS limitation */
- allowed_y = 16; /* BeOS limitation */
- if ( (w > allowed_x) || (h > allowed_y) ) {
- SDL_SetError("Only cursors of dimension (%dx%d) are allowed",
- allowed_x, allowed_y);
- return(NULL);
- }
-
- /* Allocate the cursor */
- cursor = (WMcursor *)SDL_malloc(sizeof(WMcursor));
- if ( cursor == NULL ) {
- SDL_OutOfMemory();
- return(NULL);
- }
- cursor->bits = (char *)SDL_malloc(4+2*((allowed_x/8)*allowed_y));
- if ( cursor->bits == NULL ) {
- SDL_free(cursor);
- SDL_OutOfMemory();
- return(NULL);
- }
- cursor->bits[0] = allowed_y; /* Size of the cursor */
- cursor->bits[1] = 1; /* Bit depth of cursor */
- cursor->bits[2] = hot_y;
- cursor->bits[3] = hot_x;
- cptr = &cursor->bits[4];
-
- /* Pad out to the normal cursor size */
- run = PADDED_BITS(w);
- pad = PADDED_BITS(allowed_x)-run;
- for ( i=0; i<h; ++i ) {
- SDL_memcpy(cptr, data, run);
- SDL_memset(cptr+run, 0, pad);
- data += run;
- cptr += (run+pad);
- }
- for ( ; i<allowed_y; ++i ) {
- SDL_memset(cptr, 0, run+pad);
- cptr += (run+pad);
- }
- for ( i=0; i<h; ++i ) {
- /* FIXME: The mask should be OR'd with the data to turn
- inverted color pixels black, since inverted color pixels
- aren't supported under BeOS.
- */
- SDL_memcpy(cptr, mask, run);
- SDL_memset(cptr+run, 0, pad);
- mask += run;
- cptr += (run+pad);
- }
- for ( ; i<allowed_y; ++i ) {
- SDL_memset(cptr, 0, run+pad);
- cptr += (run+pad);
- }
- return(cursor);
-}
-
-int BE_ShowWMCursor(_THIS, WMcursor *cursor)
-{
- if ( be_app->Lock() ) {
- if ( cursor == NULL ) {
- if ( SDL_BlankCursor != NULL ) {
- be_app->SetCursor(SDL_BlankCursor->bits);
- }
- } else {
- be_app->SetCursor(cursor->bits);
- }
- be_app->Unlock();
- }
- return(1);
-}
-
-void BE_FreeWMCursor(_THIS, WMcursor *cursor)
-{
- SDL_free(cursor->bits);
- SDL_free(cursor);
-}
-
-/* Implementation by Christian Bauer <cbauer@student.physik.uni-mainz.de> */
-void BE_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
-{
- BPoint pt;
- SDL_Win->GetXYOffset(pt.x, pt.y);
- pt.x += x;
- pt.y += y;
- SDL_Win->Lock();
- SDL_Win->ConvertToScreen(&pt);
- SDL_Win->Unlock();
- set_mouse_position((int32)pt.x, (int32)pt.y);
-}
-
-/* Check to see if we need to enter or leave mouse relative mode */
-void BE_CheckMouseMode(_THIS)
-{
- /* If the mouse is hidden and input is grabbed, we use relative mode */
- if ( !(SDL_cursorstate & CURSOR_VISIBLE) &&
- (_this->input_grab != SDL_GRAB_OFF) ) {
- mouse_relative = 1;
- } else {
- mouse_relative = 0;
- }
-}
-
-}; /* Extern C */
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysmouse_c.h b/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysmouse_c.h
deleted file mode 100644
index 4f4844e..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysmouse_c.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#include "SDL_lowvideo.h"
-
-/* Functions to be exported */
-extern void BE_FreeWMCursor(_THIS, WMcursor *cursor);
-extern WMcursor *BE_CreateWMCursor(_THIS,
- Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
-extern int BE_ShowWMCursor(_THIS, WMcursor *cursor);
-extern void BE_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
-extern void BE_CheckMouseMode(_THIS);
-
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysvideo.cc b/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysvideo.cc
deleted file mode 100644
index 59edec6..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysvideo.cc
+++ /dev/null
@@ -1,829 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/* BWindow based framebuffer implementation */
-
-#include <unistd.h>
-
-#include "SDL_BWin.h"
-#include "SDL_timer.h"
-
-extern "C" {
-
-#include "../SDL_sysvideo.h"
-#include "../../events/SDL_events_c.h"
-#include "SDL_sysevents_c.h"
-#include "SDL_sysmouse_c.h"
-#include "SDL_syswm_c.h"
-#include "SDL_lowvideo.h"
-#include "../SDL_yuvfuncs.h"
-#include "SDL_sysyuv.h"
-#include "../blank_cursor.h"
-
-#define BEOS_HIDDEN_SIZE 32 /* starting hidden window size */
-
-/* Initialization/Query functions */
-static int BE_VideoInit(_THIS, SDL_PixelFormat *vformat);
-static SDL_Rect **BE_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
-static SDL_Surface *BE_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
-static void BE_UpdateMouse(_THIS);
-static int BE_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
-static void BE_VideoQuit(_THIS);
-
-/* Hardware surface functions */
-static int BE_AllocHWSurface(_THIS, SDL_Surface *surface);
-static int BE_LockHWSurface(_THIS, SDL_Surface *surface);
-static void BE_UnlockHWSurface(_THIS, SDL_Surface *surface);
-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);
-
-/* OpenGL functions */
-#if SDL_VIDEO_OPENGL
-static int BE_GL_LoadLibrary(_THIS, const char *path);
-static void* BE_GL_GetProcAddress(_THIS, const char *proc);
-static int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
-static int BE_GL_MakeCurrent(_THIS);
-static void BE_GL_SwapBuffers(_THIS);
-#endif
-
-/* FB driver bootstrap functions */
-
-static int BE_Available(void)
-{
- return(1);
-}
-
-static void BE_DeleteDevice(SDL_VideoDevice *device)
-{
- SDL_free(device->hidden);
- SDL_free(device);
-}
-
-static SDL_VideoDevice *BE_CreateDevice(int devindex)
-{
- SDL_VideoDevice *device;
-
- /* Initialize all variables that we clean on shutdown */
- device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
- if ( device ) {
- SDL_memset(device, 0, (sizeof *device));
- device->hidden = (struct SDL_PrivateVideoData *)
- SDL_malloc((sizeof *device->hidden));
- }
- if ( (device == NULL) || (device->hidden == NULL) ) {
- SDL_OutOfMemory();
- if ( device ) {
- SDL_free(device);
- }
- return(0);
- }
- SDL_memset(device->hidden, 0, (sizeof *device->hidden));
-
- /* Set the function pointers */
- /* Initialization/Query functions */
- device->VideoInit = BE_VideoInit;
- device->ListModes = BE_ListModes;
- device->SetVideoMode = BE_SetVideoMode;
- device->ToggleFullScreen = BE_ToggleFullScreen;
- device->UpdateMouse = BE_UpdateMouse;
- device->CreateYUVOverlay = BE_CreateYUVOverlay;
- device->SetColors = BE_SetColors;
- device->UpdateRects = NULL;
- device->VideoQuit = BE_VideoQuit;
- /* Hardware acceleration functions */
- device->AllocHWSurface = BE_AllocHWSurface;
- device->CheckHWBlit = NULL;
- device->FillHWRect = NULL;
- device->SetHWColorKey = NULL;
- device->SetHWAlpha = NULL;
- device->LockHWSurface = BE_LockHWSurface;
- device->UnlockHWSurface = BE_UnlockHWSurface;
- device->FlipHWSurface = NULL;
- device->FreeHWSurface = BE_FreeHWSurface;
- /* Gamma support */
-#if SDL_VIDEO_OPENGL
- /* OpenGL support */
- device->GL_LoadLibrary = BE_GL_LoadLibrary;
- device->GL_GetProcAddress = BE_GL_GetProcAddress;
- device->GL_GetAttribute = BE_GL_GetAttribute;
- device->GL_MakeCurrent = BE_GL_MakeCurrent;
- device->GL_SwapBuffers = BE_GL_SwapBuffers;
-#endif
- /* Window manager functions */
- device->SetCaption = BE_SetWMCaption;
- device->SetIcon = NULL;
- device->IconifyWindow = BE_IconifyWindow;
- device->GrabInput = BE_GrabInput;
- device->GetWMInfo = BE_GetWMInfo;
- /* Cursor manager functions */
- device->FreeWMCursor = BE_FreeWMCursor;
- device->CreateWMCursor = BE_CreateWMCursor;
- device->ShowWMCursor = BE_ShowWMCursor;
- device->WarpWMCursor = BE_WarpWMCursor;
- device->MoveWMCursor = NULL;
- device->CheckMouseMode = BE_CheckMouseMode;
- /* Event manager functions */
- device->InitOSKeymap = BE_InitOSKeymap;
- device->PumpEvents = BE_PumpEvents;
-
- device->free = BE_DeleteDevice;
-
- /* Set the driver flags */
- device->handles_any_size = 1;
-
- return device;
-}
-
-VideoBootStrap BWINDOW_bootstrap = {
- "bwindow", "BDirectWindow graphics",
- BE_Available, BE_CreateDevice
-};
-
-static inline int ColorSpaceToBitsPerPixel(uint32 colorspace)
-{
- int bitsperpixel;
-
- bitsperpixel = 0;
- switch (colorspace) {
- case B_CMAP8:
- bitsperpixel = 8;
- break;
- case B_RGB15:
- case B_RGBA15:
- case B_RGB15_BIG:
- case B_RGBA15_BIG:
- bitsperpixel = 15;
- break;
- case B_RGB16:
- case B_RGB16_BIG:
- bitsperpixel = 16;
- break;
- case B_RGB32:
- case B_RGBA32:
- case B_RGB32_BIG:
- case B_RGBA32_BIG:
- bitsperpixel = 32;
- break;
- default:
- break;
- }
- return(bitsperpixel);
-}
-
-/* Function to sort the display_list in bscreen */
-static int CompareModes(const void *A, const void *B)
-{
- const display_mode *a = (display_mode *)A;
- const display_mode *b = (display_mode *)B;
-
- if ( a->space == b->space ) {
- return((b->virtual_width*b->virtual_height)-
- (a->virtual_width*a->virtual_height));
- } else {
- return(ColorSpaceToBitsPerPixel(b->space)-
- ColorSpaceToBitsPerPixel(a->space));
- }
-}
-
-/* Yes, this isn't the fastest it could be, but it works nicely */
-static int BE_AddMode(_THIS, int index, unsigned int w, unsigned int h)
-{
- SDL_Rect *mode;
- int i;
- int next_mode;
-
- /* Check to see if we already have this mode */
- if ( SDL_nummodes[index] > 0 ) {
- for ( i=SDL_nummodes[index]-1; i >= 0; --i ) {
- mode = SDL_modelist[index][i];
- if ( (mode->w == w) && (mode->h == h) ) {
-#ifdef BWINDOW_DEBUG
- fprintf(stderr, "We already have mode %dx%d at %d bytes per pixel\n", w, h, index+1);
-#endif
- return(0);
- }
- }
- }
-
- /* Set up the new video mode rectangle */
- mode = (SDL_Rect *)SDL_malloc(sizeof *mode);
- if ( mode == NULL ) {
- SDL_OutOfMemory();
- return(-1);
- }
- mode->x = 0;
- mode->y = 0;
- mode->w = w;
- mode->h = h;
-#ifdef BWINDOW_DEBUG
- fprintf(stderr, "Adding mode %dx%d at %d bytes per pixel\n", w, h, index+1);
-#endif
-
- /* Allocate the new list of modes, and fill in the new mode */
- next_mode = SDL_nummodes[index];
- SDL_modelist[index] = (SDL_Rect **)
- SDL_realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *));
- if ( SDL_modelist[index] == NULL ) {
- SDL_OutOfMemory();
- SDL_nummodes[index] = 0;
- SDL_free(mode);
- return(-1);
- }
- SDL_modelist[index][next_mode] = mode;
- SDL_modelist[index][next_mode+1] = NULL;
- SDL_nummodes[index]++;
-
- return(0);
-}
-
-int BE_VideoInit(_THIS, SDL_PixelFormat *vformat)
-{
- display_mode *modes;
- uint32 i, nmodes;
- int bpp;
- BRect bounds;
-
- /* Initialize the Be Application for appserver interaction */
- if ( SDL_InitBeApp() < 0 ) {
- return(-1);
- }
-
- /* 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;
-
- /* Determine the screen depth */
- vformat->BitsPerPixel = ColorSpaceToBitsPerPixel(bscreen.ColorSpace());
- if ( vformat->BitsPerPixel == 0 ) {
- SDL_SetError("Unknown BScreen colorspace: 0x%x",
- bscreen.ColorSpace());
- return(-1);
- }
-
- /* 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);
- }
- }
-
- /* Create the window and view */
- bounds.top = 0; bounds.left = 0;
- bounds.right = BEOS_HIDDEN_SIZE;
- bounds.bottom = BEOS_HIDDEN_SIZE;
- SDL_Win = new SDL_BWin(bounds);
-
-#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
-
- /* Create the clear cursor */
- SDL_BlankCursor = BE_CreateWMCursor(_this, blank_cdata, blank_cmask,
- BLANK_CWIDTH, BLANK_CHEIGHT, BLANK_CHOTX, BLANK_CHOTY);
-
- /* Fill in some window manager capabilities */
- _this->info.wm_available = 1;
-
- /* We're done! */
- return(0);
-}
-
-/* We support any dimension at our bit-depth */
-SDL_Rect **BE_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
-{
- SDL_Rect **modes;
-
- modes = ((SDL_Rect **)0);
- if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
- modes = SDL_modelist[((format->BitsPerPixel+7)/8)-1];
- } else {
- if ( format->BitsPerPixel ==
- _this->screen->format->BitsPerPixel ) {
- modes = ((SDL_Rect **)-1);
- }
- }
- return(modes);
-}
-
-/* Various screen update functions available */
-static void BE_NormalUpdate(_THIS, int numrects, SDL_Rect *rects);
-
-
-/* Find the closest display mode for fullscreen */
-static bool BE_FindClosestFSMode(_THIS, int width, int height, int bpp,
- display_mode *mode)
-{
- BScreen bscreen;
- uint32 i, nmodes;
- SDL_Rect **modes;
- display_mode *dmodes;
- display_mode current;
- float current_refresh;
- bscreen.GetMode(&current);
- current_refresh = (1000 * current.timing.pixel_clock) /
- (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 */
- }
-
- width = modes[i]->w;
- height = modes[i]->h;
-
- bscreen.GetModeList(&dmodes, &nmodes);
- for ( i = 0; i < nmodes; ++i ) {
- if ( (bpp == ColorSpaceToBitsPerPixel(dmodes[i].space)) &&
- (width == dmodes[i].virtual_width) &&
- (height == dmodes[i].virtual_height) ) {
- break;
- }
- }
- if ( i != nmodes ) {
- *mode = dmodes[i];
- if ((mode->virtual_width <= current.virtual_width) &&
- (mode->virtual_height <= current.virtual_height)) {
- float new_refresh = (1000 * mode->timing.pixel_clock) /
- (mode->timing.h_total * mode->timing.v_total);
- if (new_refresh < current_refresh) {
- mode->timing.pixel_clock = (uint32)((mode->timing.h_total * mode->timing.v_total)
- * current_refresh / 1000);
- }
- }
- return true;
- } else {
- return false;
- }
-}
-
-static int BE_SetFullScreen(_THIS, SDL_Surface *screen, int fullscreen)
-{
- int was_fullscreen;
- bool needs_unlock;
- 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();
-
- width = screen->w;
- height = screen->h;
-
- /* 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)) {
- 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);
- }
- }
- }
- 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.
- */
- 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();
- }
- }
-
- /* Set the fullscreen flag in the screen surface */
- if ( fullscreen ) {
- screen->flags |= SDL_FULLSCREEN;
- } else {
- screen->flags &= ~SDL_FULLSCREEN;
- }
- return(1);
-}
-
-static int BE_ToggleFullScreen(_THIS, int fullscreen)
-{
- return BE_SetFullScreen(_this, _this->screen, fullscreen);
-}
-
-/* FIXME: check return values and cleanup here */
-SDL_Surface *BE_SetVideoMode(_THIS, SDL_Surface *current,
- int width, int height, int bpp, Uint32 flags)
-{
- BScreen bscreen;
- BBitmap *bbitmap;
- BRect bounds;
- Uint32 gl_flags = 0;
-
- /* Only RGB works on r5 currently */
- gl_flags = BGL_RGB;
- if (_this->gl_config.double_buffer)
- gl_flags |= BGL_DOUBLE;
- else
- gl_flags |= BGL_SINGLE;
- if (_this->gl_config.alpha_size > 0 || bpp == 32)
- gl_flags |= BGL_ALPHA;
- if (_this->gl_config.depth_size > 0)
- gl_flags |= BGL_DEPTH;
- if (_this->gl_config.stencil_size > 0)
- gl_flags |= BGL_STENCIL;
- if (_this->gl_config.accum_red_size > 0
- || _this->gl_config.accum_green_size > 0
- || _this->gl_config.accum_blue_size > 0
- || _this->gl_config.accum_alpha_size > 0)
- gl_flags |= BGL_ACCUM;
-
- /* Create the view for this window, using found flags */
- if ( SDL_Win->CreateView(flags, gl_flags) < 0 ) {
- return(NULL);
- }
-
- current->flags = 0; /* Clear flags */
- current->w = width;
- current->h = height;
- SDL_Win->SetType(B_TITLED_WINDOW);
- if ( flags & SDL_NOFRAME ) {
- current->flags |= SDL_NOFRAME;
- SDL_Win->SetLook(B_NO_BORDER_WINDOW_LOOK);
- } else {
- if ( (flags & SDL_RESIZABLE) && !(flags & SDL_OPENGL) ) {
- current->flags |= SDL_RESIZABLE;
- /* We don't want opaque resizing (TM). :-) */
- SDL_Win->SetFlags(B_OUTLINE_RESIZE);
- } else {
- SDL_Win->SetFlags(B_NOT_RESIZABLE|B_NOT_ZOOMABLE);
- }
- }
-
- if ( flags & SDL_OPENGL ) {
- current->flags |= SDL_OPENGL;
- current->pitch = 0;
- current->pixels = NULL;
- _this->UpdateRects = NULL;
- } else {
- /* Create the BBitmap framebuffer */
- bounds.top = 0; bounds.left = 0;
- bounds.right = width-1;
- bounds.bottom = height-1;
- bbitmap = new BBitmap(bounds, bscreen.ColorSpace());
- if ( ! bbitmap->IsValid() ) {
- SDL_SetError("Couldn't create screen bitmap");
- delete bbitmap;
- return(NULL);
- }
- current->pitch = bbitmap->BytesPerRow();
- current->pixels = (void *)bbitmap->Bits();
- SDL_Win->SetBitmap(bbitmap);
- _this->UpdateRects = BE_NormalUpdate;
- }
-
- /* Set the correct fullscreen mode */
- BE_SetFullScreen(_this, current, flags & SDL_FULLSCREEN ? 1 : 0);
-
- /* We're done */
- return(current);
-}
-
-/* Update the current mouse state and position */
-void BE_UpdateMouse(_THIS)
-{
- BPoint point;
- uint32 buttons;
-
- if ( SDL_Win->Lock() ) {
- /* Get new input state, if still active */
- if ( SDL_Win->IsActive() ) {
- (SDL_Win->View())->GetMouse(&point, &buttons, true);
- } else {
- point.x = -1;
- point.y = -1;
- }
- SDL_Win->Unlock();
-
- if ( (point.x >= 0) && (point.x < SDL_VideoSurface->w) &&
- (point.y >= 0) && (point.y < SDL_VideoSurface->h) ) {
- SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
- SDL_PrivateMouseMotion(0, 0,
- (Sint16)point.x, (Sint16)point.y);
- } else {
- SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
- }
- }
-}
-
-/* We don't actually allow hardware surfaces other than the main one */
-static int BE_AllocHWSurface(_THIS, SDL_Surface *surface)
-{
- return(-1);
-}
-static void BE_FreeHWSurface(_THIS, SDL_Surface *surface)
-{
- return;
-}
-static int BE_LockHWSurface(_THIS, SDL_Surface *surface)
-{
- return(0);
-}
-static void BE_UnlockHWSurface(_THIS, SDL_Surface *surface)
-{
- return;
-}
-
-static void BE_NormalUpdate(_THIS, int numrects, SDL_Rect *rects)
-{
- if ( SDL_Win->BeginDraw() ) {
- int i;
-
- for ( i=0; i<numrects; ++i ) {
- BRect rect;
-
- rect.top = rects[i].y;
- rect.left = rects[i].x;
- rect.bottom = rect.top+rects[i].h-1;
- rect.right = rect.left+rects[i].w-1;
- SDL_Win->DrawAsync(rect);
- }
- SDL_Win->EndDraw();
- }
-}
-
-#if SDL_VIDEO_OPENGL
-/* Passing a NULL path means load pointers from the application */
-int BE_GL_LoadLibrary(_THIS, const char *path)
-{
- 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;
- }
-}
-
-void* BE_GL_GetProcAddress(_THIS, const char *proc)
-{
- 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;
- }
-}
-
-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;
-}
-
-int BE_GL_MakeCurrent(_THIS)
-{
- /* FIXME: should we glview->unlock and then glview->lock()? */
- return 0;
-}
-
-void BE_GL_SwapBuffers(_THIS)
-{
- SDL_Win->SwapBuffers();
-}
-#endif
-
-/* Is the system palette settable? */
-int BE_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
-{
- int i;
- SDL_Palette *palette;
- const color_map *cmap = BScreen().ColorMap();
-
- /* Get the screen colormap */
- palette = _this->screen->format->palette;
- for ( i=0; i<256; ++i ) {
- palette->colors[i].r = cmap->color_list[i].red;
- palette->colors[i].g = cmap->color_list[i].green;
- palette->colors[i].b = cmap->color_list[i].blue;
- }
- return(0);
-}
-
-void BE_VideoQuit(_THIS)
-{
- int i, j;
-
- SDL_Win->Quit();
- SDL_Win = NULL;
-
- if ( SDL_BlankCursor != NULL ) {
- BE_FreeWMCursor(_this, SDL_BlankCursor);
- SDL_BlankCursor = NULL;
- }
- 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;
- }
-
-#if SDL_VIDEO_OPENGL
- if (_this->gl_config.dll_handle != NULL)
- unload_add_on((image_id)_this->gl_config.dll_handle);
-#endif
-
- SDL_QuitBeApp();
-}
-
-}; /* Extern C */
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_syswm.cc b/distrib/sdl-1.2.12/src/video/bwindow/SDL_syswm.cc
deleted file mode 100644
index 1083caf..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_syswm.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#include "SDL_BWin.h"
-
-extern "C" {
-#include "SDL_syswm_c.h"
-#include "SDL_error.h"
-#include "../SDL_cursor_c.h"
-
-void BE_SetWMCaption(_THIS, const char *title, const char *icon)
-{
- SDL_Win->SetTitle(title);
-}
-
-int BE_IconifyWindow(_THIS)
-{
- SDL_Win->Minimize(true);
-}
-
-SDL_GrabMode BE_GrabInput(_THIS, SDL_GrabMode mode)
-{
- if ( mode == SDL_GRAB_OFF ) {
-// be_app->ShowCursor();
- if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) {
- /* BeSman: Jan 2, 2006
- must be leaving relative mode, move mouse from
- center of window to where it belongs ... */
- BPoint pt;
- int x, y;
- SDL_GetMouseState(&x,&y);
- pt.x = x;
- pt.y = y;
- SDL_Win->Lock();
- SDL_Win->ConvertToScreen(&pt);
- SDL_Win->Unlock();
- set_mouse_position((int)pt.x, (int)pt.y);
- }
- } else {
-// be_app->HideCursor();
- if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) {
- /* BeSman: Jan 2, 2006
- must be entering relative mode, get ready by
- moving mouse to center of window ... */
- BPoint pt;
- pt.x = (SDL_VideoSurface->w/2);
- pt.y = (SDL_VideoSurface->h/2);
- SDL_Win->Lock();
- SDL_Win->ConvertToScreen(&pt);
- SDL_Win->Unlock();
- set_mouse_position((int)pt.x, (int)pt.y);
- }
- }
- return(mode);
-}
-
-int BE_GetWMInfo(_THIS, SDL_SysWMinfo *info)
-{
- if (info->version.major <= SDL_MAJOR_VERSION)
- {
- return 1;
- }
- else
- {
- SDL_SetError("Application not compiled with SDL %d.%d\n",
- SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
- return -1;
- }
-}
-
-}; /* Extern C */
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_syswm_c.h b/distrib/sdl-1.2.12/src/video/bwindow/SDL_syswm_c.h
deleted file mode 100644
index 0d33c5e..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_syswm_c.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-#include "SDL_syswm.h"
-#include "SDL_lowvideo.h"
-
-
-/* Functions to be exported */
-extern void BE_SetWMCaption(_THIS, const char *title, const char *icon);
-extern int BE_IconifyWindow(_THIS);
-extern int BE_GetWMInfo(_THIS, SDL_SysWMinfo *info);
-extern SDL_GrabMode BE_GrabInput(_THIS, SDL_GrabMode mode); \ No newline at end of file
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysyuv.cc b/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysyuv.cc
deleted file mode 100644
index 557a120..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysyuv.cc
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-/* This is the BeOS version of SDL YUV video overlays */
-
-#include "SDL_video.h"
-#include "SDL_sysyuv.h"
-#include "../SDL_yuvfuncs.h"
-
-extern "C" {
-
-/* The functions used to manipulate software video overlays */
-static struct private_yuvhwfuncs be_yuvfuncs =
-{
- BE_LockYUVOverlay,
- BE_UnlockYUVOverlay,
- BE_DisplayYUVOverlay,
- BE_FreeYUVOverlay
-};
-
-BBitmap * BE_GetOverlayBitmap(BRect bounds, color_space cs) {
- BBitmap *bbitmap;
- bbitmap = new BBitmap(bounds,B_BITMAP_WILL_OVERLAY,cs);
- if (!bbitmap || bbitmap->InitCheck() != B_OK) {
- delete bbitmap;
- return 0;
- }
- overlay_restrictions r;
- bbitmap->GetOverlayRestrictions(&r);
- uint32 width = bounds.IntegerWidth() + 1;
- uint32 height = bounds.IntegerHeight() + 1;
- uint32 width_padding = 0;
- uint32 height_padding = 0;
- if ((r.source.horizontal_alignment != 0) ||
- (r.source.vertical_alignment != 0)) {
- delete bbitmap;
- return 0;
- }
- if (r.source.width_alignment != 0) {
- uint32 aligned_width = r.source.width_alignment + 1;
- if (width % aligned_width > 0) {
- width_padding = aligned_width - width % aligned_width;
- }
- }
- if (r.source.height_alignment != 0) {
- uint32 aligned_height = r.source.height_alignment + 1;
- if (height % aligned_height > 0) {
- fprintf(stderr,"GetOverlayBitmap failed height alignment\n");
- fprintf(stderr,"- height = %lu, aligned_height = %lu\n",height,aligned_height);
- delete bbitmap;
- return 0;
- }
- }
- if ((r.source.min_width > width) ||
- (r.source.min_height > height) ||
- (r.source.max_width < width) ||
- (r.source.max_height < height)) {
- fprintf(stderr,"GetOverlayBitmap failed bounds tests\n");
- delete bbitmap;
- return 0;
- }
- if ((width_padding != 0) || (height_padding != 0)) {
- delete bbitmap;
- bounds.Set(bounds.left,bounds.top,bounds.right+width_padding,bounds.bottom+height_padding);
- bbitmap = new BBitmap(bounds,B_BITMAP_WILL_OVERLAY,cs);
- if (!bbitmap || bbitmap->InitCheck() != B_OK) {
- fprintf(stderr,"GetOverlayBitmap failed late\n");
- delete bbitmap;
- return 0;
- }
- }
- return bbitmap;
-}
-
-// See <GraphicsDefs.h> [btw: Cb=U, Cr=V]
-// See also http://www.fourcc.org/indexyuv.htm
-enum color_space convert_color_space(Uint32 format) {
- switch (format) {
- case SDL_YV12_OVERLAY:
- return B_YUV9;
- case SDL_IYUV_OVERLAY:
- return B_YUV12;
- case SDL_YUY2_OVERLAY:
- return B_YCbCr422;
- case SDL_UYVY_OVERLAY:
- return B_YUV422;
- case SDL_YVYU_OVERLAY: // not supported on beos?
- return B_NO_COLOR_SPACE;
- default:
- return B_NO_COLOR_SPACE;
- }
-}
-
-// See SDL_video.h
-int count_planes(Uint32 format) {
- switch (format) {
- case SDL_YV12_OVERLAY:
- case SDL_IYUV_OVERLAY:
- return 3;
- case SDL_YUY2_OVERLAY:
- case SDL_UYVY_OVERLAY:
- case SDL_YVYU_OVERLAY:
- return 1;
- default:
- return 0;
- }
-}
-
-SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display) {
- SDL_Overlay* overlay;
- struct private_yuvhwdata* hwdata;
- BBitmap *bbitmap;
- int planes;
- BRect bounds;
- color_space cs;
-
- /* find the appropriate BeOS colorspace descriptor */
- cs = convert_color_space(format);
- if (cs == B_NO_COLOR_SPACE)
- {
- return NULL;
- }
-
- /* count planes */
- planes = count_planes(format);
- if (planes == 0)
- {
- return NULL;
- }
- /* TODO: figure out planar modes, if anyone cares */
- if (planes == 3)
- {
- return NULL;
- }
-
- /* Create the overlay structure */
- overlay = (SDL_Overlay*)SDL_calloc(1, sizeof(SDL_Overlay));
-
- if (overlay == NULL)
- {
- SDL_OutOfMemory();
- return NULL;
- }
-
- /* Fill in the basic members */
- overlay->format = format;
- overlay->w = width;
- overlay->h = height;
- overlay->hwdata = NULL;
-
- /* Set up the YUV surface function structure */
- overlay->hwfuncs = &be_yuvfuncs;
-
- /* Create the pixel data and lookup tables */
- hwdata = (struct private_yuvhwdata*)SDL_calloc(1, sizeof(struct private_yuvhwdata));
-
- if (hwdata == NULL)
- {
- SDL_OutOfMemory();
- SDL_FreeYUVOverlay(overlay);
- return NULL;
- }
-
- overlay->hwdata = hwdata;
- overlay->hwdata->display = display;
- overlay->hwdata->bview = NULL;
- overlay->hwdata->bbitmap = NULL;
- overlay->hwdata->locked = 0;
-
- /* Create the BBitmap framebuffer */
- bounds.top = 0; bounds.left = 0;
- bounds.right = width-1;
- bounds.bottom = height-1;
-
- BView * bview = new BView(bounds,"overlay",B_FOLLOW_NONE,B_WILL_DRAW);
- if (!bview) {
- SDL_OutOfMemory();
- SDL_FreeYUVOverlay(overlay);
- return NULL;
- }
- overlay->hwdata->bview = bview;
- overlay->hwdata->first_display = true;
- bview->Hide();
-
- bbitmap = BE_GetOverlayBitmap(bounds,cs);
- if (!bbitmap) {
- overlay->hwdata->bbitmap = NULL;
- SDL_FreeYUVOverlay(overlay);
- return NULL;
- }
- overlay->hwdata->bbitmap = bbitmap;
-
- overlay->planes = planes;
- overlay->pitches = (Uint16*)SDL_calloc(overlay->planes, sizeof(Uint16));
- overlay->pixels = (Uint8**)SDL_calloc(overlay->planes, sizeof(Uint8*));
- if (!overlay->pitches || !overlay->pixels)
- {
- SDL_OutOfMemory();
- SDL_FreeYUVOverlay(overlay);
- return(NULL);
- }
-
- overlay->pitches[0] = bbitmap->BytesPerRow();
- overlay->pixels[0] = (Uint8 *)bbitmap->Bits();
- overlay->hw_overlay = 1;
-
- if (SDL_Win->LockWithTimeout(1000000) != B_OK) {
- SDL_FreeYUVOverlay(overlay);
- return(NULL);
- }
- BView * view = SDL_Win->View();
- view->AddChild(bview);
- rgb_color key;
- bview->SetViewOverlay(bbitmap,bounds,bview->Bounds(),&key,B_FOLLOW_ALL,
- B_OVERLAY_FILTER_HORIZONTAL|B_OVERLAY_FILTER_VERTICAL);
- bview->SetViewColor(key);
- bview->Flush();
- SDL_Win->Unlock();
-
- current_overlay=overlay;
-
- return overlay;
-}
-
-int BE_LockYUVOverlay(_THIS, SDL_Overlay* overlay)
-{
- if (overlay == NULL)
- {
- return 0;
- }
-
- overlay->hwdata->locked = 1;
- return 0;
-}
-
-void BE_UnlockYUVOverlay(_THIS, SDL_Overlay* overlay)
-{
- if (overlay == NULL)
- {
- return;
- }
-
- overlay->hwdata->locked = 0;
-}
-
-int BE_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* src, SDL_Rect *dst)
-{
- if ((overlay == NULL) || (overlay->hwdata==NULL)
- || (overlay->hwdata->bview==NULL) || (SDL_Win->View() == NULL))
- {
- return -1;
- }
- if (SDL_Win->LockWithTimeout(50000) != B_OK) {
- return 0;
- }
- BView * bview = overlay->hwdata->bview;
- if (SDL_Win->IsFullScreen()) {
- int left,top;
- SDL_Win->GetXYOffset(left,top);
- bview->MoveTo(left+dst->x,top+dst->y);
- } else {
- bview->MoveTo(dst->x,dst->y);
- }
- bview->ResizeTo(dst->w,dst->h);
- bview->Flush();
- if (overlay->hwdata->first_display) {
- bview->Show();
- overlay->hwdata->first_display = false;
- }
- SDL_Win->Unlock();
-
- return 0;
-}
-
-void BE_FreeYUVOverlay(_THIS, SDL_Overlay *overlay)
-{
- if (overlay == NULL)
- {
- return;
- }
-
- if (overlay->hwdata == NULL)
- {
- return;
- }
-
- current_overlay=NULL;
-
- delete overlay->hwdata->bbitmap;
-
- SDL_free(overlay->hwdata);
-}
-
-}; // extern "C"
diff --git a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysyuv.h b/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysyuv.h
deleted file mode 100644
index 64859f2..0000000
--- a/distrib/sdl-1.2.12/src/video/bwindow/SDL_sysyuv.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-#include "SDL_config.h"
-
-
-#ifndef __SDL_SYS_YUV_H__
-#define __SDL_SYS_YUV_H__
-
-/* This is the BeOS implementation of YUV video overlays */
-
-#include "SDL_video.h"
-#include "SDL_lowvideo.h"
-
-extern "C" {
-
-struct private_yuvhwdata
-{
-/* FRAMEDATA* CurrentFrameData;
- FRAMEDATA* FrameData0;
- FRAMEDATA* FrameData1;
- PgScalerProps_t props;
- PgScalerCaps_t caps;
- PgVideoChannel_t* channel;
- PhArea_t CurrentViewPort;
- PhPoint_t CurrentWindowPos;
- long format;
- int scaler_on;
- int current;
- long YStride;
- long VStride;
- long UStride;
- int ischromakey;
- long chromakey;
- int forcedredraw;
- unsigned long State;
- long flags;
-*/
- SDL_Surface *display;
- BView *bview;
- bool first_display;
- BBitmap *bbitmap;
- int locked;
-};
-
-extern BBitmap * BE_GetOverlayBitmap(BRect bounds, color_space cs);
-extern 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);
-extern void BE_FreeYUVOverlay(_THIS, SDL_Overlay* overlay);
-
-};
-
-#endif /* __SDL_PH_YUV_H__ */