* Removed the (200, 200) inset.

* fOldMode is now set to the current display mode.
* Now checks semaphore creations and memory allocations for failure.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17317 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-05-04 10:55:01 +00:00
parent 7fa10e9922
commit fe01155b84
1 changed files with 26 additions and 13 deletions

View File

@ -286,7 +286,7 @@ set_mouse_position(int32 x, int32 y)
BWindowScreen::BWindowScreen(const char *title, uint32 space,
status_t *error, bool debug_enable)
: BWindow(BScreen().Frame().InsetByCopy(200, 200), title, B_TITLED_WINDOW,
: BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE)
{
@ -303,7 +303,7 @@ BWindowScreen::BWindowScreen(const char *title, uint32 space,
BWindowScreen::BWindowScreen(const char *title, uint32 space,
uint32 attributes, status_t *error)
: BWindow(BScreen().Frame().InsetByCopy(200, 200), title, B_TITLED_WINDOW,
: BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE)
{
@ -673,35 +673,48 @@ BWindowScreen::InitData(uint32 space, uint32 attributes)
fAddonImage = -1;
fWindowState = 0;
BScreen screen(this);
// TODO: free resources upon failure!
BScreen screen(this);
status_t status = screen.GetModeList(&fModeList, &fModeCount);
if (status < B_OK)
return status;
display_mode newMode;
status = GetModeFromSpace(space, &newMode);
fDisplayMode = (display_mode *)malloc(sizeof(display_mode));
if (fDisplayMode == NULL)
return B_NO_MEMORY;
status = GetModeFromSpace(space, fDisplayMode);
if (status < B_OK)
return status;
space_mode = 1;
space0 = 0;
memcpy(fColorList, screen.ColorMap()->color_list, 256);
status = GetCardInfo();
if (status < B_OK)
return status;
fActivateSem = create_sem(0, "WindowScreen start lock");
if (fActivateSem < B_OK)
return fActivateSem;
fActivateState = 0;
fDebugSem = create_sem(1, "WindowScreen debug sem");
fOldDisplayMode = (display_mode *)calloc(1, sizeof(display_mode));
fDisplayMode = (display_mode *)calloc(1, sizeof(display_mode));
memcpy(fDisplayMode, &newMode, sizeof(display_mode));
if (fDebugSem < B_OK)
return fDebugSem;
fWorkState = 1;
fOldDisplayMode = (display_mode *)malloc(sizeof(display_mode));
if (fOldDisplayMode == NULL)
return B_NO_MEMORY;
screen.GetMode(fOldDisplayMode);
return B_OK;
}