Renamed BAppServerLink to AppServerLink, BPortLink to PortLink, LinkMsgReader

to LinkReceiver, LinkMsgSender to LinkSender, and put everything into the
BPrivate namespace.
Made AppServerLink a cheap object - it will use the applications receiver/sender
and not create its own buffers.
Fixed broken communication stuff here and there (mostly Font.cpp).
Put the newly introduced set|get_system_colors() into the BPrivate namespace -
please don't introduce private functions into the public namespace!!!
Also fixed their broken communication use, as Darkwyrm obviously forgot about
it again: the sequence Flush(); GetNextMessage() without error checking is
purely wrong and can make the app hang and/or crash! :-)
Other minor cleanup.
The input_server used some test mode with the haiku build target which is
probably wrong.
Hopefully I did not forget anything this time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13128 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-06-14 21:28:56 +00:00
parent e274da0fa5
commit dd10337fd0
52 changed files with 1102 additions and 1192 deletions
+7 -7
View File
@@ -137,7 +137,7 @@ AppServer::Run(void)
void
AppServer::MainLoop(void)
{
BPortLink pmsg(-1,fMessagePort);
BPrivate::PortLink pmsg(-1,fMessagePort);
int32 code=0;
status_t err=B_OK;
@@ -178,7 +178,7 @@ AppServer::MainLoop(void)
void
AppServer::DispatchMessage(int32 code, BPortLink &msg)
AppServer::DispatchMessage(int32 code, BPrivate::PortLink &msg)
{
switch(code)
{
@@ -226,12 +226,12 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
release_sem(fAppListLock);
BPortLink replylink(app_port);
BPrivate::PortLink replylink(app_port);
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<int32>(newapp->fMessagePort);
replylink.Flush();
// This is necessary because BPortLink::ReadString allocates memory
// This is necessary because BPrivate::PortLink::ReadString allocates memory
if(app_signature)
free(app_signature);
@@ -281,12 +281,12 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
#endif
case AS_QUERY_FONTS_CHANGED:
{
// Seeing how the client merely wants an answer, we'll skip the BPortLink
// Seeing how the client merely wants an answer, we'll skip the BPrivate::PortLink
// and all its overhead and just write the code to port.
port_id replyport;
if (msg.Read<port_id>(&replyport) < B_OK)
break;
BPortLink replylink(replyport);
BPrivate::PortLink replylink(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
break;
@@ -300,7 +300,7 @@ AppServer::DispatchMessage(int32 code, BPortLink &msg)
if(msg.Read<port_id>(&replyport)<B_OK)
return;
BPortLink replylink(replyport);
BPrivate::PortLink replylink(replyport);
replylink.StartMessage(AS_GET_DECORATOR);
replylink.AttachString("none");
replylink.Flush();
+6 -4
View File
@@ -14,12 +14,14 @@ class Layer;
class BMessage;
class ServerApp;
class DisplayDriver;
class BPortLink;
class CursorManager;
class BitmapManager;
class AppServer
{
namespace BPrivate {
class PortLink;
};
class AppServer {
public:
AppServer(void);
~AppServer(void);
@@ -29,7 +31,7 @@ public:
thread_id Run(void);
void MainLoop(void);
void DispatchMessage(int32 code, BPortLink &link);
void DispatchMessage(int32 code, BPrivate::PortLink &link);
private:
port_id fMessagePort;
+31 -31
View File
@@ -107,8 +107,8 @@ ServerApp::ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort
// fMessagePort is the port we receive messages from our BApplication
fMessagePort=rcvport;
fMsgReader = new LinkMsgReader(fMessagePort);
fMsgSender = new LinkMsgSender(fClientAppPort);
fMsgReader = new BPrivate::LinkReceiver(fMessagePort);
fMsgSender = new BPrivate::LinkSender(fClientAppPort);
fIsActive=false;
@@ -186,7 +186,7 @@ ServerApp::PingTarget(void)
*/
void ServerApp::PostMessage(int32 code)
{
BPortLink link(fMessagePort);
BPrivate::PortLink link(fMessagePort);
link.StartMessage(code);
link.Flush();
}
@@ -239,7 +239,7 @@ int32 ServerApp::MonitorApp(void *data)
// Message-dispatching loop for the ServerApp
ServerApp *app = (ServerApp *)data;
LinkMsgReader msgqueue(app->fMessagePort);
BPrivate::LinkReceiver msgqueue(app->fMessagePort);
bool quitting = false;
int32 code;
@@ -340,9 +340,9 @@ int32 ServerApp::MonitorApp(void *data)
All attachments are placed in the buffer via a PortLink, so it will be a
matter of casting and incrementing an index variable to access them.
*/
void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
void ServerApp::DispatchMessage(int32 code, BPrivate::LinkReceiver &msg)
{
BPortLink replylink;
BPrivate::PortLink replylink;
switch(code)
{
@@ -371,7 +371,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
void *sharedmem=fSharedMem->GetBuffer(memsize);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
if(memsize<1 || sharedmem==NULL)
{
replylink.StartMessage(SERVER_FALSE);
@@ -460,7 +460,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
STRACE(("ServerApp %s: Create Bitmap (%.1f,%.1f,%.1f,%.1f)\n",
fSignature.String(),r.left,r.top,r.right,r.bottom));
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
/* if(sbmp)
{
fBitmapList->AddItem(sbmp);
@@ -495,7 +495,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<int32>(&bmp_id);
msg.Read<int32>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_TRUE);
replylink.Flush();
break;
@@ -549,7 +549,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
int32 replyport;
msg.Read<int32>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(fCursorHidden ? SERVER_TRUE : SERVER_FALSE);
replylink.Flush();
break;
@@ -571,7 +571,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<int32>(&replyport);
// Synchronous message - BApplication is waiting on the cursor's ID
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<int32>(-1);
replylink.Flush();
@@ -597,7 +597,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
port_id replyport;
msg.Read<int32>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<scroll_bar_info>(sbi);
replylink.Flush();
@@ -621,7 +621,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
port_id replyport;
msg.Read<int32>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<bool>(true);
replylink.Flush();
@@ -658,7 +658,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
port_id replyport = -1;
msg.Read<int32>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<mode_mouse>(mmode);
replylink.Flush();
@@ -675,7 +675,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<int32>(&whichcolor);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<rgb_color>(color);
replylink.Flush();
@@ -714,7 +714,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<int32>(&famid);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -741,7 +741,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<int32>(&styid);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -765,7 +765,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<uint16>(&styid);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -793,7 +793,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<int32>(&styid);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
/* fontserver->Lock();
FontStyle *fstyle=fontserver->GetStyle(famid,styid);
@@ -843,7 +843,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<uint8>(&spacing);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
break;
@@ -878,7 +878,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<int32>(&styid);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -914,7 +914,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<int32>(&styid);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -936,7 +936,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read(fam,sizeof(font_family));
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -962,7 +962,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read(sty,sizeof(font_style));
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -986,7 +986,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<uint16>(&sty);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -1019,7 +1019,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<int32>(0);
replylink.Flush();
@@ -1040,7 +1040,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read(fam,sizeof(font_family));
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
break;
@@ -1060,7 +1060,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
port_id replyport;
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -1083,7 +1083,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
msg.Read<float>(&ptsize);
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -1104,7 +1104,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
port_id replyport;
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
@@ -1125,7 +1125,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
port_id replyport;
msg.Read<port_id>(&replyport);
replylink.SetSendPort(replyport);
replylink.SetSenderPort(replyport);
replylink.StartMessage(SERVER_FALSE);
replylink.Flush();
+8 -5
View File
@@ -36,13 +36,16 @@
class AppServer;
class BMessage;
class BPortLink;
class BList;
class DisplayDriver;
class ServerCursor;
class ServerBitmap;
class AreaPool;
namespace BPrivate {
class PortLink;
};
/*!
\class ServerApp ServerApp.h
\brief Counterpart to BApplication within the app_server
@@ -81,7 +84,7 @@ protected:
friend class AppServer;
friend class ServerWindow;
void DispatchMessage(int32 code, LinkMsgReader &link);
void DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
port_id fClientAppPort,
fMessagePort,
@@ -94,9 +97,9 @@ protected:
team_id fClientTeamID;
LinkMsgReader *fMsgReader;
LinkMsgSender *fMsgSender;
BPrivate::LinkReceiver *fMsgReader;
BPrivate::LinkSender *fMsgSender;
/* BList *fSWindowList,
*fBitmapList,
*fPictureList;