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:
@@ -7,8 +7,7 @@
|
|||||||
#define SERVER_PORT_NAME "OBappserver"
|
#define SERVER_PORT_NAME "OBappserver"
|
||||||
#define SERVER_INPUT_PORT "OBinputport"
|
#define SERVER_INPUT_PORT "OBinputport"
|
||||||
|
|
||||||
enum
|
enum {
|
||||||
{
|
|
||||||
// Used for quick replies from the app_server
|
// Used for quick replies from the app_server
|
||||||
SERVER_TRUE='_srt',
|
SERVER_TRUE='_srt',
|
||||||
SERVER_FALSE,
|
SERVER_FALSE,
|
||||||
@@ -85,7 +84,6 @@ AS_WINDOW_MINIMIZE,
|
|||||||
AS_UPDATE_IF_NEEDED,
|
AS_UPDATE_IF_NEEDED,
|
||||||
_ALL_UPDATED_, // this should be moved in place of _UPDATE_IF_NEEDED_ in AppDefs.h
|
_ALL_UPDATED_, // this should be moved in place of _UPDATE_IF_NEEDED_ in AppDefs.h
|
||||||
|
|
||||||
|
|
||||||
// BPicture definitions
|
// BPicture definitions
|
||||||
AS_CREATE_PICTURE,
|
AS_CREATE_PICTURE,
|
||||||
AS_DELETE_PICTURE,
|
AS_DELETE_PICTURE,
|
||||||
@@ -133,6 +131,9 @@ AS_SCREEN_GET_MODE,
|
|||||||
AS_SCREEN_SET_MODE,
|
AS_SCREEN_SET_MODE,
|
||||||
AS_SCREEN_GET_COLORMAP,
|
AS_SCREEN_GET_COLORMAP,
|
||||||
|
|
||||||
|
AS_GET_DESKTOP_COLOR,
|
||||||
|
AS_SET_DESKTOP_COLOR,
|
||||||
|
|
||||||
// Global function call defs
|
// Global function call defs
|
||||||
AS_SET_UI_COLORS,
|
AS_SET_UI_COLORS,
|
||||||
AS_GET_UI_COLORS,
|
AS_GET_UI_COLORS,
|
||||||
|
|||||||
@@ -245,15 +245,17 @@ BPrivateScreen::ReadBitmap(BBitmap *bitmap, bool drawCursor, BRect *bound)
|
|||||||
rgb_color
|
rgb_color
|
||||||
BPrivateScreen::DesktopColor(uint32 workspace)
|
BPrivateScreen::DesktopColor(uint32 workspace)
|
||||||
{
|
{
|
||||||
rgb_color color;
|
rgb_color color = { 51, 102, 152, 255 };
|
||||||
/*
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
PortMessage reply;
|
|
||||||
link.SetOpCode(AS_GET_DESKTOP_COLOR);
|
link.StartMessage(AS_GET_DESKTOP_COLOR);
|
||||||
link.Attach<int32>(workspace);
|
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;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,14 +263,13 @@ BPrivateScreen::DesktopColor(uint32 workspace)
|
|||||||
void
|
void
|
||||||
BPrivateScreen::SetDesktopColor(rgb_color color, uint32 workspace, bool makeDefault)
|
BPrivateScreen::SetDesktopColor(rgb_color color, uint32 workspace, bool makeDefault)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_SET_DESKTOP_COLOR);
|
|
||||||
|
link.StartMessage(AS_SET_DESKTOP_COLOR);
|
||||||
link.Attach<rgb_color>(color);
|
link.Attach<rgb_color>(color);
|
||||||
link.Attach<int32>(workspace);
|
link.Attach<int32>(workspace);
|
||||||
link.Attach<bool>(makeDefault);
|
link.Attach<bool>(makeDefault);
|
||||||
link.Flush();
|
link.Flush();
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ AppServer::MainLoop(void)
|
|||||||
int32 code;
|
int32 code;
|
||||||
status_t err = pmsg.GetNextMessage(code);
|
status_t err = pmsg.GetNextMessage(code);
|
||||||
if (err < B_OK) {
|
if (err < B_OK) {
|
||||||
STRACE(("MainLoop:pmsg.GetNextReply failed\n"));
|
STRACE(("MainLoop:pmsg.GetNextMessage() failed\n"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -671,6 +671,8 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
link.Read<uint32>(&mode);
|
link.Read<uint32>(&mode);
|
||||||
link.Read<bool>(&stick);
|
link.Read<bool>(&stick);
|
||||||
|
|
||||||
|
// ToDo: is this still used at all? (since there is AS_SCREEN_SET_MODE?)
|
||||||
|
// ToDo: no locking?
|
||||||
RootLayer *root = gDesktop->ActiveRootLayer();
|
RootLayer *root = gDesktop->ActiveRootLayer();
|
||||||
Workspace *workspace = root->WorkspaceAt(index);
|
Workspace *workspace = root->WorkspaceAt(index);
|
||||||
|
|
||||||
@@ -1775,6 +1777,34 @@ printf("ServerApp %s: AS_SCREEN_GET_MODE\n", fSignature.String());
|
|||||||
break;
|
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:
|
default:
|
||||||
printf("ServerApp %s received unhandled message code offset %s\n",
|
printf("ServerApp %s received unhandled message code offset %s\n",
|
||||||
fSignature.String(), MsgCodeToBString(code).String());
|
fSignature.String(), MsgCodeToBString(code).String());
|
||||||
|
|||||||
Reference in New Issue
Block a user