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