Added AS_{GET|SET}_DESKTOP_COLOR.

(Incorrectly) implemented AS_GET_DESKTOP_COLOR - works for now.
Minor cleanup.
Is AS_SET_SCREEN_MODE used at all?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13010 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-06-08 13:24:40 +00:00
parent 2f6a25d52d
commit 3ba7d6f350
4 changed files with 304 additions and 272 deletions
+11 -10
View File
@@ -245,15 +245,17 @@ BPrivateScreen::ReadBitmap(BBitmap *bitmap, bool drawCursor, BRect *bound)
rgb_color
BPrivateScreen::DesktopColor(uint32 workspace)
{
rgb_color color;
/*
rgb_color color = { 51, 102, 152, 255 };
BAppServerLink link;
PortMessage reply;
link.SetOpCode(AS_GET_DESKTOP_COLOR);
link.StartMessage(AS_GET_DESKTOP_COLOR);
link.Attach<int32>(workspace);
link.FlushWithReply(&reply);
reply.Read<rgb_color>(&color);
*/
int32 code;
if (link.FlushWithReply(&code) == B_OK
&& code == SERVER_TRUE)
link.Read<rgb_color>(&color);
return color;
}
@@ -261,14 +263,13 @@ BPrivateScreen::DesktopColor(uint32 workspace)
void
BPrivateScreen::SetDesktopColor(rgb_color color, uint32 workspace, bool makeDefault)
{
/*
BAppServerLink link;
link.SetOpCode(AS_SET_DESKTOP_COLOR);
link.StartMessage(AS_SET_DESKTOP_COLOR);
link.Attach<rgb_color>(color);
link.Attach<int32>(workspace);
link.Attach<bool>(makeDefault);
link.Flush();
*/
}
+1 -1
View File
@@ -403,7 +403,7 @@ AppServer::MainLoop(void)
int32 code;
status_t err = pmsg.GetNextMessage(code);
if (err < B_OK) {
STRACE(("MainLoop:pmsg.GetNextReply failed\n"));
STRACE(("MainLoop:pmsg.GetNextMessage() failed\n"));
continue;
}
+36 -6
View File
@@ -652,13 +652,13 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &link)
// TODO; Implement AS_DOWNLOAD_PICTURE
// What is this particular function call for, anyway?
STRACE(("ServerApp %s: Download Picture unimplemented\n",fSignature.String()));
STRACE(("ServerApp %s: Download Picture unimplemented\n", fSignature.String()));
break;
}
case AS_SET_SCREEN_MODE:
{
STRACE(("ServerApp %s: Set Screen Mode\n",fSignature.String()));
STRACE(("ServerApp %s: Set Screen Mode\n", fSignature.String()));
// Attached data
// 1) int32 workspace #
@@ -670,10 +670,12 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &link)
link.Read<int32>(&index);
link.Read<uint32>(&mode);
link.Read<bool>(&stick);
RootLayer *root=gDesktop->ActiveRootLayer();
Workspace *workspace=root->WorkspaceAt(index);
// ToDo: is this still used at all? (since there is AS_SCREEN_SET_MODE?)
// ToDo: no locking?
RootLayer *root = gDesktop->ActiveRootLayer();
Workspace *workspace = root->WorkspaceAt(index);
if (!workspace) {
// apparently out of range or something, so we do nothing. :)
break;
@@ -1775,6 +1777,34 @@ printf("ServerApp %s: AS_SCREEN_GET_MODE\n", fSignature.String());
break;
}
case AS_GET_DESKTOP_COLOR:
{
STRACE(("ServerApp %s: get desktop color\n", fSignature.String()));
int32 workspaceIndex = 0;
link.Read<int32>(&workspaceIndex);
// ToDo: for some reason, we currently get "1" as no. of workspace
workspaceIndex = 0;
// ToDo: locking is probably wrong - why the hell is there no (safe)
// way to get to the workspace object directly?
RootLayer *root = gDesktop->ActiveRootLayer();
root->Lock();
Workspace *workspace = root->WorkspaceAt(workspaceIndex);
if (workspace != NULL) {
fLink.StartMessage(SERVER_TRUE);
//rgb_color color;
fLink.Attach<rgb_color>(workspace->BGColor().GetColor32());
} else
fLink.StartMessage(SERVER_FALSE);
fLink.Flush();
root->Unlock();
break;
}
default:
printf("ServerApp %s received unhandled message code offset %s\n",
fSignature.String(), MsgCodeToBString(code).String());