[Commits] SDL: Partially cleaned out code
libsdl.org revision control
commits-owner at libsdl.org
Thu Sep 15 20:57:24 PDT 2011
details: http://hg.libsdl.org/SDL/rev/d9e9c343d264
changeset: 5939:d9e9c343d264
user: Nathan Heisey <nathanheisey at gmail.com>
date: Mon Aug 22 11:02:05 2011 +0000
description:
Partially cleaned out code
diffstat:
src/main/beos/SDL_BApp.h | 15 +-
src/video/bwindow/SDL_BWin.h | 47 ++---
src/video/bwindow/SDL_bclipboard.cc | 18 +-
src/video/bwindow/SDL_bevents.cc | 1 +
src/video/bwindow/SDL_bframebuffer.cc | 8 +-
src/video/bwindow/SDL_bmodes.cc | 289 +++++++++++----------------------
src/video/bwindow/SDL_bopengl.cc | 70 +-------
src/video/bwindow/SDL_bvideo.cc | 45 +----
src/video/bwindow/SDL_bwindow.cc | 7 +
9 files changed, 148 insertions(+), 352 deletions(-)
diffs (918 lines):
diff -r b85b6326c498 -r d9e9c343d264 src/main/beos/SDL_BApp.h
--- a/src/main/beos/SDL_BApp.h Sat Aug 20 15:16:13 2011 +0000
+++ b/src/main/beos/SDL_BApp.h Mon Aug 22 11:02:05 2011 +0000
@@ -177,11 +177,6 @@
}
}
- /* Modes methods */
- void SetPrevMode(display_mode *prevMode) { _saved_mode = prevMode; }
-
- display_mode* GetPrevMode() { return _saved_mode; }
-
/* FIXME: Bad coding practice, but I can't include SDL_BWin.h here. Is
there another way to do this? */
void ClearID(SDL_BWin *bwin); /* Defined in SDL_BeApp.cc */
@@ -225,7 +220,7 @@
win = GetSDLWindow(winID);
SDL_SendMouseMotion(win, 0, x, y);
- /* FIXME: Attempt at fixing rendering problems */
+ /* Tell the application that the mouse passed over, redraw needed */
BE_UpdateWindowFramebuffer(NULL,win,NULL,-1);
}
@@ -328,9 +323,6 @@
}
win = GetSDLWindow(winID);
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_MOVED, xPos, yPos);
-
- /* FIXME: Attempt at fixing rendering problems */
-// BE_UpdateWindowFramebuffer(NULL,win,NULL,-1); Handled by DirectConnected
}
void _HandleWindowResized(BMessage *msg) {
@@ -347,9 +339,6 @@
}
win = GetSDLWindow(winID);
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_RESIZED, w, h);
-
- /* FIXME: Attempt at fixing rendering problems */
-// BE_UpdateWindowFramebuffer(NULL,win,NULL,-1); Handled by DirectConnected
}
bool _GetWinID(BMessage *msg, int32 *winID) {
@@ -379,7 +368,7 @@
/* Members */
- vector<SDL_Window*> _window_map; /* Keeps track of SDL_Windows by index-id */
+ vector<SDL_Window*> _window_map; /* Keeps track of SDL_Windows by index-id*/
display_mode *_saved_mode;
BGLView *_current_context;
diff -r b85b6326c498 -r d9e9c343d264 src/video/bwindow/SDL_BWin.h
--- a/src/video/bwindow/SDL_BWin.h Sat Aug 20 15:16:13 2011 +0000
+++ b/src/video/bwindow/SDL_BWin.h Mon Aug 22 11:02:05 2011 +0000
@@ -53,7 +53,7 @@
BWIN_HIDE_WINDOW,
BWIN_MAXIMIZE_WINDOW,
BWIN_MINIMIZE_WINDOW,
- BWIN_RESTORE_WINDOW, /* TODO: IMPLEMENT THIS! */
+ BWIN_RESTORE_WINDOW,
BWIN_SET_TITLE,
BWIN_FULLSCREEN
};
@@ -185,9 +185,6 @@
_bits = (uint8*) info->bits;
_row_bytes = info->bytes_per_row;
_bounds = info->window_bounds;
-printf("Bounds = (%i,%i,%i,%i), Frame = (%0.f,%0.f,%0.f,%0.f)\n", _bounds.left,
- _bounds.top, _bounds.right, _bounds.bottom, Frame().left, Frame().top,
- Frame().right, Frame().bottom);
_bytes_per_px = info->bits_per_pixel / 8;
_buffer_dirty = true;
}
@@ -230,7 +227,8 @@
virtual void FrameResized(float width, float height) {
/* Post a message to the BApp so that it can handle the window event */
BMessage msg(BAPP_WINDOW_RESIZED);
- msg.AddInt32("window-w", (int)width + 1); /* TODO: Check that +1 is needed */
+
+ msg.AddInt32("window-w", (int)width + 1);
msg.AddInt32("window-h", (int)height + 1);
_PostWindowEvent(msg);
@@ -409,15 +407,12 @@
uint32 GetRowBytes() { return _row_bytes; }
int32 GetFbX() { return _bounds.left; }
int32 GetFbY() { return _bounds.top; }
-// int32 GetFbHeight() { return _bounds.bottom - _bounds.top + 1; }
-// int32 GetFbWidth() { return _bounds.right - _bounds.left + 1; }
bool ConnectionEnabled() { return !_connection_disabled; }
bool Connected() { return _connected; }
clipping_rect *GetClips() { return _clips; }
int32 GetNumClips() { return _num_clips; }
uint8* GetBufferPx() { return _bits; }
int32 GetBytesPerPx() { return _bytes_per_px; }
-// uint8* GetWindowFramebuffer() { return _window_buffer; }
bool CanTrashWindowBuffer() { return _trash_window_buffer; }
bool BufferExists() { return _buffer_created; }
bool BufferIsDirty() { return _buffer_dirty; }
@@ -429,7 +424,6 @@
/* Setter methods */
void SetID(int32 id) { _id = id; }
void SetBufferExists(bool bufferExists) { _buffer_created = bufferExists; }
-// void SetWindowFramebuffer(uint8* fb) { _window_buffer = fb; }
void LockBuffer() { _buffer_locker->Lock(); }
void UnlockBuffer() { _buffer_locker->Unlock(); }
void SetBufferDirty(bool bufferDirty) { _buffer_dirty = bufferDirty; }
@@ -575,27 +569,12 @@
void _SetFullScreen(BMessage *msg) {
bool fullscreen;
-
- BRect rc1 = Bounds(),
- rc2 = Frame();
-printf(__FILE__": %d - bounds = (%.0f,%.0f,%.0f,%.0f), frame = (%.0f,%.0f,%.0f,%.0f\n", __LINE__, rc1.left, rc1.top, rc1.right, rc1.bottom,
-rc2.left, rc2.top, rc2.right, rc2.bottom);
if(
msg->FindBool("fullscreen", &fullscreen) != B_OK
) {
return;
}
-
-if(fullscreen) {
- printf("Setting fullscreen...\n");
-} else {
- printf("Unsetting fullscreen...\n");
-}
-#if 1
SetFullScreen(fullscreen);
-#endif
-printf(__FILE__": %d - bounds = (%.0f,%.0f,%.0f,%.0f), frame = (%.0f,%.0f,%.0f,%.0f\n", __LINE__, rc1.left, rc1.top, rc1.right, rc1.bottom,
-rc2.left, rc2.top, rc2.right, rc2.bottom);
}
/* Members */
@@ -615,7 +594,8 @@
bool _connected,
_connection_disabled,
_buffer_created,
- _buffer_dirty;
+ _buffer_dirty,
+ _trash_window_buffer;
uint8 *_bits;
uint32 _row_bytes;
clipping_rect _bounds;
@@ -623,11 +603,24 @@
clipping_rect *_clips;
int32 _num_clips;
int32 _bytes_per_px;
-// uint8 *_window_buffer; /* A copy of the window buffer */
- bool _trash_window_buffer;
thread_id _draw_thread_id;
BBitmap *_bitmap;
};
+
+/* FIXME:
+ * An explanation of framebuffer flags.
+ *
+ * _connected - Original variable used to let the drawing thread know
+ * when changes are being made to the other framebuffer
+ * members.
+ * _connection_disabled - Used to signal to the drawing thread that the window
+ * is closing, and the thread should exit.
+ * _buffer_created - True if the current buffer is valid
+ * _buffer_dirty - True if the window should be redrawn.
+ * _trash_window_buffer - True if the window buffer needs to be trashed partway
+ * through a draw cycle. Occurs when the previous
+ * buffer provided by DirectConnected() is invalidated.
+ */
#endif
diff -r b85b6326c498 -r d9e9c343d264 src/video/bwindow/SDL_bclipboard.cc
--- a/src/video/bwindow/SDL_bclipboard.cc Sat Aug 20 15:16:13 2011 +0000
+++ b/src/video/bwindow/SDL_bclipboard.cc Mon Aug 22 11:02:05 2011 +0000
@@ -35,7 +35,6 @@
#endif
int BE_SetClipboardText(_THIS, const char *text) {
-#if 0
BMessage *clip = NULL;
if(be_clipboard->Lock()) {
be_clipboard->Clear();
@@ -48,20 +47,17 @@
}
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);
+ clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
+ &length);
} else {
be_clipboard->Unlock();
return NULL;
@@ -76,13 +72,9 @@
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;
@@ -91,15 +83,13 @@
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);
+ clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
+ &length);
if( text ) retval = SDL_TRUE;
}
be_clipboard->Unlock();
}
return retval;
-#else
-return SDL_FALSE;
-#endif
}
diff -r b85b6326c498 -r d9e9c343d264 src/video/bwindow/SDL_bevents.cc
--- a/src/video/bwindow/SDL_bevents.cc Sat Aug 20 15:16:13 2011 +0000
+++ b/src/video/bwindow/SDL_bevents.cc Mon Aug 22 11:02:05 2011 +0000
@@ -26,6 +26,7 @@
#endif
void BE_PumpEvents(_THIS) {
+ /* Since the event thread is its own thread, this isn't really necessary */
}
#ifdef __cplusplus
diff -r b85b6326c498 -r d9e9c343d264 src/video/bwindow/SDL_bframebuffer.cc
--- a/src/video/bwindow/SDL_bframebuffer.cc Sat Aug 20 15:16:13 2011 +0000
+++ b/src/video/bwindow/SDL_bframebuffer.cc Mon Aug 22 11:02:05 2011 +0000
@@ -126,9 +126,7 @@
if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) {
bwin->LockBuffer();
BBitmap *bitmap = NULL;
-// while(!bitmap) {
- bitmap = bwin->GetBitmap();
-// }
+ bitmap = bwin->GetBitmap();
int32 windowPitch = bitmap->BytesPerRow();
int32 bufferPitch = bwin->GetRowBytes();
uint8 *windowpx;
@@ -163,14 +161,12 @@
goto escape; /* Break out before the buffer is killed */
}
-// printf("memcpy(0x%x, 0x%x, %i) ", bufferpx, windowpx, width * BPP);
memcpy(bufferpx, windowpx, width * BPP);
bufferpx += bufferPitch;
windowpx += windowPitch;
}
-// printf("\t-\t");
}
-// printf("\n");
+
bwin->SetBufferDirty(false);
escape:
bwin->UnlockBuffer();
diff -r b85b6326c498 -r d9e9c343d264 src/video/bwindow/SDL_bmodes.cc
--- a/src/video/bwindow/SDL_bmodes.cc Sat Aug 20 15:16:13 2011 +0000
+++ b/src/video/bwindow/SDL_bmodes.cc Mon Aug 22 11:02:05 2011 +0000
@@ -37,10 +37,11 @@
#endif
-#define WRAP_BMODE 1
+#define WRAP_BMODE 1 /* FIXME: Some debate as to whether this is necessary */
#if WRAP_BMODE
-/* This wrapper is here so that the driverdata can be freed */
+/* This wrapper is here so that the driverdata can be freed without freeing
+ the display_mode structure */
typedef struct SDL_DisplayModeData {
display_mode *bmode;
};
@@ -55,10 +56,10 @@
}
static inline display_mode * _ExtractBMode(SDL_DisplayMode *mode) {
-#if 0
+#if WRAP_BMODE
+ return ((SDL_DisplayModeData*)mode->driverdata)->bmode;
+#else
return (display_mode*)(mode->driverdata);
-#else
- return ((SDL_DisplayModeData*)mode->driverdata)->bmode;
#endif
}
@@ -68,6 +69,68 @@
/ float(mode.timing.h_total * mode.timing.v_total);
}
+
+#if 0
+/* TODO:
+ * This is a useful debugging tool. Uncomment and insert into code as needed.
+ */
+void _SpoutModeData(display_mode *bmode) {
+ printf("BMode:\n");
+ printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
+ printf("\th,v = (%i,%i)\n", bmode->h_display_start,
+ bmode->v_display_start);
+ if(bmode->flags) {
+ printf("\tFlags:\n");
+ if(bmode->flags & B_SCROLL) {
+ printf("\t\tB_SCROLL\n");
+ }
+ if(bmode->flags & B_8_BIT_DAC) {
+ printf("\t\tB_8_BIT_DAC\n");
+ }
+ if(bmode->flags & B_HARDWARE_CURSOR) {
+ printf("\t\tB_HARDWARE_CURSOR\n");
+ }
+ if(bmode->flags & B_PARALLEL_ACCESS) {
+ printf("\t\tB_PARALLEL_ACCESS\n");
+ }
+ if(bmode->flags & B_DPMS) {
+ printf("\t\tB_DPMS\n");
+ }
+ if(bmode->flags & B_IO_FB_NA) {
+ printf("\t\tB_IO_FB_NA\n");
+ }
+ }
+ printf("\tTiming:\n");
+ printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock);
+ printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n",
+ bmode->timing.h_display, bmode->timing.h_sync_start,
+ bmode->timing.h_sync_end, bmode->timing.h_total);
+ printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n",
+ bmode->timing.v_display, bmode->timing.v_sync_start,
+ bmode->timing.v_sync_end, bmode->timing.v_total);
+ if(bmode->timing.flags) {
+ printf("\t\tFlags:\n");
+ if(bmode->timing.flags & B_BLANK_PEDESTAL) {
+ printf("\t\t\tB_BLANK_PEDESTAL\n");
+ }
+ if(bmode->timing.flags & B_TIMING_INTERLACED) {
+ printf("\t\t\tB_TIMING_INTERLACED\n");
+ }
+ if(bmode->timing.flags & B_POSITIVE_HSYNC) {
+ printf("\t\t\tB_POSITIVE_HSYNC\n");
+ }
+ if(bmode->timing.flags & B_POSITIVE_VSYNC) {
+ printf("\t\t\tB_POSITIVE_VSYNC\n");
+ }
+ if(bmode->timing.flags & B_SYNC_ON_GREEN) {
+ printf("\t\t\tB_SYNC_ON_GREEN\n");
+ }
+ }
+}
+#endif
+
+
+
static inline int32 ColorSpaceToBitsPerPixel(uint32 colorspace)
{
int bitsperpixel;
@@ -123,17 +186,21 @@
}
}
-static inline void BE_BDisplayModeToSdlDisplayMode(display_mode *bmode,
+static inline void _BDisplayModeToSdlDisplayMode(display_mode *bmode,
SDL_DisplayMode *mode) {
mode->w = bmode->virtual_width;
mode->h = bmode->virtual_height;
mode->refresh_rate = (int)get_refresh_rate(*bmode);
+
#if WRAP_BMODE
- SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1, sizeof(SDL_DisplayModeData));
+ SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1,
+ sizeof(SDL_DisplayModeData));
data->bmode = bmode;
mode->driverdata = data;
+
#else
+
mode->driverdata = bmode;
#endif
@@ -143,13 +210,14 @@
}
/* Later, there may be more than one monitor available */
-void BE_AddDisplay(BScreen *screen) {
+void _AddDisplay(BScreen *screen) {
SDL_VideoDisplay display;
- SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1, sizeof(SDL_DisplayMode));
+ SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1,
+ sizeof(SDL_DisplayMode));
display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode));
screen->GetMode(bmode);
- BE_BDisplayModeToSdlDisplayMode(bmode, mode);
+ _BDisplayModeToSdlDisplayMode(bmode, mode);
SDL_zero(display);
display.desktop_mode = *mode;
@@ -158,23 +226,20 @@
SDL_AddVideoDisplay(&display);
}
+/*
+ * Functions called by SDL
+ */
+
int BE_InitModes(_THIS) {
BScreen screen;
-
- /* Save the current display mode */
-// display_mode *prevMode;
-// screen.GetMode(prevMode);
-// _GetBeApp()->SetPrevMode(prevMode);
- /* Only one possible video display right now */
- BE_AddDisplay(&screen);
+ /* TODO: When Haiku supports multiple display screens, call
+ _AddDisplayScreen() for each of them. */
+ _AddDisplay(&screen);
}
int BE_QuitModes(_THIS) {
- /* Restore the previous video mode */
- BScreen screen;
-// display_mode *savedMode = _GetBeApp()->GetPrevMode();
-// screen.SetMode(savedMode);
+ /* FIXME: Nothing really needs to be done here at the moment? */
return 0;
}
@@ -206,7 +271,7 @@
for(i = 0; i < count; ++i) {
//FIXME: Apparently there are errors with colorspace changes
if (bmodes[i].space == this_bmode.space) {
- BE_BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
+ _BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
SDL_AddDisplayMode(display, &mode);
}
}
@@ -214,158 +279,8 @@
}
-
-
-
-
-
-
-
-
-
-
-
-
-static int get_combine_mode(display_mode &mode) {
- if ((mode.flags & B_SCROLL) == 0)
- return 0;
-
- if (mode.virtual_width == mode.timing.h_display * 2)
- return 1;
-
- if (mode.virtual_height == mode.timing.v_display * 2)
- return 2;
-
- return 0;
-}
-#if 0
-bool _GetDisplayMode(const screen_mode& mode, display_mode& displayMode)
-{
- uint16 virtualWidth, virtualHeight;
- int32 bestIndex = -1;
- float bestDiff = 999;
-
- virtualWidth = mode.combine == kCombineHorizontally
- ? mode.width * 2 : mode.width;
- virtualHeight = mode.combine == kCombineVertically
- ? mode.height * 2 : mode.height;
-
- // try to find mode in list provided by driver
- for (uint32 i = 0; i < fModeCount; i++) {
- if (fModeList[i].virtual_width != virtualWidth
- || fModeList[i].virtual_height != virtualHeight
- || (color_space)fModeList[i].space != mode.space)
- continue;
-
- // Accept the mode if the computed refresh rate of the mode is within
- // 0.6 percent of the refresh rate specified by the caller. Note that
- // refresh rates computed from mode parameters is not exact; especially
- // some of the older modes such as 640x480, 800x600, and 1024x768.
- // The tolerance of 0.6% was obtained by examining the various possible
- // modes.
-
- float refreshDiff = fabs(get_refresh_rate(fModeList[i]) - mode.refresh);
- if (refreshDiff < 0.006 * mode.refresh) {
- // Accept this mode.
- displayMode = fModeList[i];
- displayMode.h_display_start = 0;
- displayMode.v_display_start = 0;
-
- // Since the computed refresh rate of the selected mode might differ
- // from selected refresh rate by a few tenths (e.g. 60.2 instead of
- // 60.0), tweak the pixel clock so the the refresh rate of the mode
- // matches the selected refresh rate.
-
- displayMode.timing.pixel_clock = uint32(((displayMode.timing.h_total
- * displayMode.timing.v_total * mode.refresh) / 1000.0) + 0.5);
- return true;
- }
-
- // Mode not acceptable.
-
- if (refreshDiff < bestDiff) {
- bestDiff = refreshDiff;
- bestIndex = i;
- }
- }
-
- // we didn't find the exact mode, but something very similar?
- if (bestIndex == -1)
- return false;
-
- displayMode = fModeList[bestIndex];
- displayMode.h_display_start = 0;
- displayMode.v_display_start = 0;
-
- // For the mode selected by the width, height, and refresh rate, compute
- // the video timing parameters for the mode by using the VESA Generalized
- // Timing Formula (GTF).
-
- ComputeGTFVideoTiming(displayMode.timing.h_display,
- displayMode.timing.v_display, mode.refresh, displayMode.timing);
-
- return true;
-}
-#endif
-
-void _SpoutModeData(display_mode *bmode) {
- printf("BMode:\n");
- printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
- printf("\th,v = (%i,%i)\n", bmode->h_display_start,
- bmode->v_display_start);
- printf("\tcombine mode = %i\n", get_combine_mode(*bmode));
- if(bmode->flags) {
- printf("\tFlags:\n");
- if(bmode->flags & B_SCROLL) {
- printf("\t\tB_SCROLL\n");
- }
- if(bmode->flags & B_8_BIT_DAC) {
- printf("\t\tB_8_BIT_DAC\n");
- }
- if(bmode->flags & B_HARDWARE_CURSOR) {
- printf("\t\tB_HARDWARE_CURSOR\n");
- }
- if(bmode->flags & B_PARALLEL_ACCESS) {
- printf("\t\tB_PARALLEL_ACCESS\n");
- }
- if(bmode->flags & B_DPMS) {
- printf("\t\tB_DPMS\n");
- }
- if(bmode->flags & B_IO_FB_NA) {
- printf("\t\tB_IO_FB_NA\n");
- }
- }
- printf("\tTiming:\n");
- printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock);
- printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n",
- bmode->timing.h_display, bmode->timing.h_sync_start,
- bmode->timing.h_sync_end, bmode->timing.h_total);
- printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n",
- bmode->timing.v_display, bmode->timing.v_sync_start,
- bmode->timing.v_sync_end, bmode->timing.v_total);
- if(bmode->timing.flags) {
- printf("\t\tFlags:\n");
- if(bmode->timing.flags & B_BLANK_PEDESTAL) {
- printf("\t\t\tB_BLANK_PEDESTAL\n");
- }
- if(bmode->timing.flags & B_TIMING_INTERLACED) {
- printf("\t\t\tB_TIMING_INTERLACED\n");
- }
- if(bmode->timing.flags & B_POSITIVE_HSYNC) {
- printf("\t\t\tB_POSITIVE_HSYNC\n");
- }
- if(bmode->timing.flags & B_POSITIVE_VSYNC) {
- printf("\t\t\tB_POSITIVE_VSYNC\n");
- }
- if(bmode->timing.flags & B_SYNC_ON_GREEN) {
- printf("\t\t\tB_SYNC_ON_GREEN\n");
- }
- }
-}
-
int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
/* Get the current screen */
-printf(__FILE__": %d\n", __LINE__);
BScreen bscreen;
if(!bscreen.IsValid()) {
printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__);
@@ -375,24 +290,18 @@
display_mode *bmode = _ExtractBMode(mode);
-_SpoutModeData(bmode);
-printf("\n");
-uint32 c = 0, i, x = 0;
-#define RES 0
-display_mode *bmode_list;
-bscreen.GetModeList(&bmode_list, &c);
-for(i = 0; i < c; ++i) {
- if( bmode_list[i].space == bmode->space &&
- bmode_list[i].virtual_width == bmode->virtual_width &&
- bmode_list[i].virtual_height == bmode->virtual_height ) {
- if(x == RES)
+ /* FIXME: Is the first option always going to be the right one? */
+ uint32 c = 0, i;
+ display_mode *bmode_list;
+ bscreen.GetModeList(&bmode_list, &c);
+ for(i = 0; i < c; ++i) {
+ if( bmode_list[i].space == bmode->space &&
+ bmode_list[i].virtual_width == bmode->virtual_width &&
+ bmode_list[i].virtual_height == bmode->virtual_height ) {
bmode = &bmode_list[i];
-
- ++x;
- _SpoutModeData(&bmode_list[i]);
-// break;
+ break;
+ }
}
-}
if(bscreen.SetMode(bmode) != B_OK) {
SDL_SetError("Bad video mode\n");
@@ -401,11 +310,11 @@
free(bmode_list);
#if SDL_VIDEO_OPENGL
- /* The OpenGL context may need to be rebooted */
+ /* FIXME: Is there some way to reboot the OpenGL context? This doesn't
+ help */
// BE_GL_RebootContexts(_this);
#endif
-printf(__FILE__": %d\n", __LINE__);
return 0;
}
diff -r b85b6326c498 -r d9e9c343d264 src/video/bwindow/SDL_bopengl.cc
--- a/src/video/bwindow/SDL_bopengl.cc Sat Aug 20 15:16:13 2011 +0000
+++ b/src/video/bwindow/SDL_bopengl.cc Mon Aug 22 11:02:05 2011 +0000
@@ -45,6 +45,7 @@
/* Passing a NULL path means load pointers from the application */
int BE_GL_LoadLibrary(_THIS, const char *path)
{
+/* FIXME: Is this working correctly? */
image_info info;
int32 cookie = 0;
while (get_next_image_info(0, &cookie, &info) == B_OK) {
@@ -58,64 +59,6 @@
SDL_arraysize(_this->gl_config.driver_path));
}
}
-#if 0
-printf("\n\nLibrary loading: %s\n\n", 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) {
- printf(__FILE__": %d - Inside while\n",__LINE__);
- 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 {
-printf(__FILE__": %d- gl_config.driver_loaded = 0\n", __LINE__);
- _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)
@@ -161,28 +104,29 @@
void BE_GL_DeleteContext(_THIS, SDL_GLContext context) {
/* Currently, automatically unlocks the view */
-printf(__FILE__": %d\n", __LINE__);
((SDL_BWin*)context)->RemoveGLView();
}
int BE_GL_SetSwapInterval(_THIS, int interval) {
- printf(__FILE__": %d- swap interval set\n", __LINE__);
+ /* TODO: Implement this, if necessary? */
return 0;
}
int BE_GL_GetSwapInterval(_THIS) {
- printf(__FILE__": %d- swap interval requested\n", __LINE__);
+ /* TODO: Implement this, if necessary? */
return 0;
}
void BE_GL_UnloadLibrary(_THIS) {
- printf(__FILE__": %d- Library unloaded\n", __LINE__);
+ /* TODO: Implement this, if necessary? */
}
-
+/* FIXME: This function is meant to clear the OpenGL context when the video
+ mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not
+ currently in use. */
void BE_GL_RebootContexts(_THIS) {
SDL_Window *window = _this->windows;
while(window) {
diff -r b85b6326c498 -r d9e9c343d264 src/video/bwindow/SDL_bvideo.cc
--- a/src/video/bwindow/SDL_bvideo.cc Sat Aug 20 15:16:13 2011 +0000
+++ b/src/video/bwindow/SDL_bvideo.cc Mon Aug 22 11:02:05 2011 +0000
@@ -53,23 +53,11 @@
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
-#if 0
- 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;
- }
-#endif
- device->driverdata = NULL; /*data;*/
-/* TODO: Figure out what sort of initialization needs to go here */
+ device->driverdata = NULL; /* FIXME: Is this the cause of some of the
+ SDL_Quit() errors? */
+
+/* TODO: Figure out if any initialization needs to go here */
/* Set the function pointers */
device->VideoInit = BE_VideoInit;
@@ -105,7 +93,7 @@
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;
@@ -115,7 +103,7 @@
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;
@@ -140,8 +128,6 @@
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 */
@@ -162,9 +148,6 @@
BE_GL_LoadLibrary(_this, NULL);
#endif
- /* Fill in some window manager capabilities */
-// _this->info.wm_available = 1;
-
/* We're done! */
return (0);
}
@@ -177,24 +160,8 @@
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();
}
diff -r b85b6326c498 -r d9e9c343d264 src/video/bwindow/SDL_bwindow.cc
--- a/src/video/bwindow/SDL_bwindow.cc Sat Aug 20 15:16:13 2011 +0000
+++ b/src/video/bwindow/SDL_bwindow.cc Mon Aug 22 11:02:05 2011 +0000
@@ -47,13 +47,17 @@
);
if(window->flags & SDL_WINDOW_FULLSCREEN) {
+ /* TODO: Add support for this flag */
+ printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
}
if(window->flags & SDL_WINDOW_OPENGL) {
+ /* TODO: Add support for this flag */
}
if(!(window->flags & SDL_WINDOW_RESIZABLE)) {
flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE;
}
if(window->flags & SDL_WINDOW_BORDERLESS) {
+ /* TODO: Add support for this flag */
}
SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, flags);
@@ -172,10 +176,12 @@
int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
/* FIXME: Not BeOs/Haiku supported */
+ return -1;
}
int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
/* FIXME: Not BeOs/Haiku supported */
+ return -1;
}
@@ -193,6 +199,7 @@
SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info) {
/* FIXME: What is the point of this? What information should be included? */
+ return SDL_FALSE;
}
More information about the commits
mailing list