ServerWindow is no more a ServerApp's friend. Some cleanups.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12663 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1956,6 +1956,14 @@ ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
ServerApp::CountBitmaps() const
|
||||||
|
{
|
||||||
|
return fBitmapList ? fBitmapList->CountItems() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Looks up a ServerApp's ServerBitmap in its list
|
\brief Looks up a ServerApp's ServerBitmap in its list
|
||||||
\param token ID token of the bitmap to find
|
\param token ID token of the bitmap to find
|
||||||
@@ -1975,6 +1983,27 @@ ServerApp::FindBitmap(int32 token) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
ServerApp::CountPictures() const
|
||||||
|
{
|
||||||
|
return fPictureList ? fPictureList->CountItems() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ServerPicture *
|
||||||
|
ServerApp::FindPicture(int32 token) const
|
||||||
|
{
|
||||||
|
ServerPicture *picture;
|
||||||
|
for (int32 i = 0; i < fPictureList->CountItems(); i++) {
|
||||||
|
picture = static_cast<ServerPicture *>(fPictureList->ItemAt(i));
|
||||||
|
if (picture && picture->GetToken() == token)
|
||||||
|
return picture;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
team_id
|
team_id
|
||||||
ServerApp::ClientTeamID() const
|
ServerApp::ClientTeamID() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class BList;
|
|||||||
class DisplayDriver;
|
class DisplayDriver;
|
||||||
class LinkMsgReader;
|
class LinkMsgReader;
|
||||||
class LinkMsgSender;
|
class LinkMsgSender;
|
||||||
|
class ServerPicture;
|
||||||
class ServerCursor;
|
class ServerCursor;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
|
|
||||||
@@ -74,18 +75,22 @@ public:
|
|||||||
|
|
||||||
void SetAppCursor(void);
|
void SetAppCursor(void);
|
||||||
|
|
||||||
ServerBitmap *FindBitmap(int32 token) const;
|
|
||||||
|
|
||||||
team_id ClientTeamID() const;
|
team_id ClientTeamID() const;
|
||||||
thread_id MonitorThreadID() const;
|
thread_id MonitorThreadID() const;
|
||||||
|
|
||||||
|
const char *Title() const { return fSignature.String(); }
|
||||||
|
|
||||||
|
int32 CountBitmaps() const;
|
||||||
|
ServerBitmap *FindBitmap(int32 token) const;
|
||||||
|
|
||||||
|
int32 CountPictures() const;
|
||||||
|
ServerPicture *FindPicture(int32 token) const;
|
||||||
|
|
||||||
|
AreaPool *AppAreaPool() { return fSharedMem; }
|
||||||
|
|
||||||
FMWList fAppFMWList;
|
FMWList fAppFMWList;
|
||||||
|
|
||||||
const char *Title() const { return fSignature.String(); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ServerWindow;
|
|
||||||
|
|
||||||
void DispatchMessage(int32 code, LinkMsgReader &link);
|
void DispatchMessage(int32 code, LinkMsgReader &link);
|
||||||
|
|
||||||
static int32 MonitorApp(void *data);
|
static int32 MonitorApp(void *data);
|
||||||
@@ -107,6 +112,9 @@ private:
|
|||||||
LinkMsgReader *fMsgReader;
|
LinkMsgReader *fMsgReader;
|
||||||
LinkMsgSender *fMsgSender;
|
LinkMsgSender *fMsgSender;
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
// - Are really Bitmaps and Pictures stored per application and not globally ?
|
||||||
|
// - As we reference these stuff by token, what about putting them in hash tables ?
|
||||||
BList *fSWindowList,
|
BList *fSWindowList,
|
||||||
*fBitmapList,
|
*fBitmapList,
|
||||||
*fPictureList;
|
*fPictureList;
|
||||||
|
|||||||
@@ -1039,25 +1039,10 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// search for a picture with the specified token.
|
// search for a picture with the specified token.
|
||||||
ServerPicture *sp = NULL;
|
ServerPicture *sp = cl->fServerWin->fServerApp->FindPicture(pictureToken);
|
||||||
int32 i = 0;
|
// TODO: Increase that picture's reference count.(~ allocate a picture)
|
||||||
while(1)
|
if (sp == NULL)
|
||||||
{
|
break;
|
||||||
sp=static_cast<ServerPicture*>(cl->fServerWin->fServerApp->fPictureList->ItemAt(i++));
|
|
||||||
if (!sp)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if(sp->GetToken() == pictureToken)
|
|
||||||
{
|
|
||||||
//cl->clipToPicture = sp;
|
|
||||||
|
|
||||||
// TODO: Increase that picture's reference count.(~ allocate a picture)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// avoid compiler warning
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
// we have a new picture to clip to, so rebuild our full region
|
// we have a new picture to clip to, so rebuild our full region
|
||||||
if(cl->clipToPicture)
|
if(cl->clipToPicture)
|
||||||
@@ -1102,26 +1087,11 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
link.Read<int32>(&pictureToken);
|
link.Read<int32>(&pictureToken);
|
||||||
link.Read<BPoint>(&where);
|
link.Read<BPoint>(&where);
|
||||||
|
|
||||||
ServerPicture *sp = NULL;
|
// TODO: Increase that picture's reference count.(~ allocate a picture)
|
||||||
int32 i = 0;
|
ServerPicture *sp = cl->fServerWin->fServerApp->FindPicture(pictureToken);
|
||||||
|
if (sp == NULL)
|
||||||
while(1)
|
break;
|
||||||
{
|
|
||||||
sp= static_cast<ServerPicture*>(cl->fServerWin->fServerApp->fPictureList->ItemAt(i++));
|
|
||||||
if (!sp)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if(sp->GetToken() == pictureToken)
|
|
||||||
{
|
|
||||||
//cl->clipToPicture = sp;
|
|
||||||
|
|
||||||
// TODO: Increase that picture's reference count.(~ allocate a picture)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// avoid compiler warning
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
// if a picture has been found...
|
// if a picture has been found...
|
||||||
if(cl->clipToPicture)
|
if(cl->clipToPicture)
|
||||||
{
|
{
|
||||||
@@ -2023,7 +1993,7 @@ void ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
|
|||||||
// This is a very special case in the sense that when ServerMemIO is used for this
|
// This is a very special case in the sense that when ServerMemIO is used for this
|
||||||
// purpose, it will be set to NOT automatically free the memory which it had
|
// purpose, it will be set to NOT automatically free the memory which it had
|
||||||
// requested. This is the server's job once the message has been dispatched.
|
// requested. This is the server's job once the message has been dispatched.
|
||||||
fServerApp->fSharedMem->ReleaseBuffer(msgpointer);
|
fServerApp->AppAreaPool()->ReleaseBuffer(msgpointer);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user