* BWindowScreen::_InitClone() was broken, it called the "get clone info" method
on uninitialized accelerant, but that's what AS_GET_DRIVER_PATH is for. * This should fix #2847. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28534 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2008, Haiku. All Rights Reserved.
|
* Copyright 2002-2008, Haiku. All Rights Reserved.
|
||||||
* Copyright 2002-2005,
|
* Copyright 2002-2005,
|
||||||
* Marcus Overhagen,
|
* Marcus Overhagen,
|
||||||
* Stefano Ceccherini ([email protected]),
|
* Stefano Ceccherini ([email protected]),
|
||||||
* Carwyn Jones ([email protected])
|
* Carwyn Jones ([email protected])
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@@ -71,7 +71,7 @@ blit(int32 sx, int32 sy, int32 dx, int32 dy, int32 width, int32 height)
|
|||||||
param.dest_top = dy;
|
param.dest_top = dy;
|
||||||
param.width = width;
|
param.width = width;
|
||||||
param.height = height;
|
param.height = height;
|
||||||
|
|
||||||
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
sBlitRectHook(sEngineToken, ¶m, 1);
|
sBlitRectHook(sEngineToken, ¶m, 1);
|
||||||
sReleaseEngineHook(sEngineToken, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
@@ -79,7 +79,7 @@ blit(int32 sx, int32 sy, int32 dx, int32 dy, int32 width, int32 height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This function seems not to be exported through CardHookAt().
|
// TODO: This function seems not to be exported through CardHookAt().
|
||||||
// At least, nothing I've tried uses it.
|
// At least, nothing I've tried uses it.
|
||||||
/*
|
/*
|
||||||
static int32
|
static int32
|
||||||
transparent_blit(int32 sx, int32 sy, int32 dx, int32 dy,
|
transparent_blit(int32 sx, int32 sy, int32 dx, int32 dy,
|
||||||
@@ -92,7 +92,7 @@ transparent_blit(int32 sx, int32 sy, int32 dx, int32 dy,
|
|||||||
param.dest_top = dy;
|
param.dest_top = dy;
|
||||||
param.width = width;
|
param.width = width;
|
||||||
param.height = height;
|
param.height = height;
|
||||||
|
|
||||||
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, 0, &sEngineToken);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, 0, &sEngineToken);
|
||||||
sTransparentBlitHook(sEngineToken, transparent_color, ¶m, 1);
|
sTransparentBlitHook(sEngineToken, transparent_color, ¶m, 1);
|
||||||
sReleaseEngineHook(sEngineToken, 0);
|
sReleaseEngineHook(sEngineToken, 0);
|
||||||
@@ -112,7 +112,7 @@ scaled_filtered_blit(int32 sx, int32 sy, int32 sw, int32 sh, int32 dx, int32 dy,
|
|||||||
param.dest_top = dy;
|
param.dest_top = dy;
|
||||||
param.dest_width = dw;
|
param.dest_width = dw;
|
||||||
param.dest_height = dh;
|
param.dest_height = dh;
|
||||||
|
|
||||||
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
sScaledFilteredBlitHook(sEngineToken, ¶m, 1);
|
sScaledFilteredBlitHook(sEngineToken, ¶m, 1);
|
||||||
sReleaseEngineHook(sEngineToken, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
@@ -128,7 +128,7 @@ draw_rect_8(int32 sx, int32 sy, int32 sw, int32 sh, uint8 color_index)
|
|||||||
param.top = sy;
|
param.top = sy;
|
||||||
param.right = sw;
|
param.right = sw;
|
||||||
param.bottom = sh;
|
param.bottom = sh;
|
||||||
|
|
||||||
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
sFillRectHook(sEngineToken, color_index, ¶m, 1);
|
sFillRectHook(sEngineToken, color_index, ¶m, 1);
|
||||||
sReleaseEngineHook(sEngineToken, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
@@ -144,7 +144,7 @@ draw_rect_16(int32 sx, int32 sy, int32 sw, int32 sh, uint16 color)
|
|||||||
param.top = sy;
|
param.top = sy;
|
||||||
param.right = sw;
|
param.right = sw;
|
||||||
param.bottom = sh;
|
param.bottom = sh;
|
||||||
|
|
||||||
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
sFillRectHook(sEngineToken, color, ¶m, 1);
|
sFillRectHook(sEngineToken, color, ¶m, 1);
|
||||||
sReleaseEngineHook(sEngineToken, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
@@ -160,7 +160,7 @@ draw_rect_32(int32 sx, int32 sy, int32 sw, int32 sh, uint32 color)
|
|||||||
param.top = sy;
|
param.top = sy;
|
||||||
param.right = sw;
|
param.right = sw;
|
||||||
param.bottom = sh;
|
param.bottom = sh;
|
||||||
|
|
||||||
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
sFillRectHook(sEngineToken, color, ¶m, 1);
|
sFillRectHook(sEngineToken, color, ¶m, 1);
|
||||||
sReleaseEngineHook(sEngineToken, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
@@ -176,7 +176,7 @@ set_mouse_position(int32 x, int32 y)
|
|||||||
{
|
{
|
||||||
BMessage command(IS_SET_MOUSE_POSITION);
|
BMessage command(IS_SET_MOUSE_POSITION);
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
|
|
||||||
command.AddPoint("where", BPoint(x, y));
|
command.AddPoint("where", BPoint(x, y));
|
||||||
_control_input_server_(&command, &reply);
|
_control_input_server_(&command, &reply);
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ BWindowScreen::BWindowScreen(const char *title, uint32 space,
|
|||||||
if (debug_enable)
|
if (debug_enable)
|
||||||
attributes |= B_ENABLE_DEBUGGER;
|
attributes |= B_ENABLE_DEBUGGER;
|
||||||
|
|
||||||
status_t status = _InitData(space, attributes);
|
status_t status = _InitData(space, attributes);
|
||||||
if (error)
|
if (error)
|
||||||
*error = status;
|
*error = status;
|
||||||
}
|
}
|
||||||
@@ -204,12 +204,12 @@ 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(), 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)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
status_t status = _InitData(space, attributes);
|
status_t status = _InitData(space, attributes);
|
||||||
if (error)
|
if (error)
|
||||||
*error = status;
|
*error = status;
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,7 @@ BWindowScreen::WorkspaceActivated(int32 ws, bool state)
|
|||||||
fWorkState = state;
|
fWorkState = state;
|
||||||
if (state) {
|
if (state) {
|
||||||
if (fLockState == 0 && fWindowState) {
|
if (fLockState == 0 && fWindowState) {
|
||||||
_Activate();
|
_Activate();
|
||||||
if (!IsHidden()) {
|
if (!IsHidden()) {
|
||||||
Activate(true);
|
Activate(true);
|
||||||
WindowActivated(true);
|
WindowActivated(true);
|
||||||
@@ -292,7 +292,7 @@ BWindowScreen::Hide()
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
Disconnect();
|
Disconnect();
|
||||||
BWindow::Hide();
|
BWindow::Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ BWindowScreen::SetColorList(rgb_color *list, int32 firstIndex, int32 lastIndex)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (Lock()) {
|
if (Lock()) {
|
||||||
if (!fActivateState) {
|
if (!fActivateState) {
|
||||||
// If we aren't active, we just change our local palette
|
// If we aren't active, we just change our local palette
|
||||||
for (int32 x = firstIndex; x <= lastIndex; x++) {
|
for (int32 x = firstIndex; x <= lastIndex; x++) {
|
||||||
fPalette[x] = list[x];
|
fPalette[x] = list[x];
|
||||||
@@ -405,7 +405,7 @@ BWindowScreen::MoveDisplayArea(int32 x, int32 y)
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
move_display_area moveDisplayArea = (move_display_area)fGetAccelerantHook(B_MOVE_DISPLAY, NULL);
|
move_display_area moveDisplayArea = (move_display_area)fGetAccelerantHook(B_MOVE_DISPLAY, NULL);
|
||||||
if (moveDisplayArea && moveDisplayArea((int16)x, (int16)y) == B_OK) {
|
if (moveDisplayArea && moveDisplayArea((int16)x, (int16)y) == B_OK) {
|
||||||
fFrameBufferInfo.display_x = x;
|
fFrameBufferInfo.display_x = x;
|
||||||
fFrameBufferInfo.display_y = y;
|
fFrameBufferInfo.display_y = y;
|
||||||
fDisplayMode->h_display_start = x;
|
fDisplayMode->h_display_start = x;
|
||||||
@@ -437,7 +437,7 @@ BWindowScreen::ColorList()
|
|||||||
frame_buffer_info *
|
frame_buffer_info *
|
||||||
BWindowScreen::FrameBufferInfo()
|
BWindowScreen::FrameBufferInfo()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return &fFrameBufferInfo;
|
return &fFrameBufferInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,7 +501,7 @@ BWindowScreen::RegisterThread(thread_id thread)
|
|||||||
|
|
||||||
void *newDebugList = realloc(fDebugThreads, (fDebugThreadCount + 1) * sizeof(thread_id));
|
void *newDebugList = realloc(fDebugThreads, (fDebugThreadCount + 1) * sizeof(thread_id));
|
||||||
if (newDebugList != NULL) {
|
if (newDebugList != NULL) {
|
||||||
fDebugThreads = (thread_id *)newDebugList;
|
fDebugThreads = (thread_id *)newDebugList;
|
||||||
fDebugThreads[fDebugThreadCount] = thread;
|
fDebugThreads[fDebugThreadCount] = thread;
|
||||||
fDebugThreadCount++;
|
fDebugThreadCount++;
|
||||||
}
|
}
|
||||||
@@ -520,14 +520,14 @@ void
|
|||||||
BWindowScreen::Suspend(char* label)
|
BWindowScreen::Suspend(char* label)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
if (fDebugState) {
|
if (fDebugState) {
|
||||||
fprintf(stderr, "## Debugger(\"%s\").", label);
|
fprintf(stderr, "## Debugger(\"%s\").", label);
|
||||||
fprintf(stderr, " Press Alt-F%ld or Cmd-F%ld to resume.\n", fWorkspaceIndex + 1,
|
fprintf(stderr, " Press Alt-F%ld or Cmd-F%ld to resume.\n", fWorkspaceIndex + 1,
|
||||||
fWorkspaceIndex + 1);
|
fWorkspaceIndex + 1);
|
||||||
|
|
||||||
if (IsLocked())
|
if (IsLocked())
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
activate_workspace(fDebugWorkspace);
|
activate_workspace(fDebugWorkspace);
|
||||||
|
|
||||||
// Suspend ourself
|
// Suspend ourself
|
||||||
@@ -564,7 +564,7 @@ status_t
|
|||||||
BWindowScreen::_InitData(uint32 space, uint32 attributes)
|
BWindowScreen::_InitData(uint32 space, uint32 attributes)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
fDebugState = attributes & B_ENABLE_DEBUGGER;
|
fDebugState = attributes & B_ENABLE_DEBUGGER;
|
||||||
fDebugThreadCount = 0;
|
fDebugThreadCount = 0;
|
||||||
fDebugThreads = NULL;
|
fDebugThreads = NULL;
|
||||||
@@ -595,7 +595,7 @@ BWindowScreen::_InitData(uint32 space, uint32 attributes)
|
|||||||
status = screen.GetMode(fOriginalDisplayMode);
|
status = screen.GetMode(fOriginalDisplayMode);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
throw status;
|
throw status;
|
||||||
|
|
||||||
status = screen.GetModeList(&fModeList, &fModeCount);
|
status = screen.GetModeList(&fModeList, &fModeCount);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
throw status;
|
throw status;
|
||||||
@@ -619,15 +619,15 @@ BWindowScreen::_InitData(uint32 space, uint32 attributes)
|
|||||||
memcpy(fPalette, screen.ColorMap()->color_list, sizeof(fPalette));
|
memcpy(fPalette, screen.ColorMap()->color_list, sizeof(fPalette));
|
||||||
fActivateState = 0;
|
fActivateState = 0;
|
||||||
fWorkState = 1;
|
fWorkState = 1;
|
||||||
|
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
|
|
||||||
} catch (std::bad_alloc) {
|
} catch (std::bad_alloc) {
|
||||||
status = B_NO_MEMORY;
|
status = B_NO_MEMORY;
|
||||||
} catch (status_t error) {
|
} catch (status_t error) {
|
||||||
status = error;
|
status = error;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
status = B_ERROR;
|
status = B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
@@ -644,17 +644,17 @@ BWindowScreen::_DisposeData()
|
|||||||
Disconnect();
|
Disconnect();
|
||||||
if (fAddonImage >= 0) {
|
if (fAddonImage >= 0) {
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_sem(fActivateSem);
|
delete_sem(fActivateSem);
|
||||||
fActivateSem = -1;
|
fActivateSem = -1;
|
||||||
delete_sem(fDebugSem);
|
delete_sem(fDebugSem);
|
||||||
fDebugSem = -1;
|
fDebugSem = -1;
|
||||||
|
|
||||||
if (fDebugState)
|
if (fDebugState)
|
||||||
activate_workspace(fDebugWorkspace);
|
activate_workspace(fDebugWorkspace);
|
||||||
|
|
||||||
delete fDisplayMode;
|
delete fDisplayMode;
|
||||||
fDisplayMode = NULL;
|
fDisplayMode = NULL;
|
||||||
delete fOriginalDisplayMode;
|
delete fOriginalDisplayMode;
|
||||||
@@ -662,7 +662,7 @@ BWindowScreen::_DisposeData()
|
|||||||
free(fModeList);
|
free(fModeList);
|
||||||
fModeList = NULL;
|
fModeList = NULL;
|
||||||
fModeCount = 0;
|
fModeCount = 0;
|
||||||
|
|
||||||
fLockState = 0;
|
fLockState = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -678,7 +678,7 @@ BWindowScreen::_Activate()
|
|||||||
status = _SetupAccelerantHooks(true);
|
status = _SetupAccelerantHooks(true);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
if (!fActivateState) {
|
if (!fActivateState) {
|
||||||
do {
|
do {
|
||||||
status = acquire_sem(fActivateSem);
|
status = acquire_sem(fActivateSem);
|
||||||
@@ -691,13 +691,13 @@ BWindowScreen::_Activate()
|
|||||||
SetColorList(fPalette);
|
SetColorList(fPalette);
|
||||||
if (fDebugState && !fDebugFirst) {
|
if (fDebugState && !fDebugFirst) {
|
||||||
SuspensionHook(true);
|
SuspensionHook(true);
|
||||||
_Resume();
|
_Resume();
|
||||||
} else {
|
} else {
|
||||||
fDebugFirst = true;
|
fDebugFirst = true;
|
||||||
ScreenConnected(true);
|
ScreenConnected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -713,8 +713,8 @@ BWindowScreen::_Deactivate()
|
|||||||
ScreenConnected(false);
|
ScreenConnected(false);
|
||||||
|
|
||||||
status_t status = _SetupAccelerantHooks(false);
|
status_t status = _SetupAccelerantHooks(false);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
be_app->ShowCursor();
|
be_app->ShowCursor();
|
||||||
if (fActivateState) {
|
if (fActivateState) {
|
||||||
// TODO: reset palette
|
// TODO: reset palette
|
||||||
}
|
}
|
||||||
@@ -777,7 +777,7 @@ BWindowScreen::_SetupAccelerantHooks(bool enable)
|
|||||||
fWaitEngineIdle();
|
fWaitEngineIdle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,12 +837,12 @@ BWindowScreen::_GetCardInfo()
|
|||||||
if (link.FlushWithReply(result) < B_OK || result < B_OK)
|
if (link.FlushWithReply(result) < B_OK || result < B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
frame_buffer_config config;
|
frame_buffer_config config;
|
||||||
link.Read<frame_buffer_config>(&config);
|
link.Read<frame_buffer_config>(&config);
|
||||||
|
|
||||||
fCardInfo.frame_buffer = config.frame_buffer;
|
fCardInfo.frame_buffer = config.frame_buffer;
|
||||||
fCardInfo.bytes_per_row = config.bytes_per_row;
|
fCardInfo.bytes_per_row = config.bytes_per_row;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -867,7 +867,7 @@ BWindowScreen::_Suspend()
|
|||||||
}
|
}
|
||||||
|
|
||||||
graphics_card_info *info = CardInfo();
|
graphics_card_info *info = CardInfo();
|
||||||
size_t fbSize = info->bytes_per_row * info->height;
|
size_t fbSize = info->bytes_per_row * info->height;
|
||||||
|
|
||||||
// Save the content of the frame buffer into the local buffer
|
// Save the content of the frame buffer into the local buffer
|
||||||
fDebugFrameBuffer = (char *)malloc(fbSize);
|
fDebugFrameBuffer = (char *)malloc(fbSize);
|
||||||
@@ -921,71 +921,64 @@ status_t
|
|||||||
BWindowScreen::_InitClone()
|
BWindowScreen::_InitClone()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
if (fAddonImage >= 0)
|
if (fAddonImage >= 0)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
|
BScreen screen(this);
|
||||||
|
|
||||||
AppServerLink link;
|
AppServerLink link;
|
||||||
link.StartMessage(AS_GET_ACCELERANT_PATH);
|
link.StartMessage(AS_GET_ACCELERANT_PATH);
|
||||||
link.Attach<int32>(fWorkspaceIndex);
|
link.Attach<screen_id>(screen.ID());
|
||||||
|
|
||||||
status_t status = B_ERROR;
|
status_t status = B_ERROR;
|
||||||
if (link.FlushWithReply(status) < B_OK || status < B_OK)
|
if (link.FlushWithReply(status) < B_OK || status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
BString accelerantPath;
|
BString accelerantPath;
|
||||||
link.ReadString(accelerantPath);
|
link.ReadString(accelerantPath);
|
||||||
fAddonImage = load_add_on(accelerantPath.String());
|
|
||||||
|
link.StartMessage(AS_GET_DRIVER_PATH);
|
||||||
|
link.Attach<screen_id>(screen.ID());
|
||||||
|
|
||||||
|
status = B_ERROR;
|
||||||
|
if (link.FlushWithReply(status) < B_OK || status < B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
BString driverPath;
|
||||||
|
link.ReadString(driverPath);
|
||||||
|
|
||||||
|
fAddonImage = load_add_on(accelerantPath.String());
|
||||||
if (fAddonImage < B_OK) {
|
if (fAddonImage < B_OK) {
|
||||||
fprintf(stderr, "InitClone: cannot load accelerant image\n");
|
fprintf(stderr, "InitClone: cannot load accelerant image\n");
|
||||||
return fAddonImage;
|
return fAddonImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT,
|
status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT,
|
||||||
B_SYMBOL_TYPE_TEXT, (void **)&fGetAccelerantHook);
|
B_SYMBOL_TYPE_TEXT, (void**)&fGetAccelerantHook);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
fprintf(stderr, "InitClone: cannot get accelerant entry point\n");
|
fprintf(stderr, "InitClone: cannot get accelerant entry point\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
return status;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
accelerant_clone_info_size cloneInfoSizeHook;
|
|
||||||
get_accelerant_clone_info cloneInfoHook;
|
|
||||||
clone_accelerant cloneHook;
|
|
||||||
cloneInfoSizeHook = (accelerant_clone_info_size)fGetAccelerantHook(B_ACCELERANT_CLONE_INFO_SIZE, NULL);
|
|
||||||
cloneInfoHook = (get_accelerant_clone_info)fGetAccelerantHook(B_GET_ACCELERANT_CLONE_INFO, NULL);
|
|
||||||
cloneHook = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
|
|
||||||
|
|
||||||
status = B_ERROR;
|
clone_accelerant cloneHook
|
||||||
if (!cloneInfoSizeHook || !cloneInfoHook || !cloneHook) {
|
= (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
|
||||||
|
if (cloneHook == NULL) {
|
||||||
fprintf(stderr, "InitClone: cannot get clone hook\n");
|
fprintf(stderr, "InitClone: cannot get clone hook\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
return status;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t cloneInfoSize = cloneInfoSizeHook();
|
status = cloneHook((void*)driverPath.String());
|
||||||
void *cloneInfo = malloc(cloneInfoSize);
|
|
||||||
if (!cloneInfo) {
|
|
||||||
unload_add_on(fAddonImage);
|
|
||||||
fAddonImage = -1;
|
|
||||||
return B_NO_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
cloneInfoHook(cloneInfo);
|
|
||||||
// no way to see if this call fails
|
|
||||||
|
|
||||||
status = cloneHook(cloneInfo);
|
|
||||||
|
|
||||||
free(cloneInfo);
|
|
||||||
|
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
fprintf(stderr, "InitClone: cannot clone accelerant\n");
|
fprintf(stderr, "InitClone: cannot clone accelerant\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2524,8 +2524,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
|
|
||||||
case AS_GET_ACCELERANT_PATH:
|
case AS_GET_ACCELERANT_PATH:
|
||||||
{
|
{
|
||||||
int32 index;
|
screen_id id;
|
||||||
fLink.Read<int32>(&index);
|
fLink.Read<screen_id>(&id);
|
||||||
|
|
||||||
BString path;
|
BString path;
|
||||||
status_t status = fDesktop->HWInterface()->GetAccelerantPath(path);
|
status_t status = fDesktop->HWInterface()->GetAccelerantPath(path);
|
||||||
@@ -2539,8 +2539,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
|
|
||||||
case AS_GET_DRIVER_PATH:
|
case AS_GET_DRIVER_PATH:
|
||||||
{
|
{
|
||||||
int32 index;
|
screen_id id;
|
||||||
fLink.Read<int32>(&index);
|
fLink.Read<screen_id>(&id);
|
||||||
|
|
||||||
BString path;
|
BString path;
|
||||||
status_t status = fDesktop->HWInterface()->GetDriverPath(path);
|
status_t status = fDesktop->HWInterface()->GetDriverPath(path);
|
||||||
|
|||||||
Reference in New Issue
Block a user