Added global app_server port, so that other parts of the server don't have
to search for it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12859 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -73,6 +73,8 @@
|
|||||||
|
|
||||||
Desktop *desktop;
|
Desktop *desktop;
|
||||||
|
|
||||||
|
port_id gAppServerPort;
|
||||||
|
|
||||||
// TODO: Global ? Is it really needed ?
|
// TODO: Global ? Is it really needed ?
|
||||||
//! Used to access the app_server from new_decorator
|
//! Used to access the app_server from new_decorator
|
||||||
AppServer *app_server=NULL;
|
AppServer *app_server=NULL;
|
||||||
@@ -101,6 +103,8 @@ AppServer::AppServer(void) :
|
|||||||
if (fMessagePort == B_NO_MORE_PORTS)
|
if (fMessagePort == B_NO_MORE_PORTS)
|
||||||
debugger("app_server could not create message port");
|
debugger("app_server could not create message port");
|
||||||
|
|
||||||
|
gAppServerPort = fMessagePort;
|
||||||
|
|
||||||
// Create the input port. The input_server will send it's messages here.
|
// Create the input port. The input_server will send it's messages here.
|
||||||
// TODO: If we want multiple user support we would need an individual
|
// TODO: If we want multiple user support we would need an individual
|
||||||
// port for each user and do the following for each RootLayer.
|
// port for each user and do the following for each RootLayer.
|
||||||
@@ -169,7 +173,6 @@ AppServer::AppServer(void) :
|
|||||||
|
|
||||||
fontserver->Unlock();
|
fontserver->Unlock();
|
||||||
|
|
||||||
|
|
||||||
// Load the GUI colors here and set the global set to the values contained therein. If this
|
// Load the GUI colors here and set the global set to the values contained therein. If this
|
||||||
// is not possible, set colors to the defaults
|
// is not possible, set colors to the defaults
|
||||||
if (!LoadGUIColors(&gui_colorset))
|
if (!LoadGUIColors(&gui_colorset))
|
||||||
@@ -878,6 +881,10 @@ AppServer::FindApp(const char *sig)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Creates a new decorator instance
|
\brief Creates a new decorator instance
|
||||||
\param rect Frame size
|
\param rect Frame size
|
||||||
@@ -919,7 +926,7 @@ int
|
|||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
// There can be only one....
|
// There can be only one....
|
||||||
if (find_port(SERVER_PORT_NAME) != B_NAME_NOT_FOUND)
|
if (find_port(SERVER_PORT_NAME) >= B_OK)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
srand(real_time_clock_usecs());
|
srand(real_time_clock_usecs());
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
#ifndef _OPENBEOS_APP_SERVER_H_
|
/*
|
||||||
#define _OPENBEOS_APP_SERVER_H_
|
* Copyright (c) 2001-2005, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT license.
|
||||||
|
*
|
||||||
|
* Author: DarkWyrm <[email protected]>
|
||||||
|
*/
|
||||||
|
#ifndef _HAIKU_APP_SERVER_H_
|
||||||
|
#define _HAIKU_APP_SERVER_H_
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
@@ -26,10 +32,10 @@ class BitmapManager;
|
|||||||
application start and quit messages. It also starts the housekeeping threads
|
application start and quit messages. It also starts the housekeeping threads
|
||||||
and initializes most of the server's globals.
|
and initializes most of the server's globals.
|
||||||
*/
|
*/
|
||||||
#if TEST_MODE
|
|
||||||
class AppServer : public BApplication
|
|
||||||
#else
|
|
||||||
class AppServer
|
class AppServer
|
||||||
|
#if TEST_MODE
|
||||||
|
: public BApplication
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -94,5 +100,6 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel
|
|||||||
extern BitmapManager *bitmapmanager;
|
extern BitmapManager *bitmapmanager;
|
||||||
extern ColorSet gui_colorset;
|
extern ColorSet gui_colorset;
|
||||||
extern AppServer *app_server;
|
extern AppServer *app_server;
|
||||||
|
extern port_id gAppServerPort;
|
||||||
|
|
||||||
#endif
|
#endif /* _HAIKU_APP_SERVER_H_ */
|
||||||
|
|||||||
@@ -216,12 +216,7 @@ ServerApp::PingTarget(void)
|
|||||||
{
|
{
|
||||||
team_info tinfo;
|
team_info tinfo;
|
||||||
if (get_team_info(fClientTeamID,&tinfo) == B_BAD_TEAM_ID) {
|
if (get_team_info(fClientTeamID,&tinfo) == B_BAD_TEAM_ID) {
|
||||||
port_id serverport = find_port(SERVER_PORT_NAME);
|
fMsgSender->SetPort(gAppServerPort);
|
||||||
if (serverport == B_NAME_NOT_FOUND) {
|
|
||||||
printf("PANIC: ServerApp %s could not find the app_server port in PingTarget()!\n",fSignature.String());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
fMsgSender->SetPort(serverport);
|
|
||||||
fMsgSender->StartMessage(AS_DELETE_APP);
|
fMsgSender->StartMessage(AS_DELETE_APP);
|
||||||
fMsgSender->Attach(&fMonitorThreadID, sizeof(thread_id));
|
fMsgSender->Attach(&fMonitorThreadID, sizeof(thread_id));
|
||||||
fMsgSender->Flush();
|
fMsgSender->Flush();
|
||||||
@@ -308,12 +303,7 @@ ServerApp::MonitorApp(void *data)
|
|||||||
STRACE(("ServerApp::MonitorApp(): GetNextMessage returned %s\n", strerror(err)));
|
STRACE(("ServerApp::MonitorApp(): GetNextMessage returned %s\n", strerror(err)));
|
||||||
|
|
||||||
// ToDo: this should kill the app, but it doesn't work
|
// ToDo: this should kill the app, but it doesn't work
|
||||||
port_id serverport = find_port(SERVER_PORT_NAME);
|
app->fMsgSender->SetPort(gAppServerPort);
|
||||||
if (serverport == B_NAME_NOT_FOUND){
|
|
||||||
printf("PANIC: ServerApp %s could not find the app_server port!\n",app->fSignature.String());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
app->fMsgSender->SetPort(serverport);
|
|
||||||
app->fMsgSender->StartMessage(AS_DELETE_APP);
|
app->fMsgSender->StartMessage(AS_DELETE_APP);
|
||||||
app->fMsgSender->Attach(&app->fMonitorThreadID, sizeof(thread_id));
|
app->fMsgSender->Attach(&app->fMonitorThreadID, sizeof(thread_id));
|
||||||
app->fMsgSender->Flush();
|
app->fMsgSender->Flush();
|
||||||
@@ -393,12 +383,7 @@ ServerApp::MonitorApp(void *data)
|
|||||||
STRACE(("ServerApp %s: B_QUIT_REQUESTED\n",app->fSignature.String()));
|
STRACE(("ServerApp %s: B_QUIT_REQUESTED\n",app->fSignature.String()));
|
||||||
// Our BApplication sent us this message when it quit.
|
// Our BApplication sent us this message when it quit.
|
||||||
// We need to ask the app_server to delete ourself.
|
// We need to ask the app_server to delete ourself.
|
||||||
port_id serverport = find_port(SERVER_PORT_NAME);
|
app->fMsgSender->SetPort(gAppServerPort);
|
||||||
if (serverport == B_NAME_NOT_FOUND){
|
|
||||||
printf("PANIC: ServerApp %s could not find the app_server port!\n",app->fSignature.String());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
app->fMsgSender->SetPort(serverport);
|
|
||||||
app->fMsgSender->StartMessage(AS_DELETE_APP);
|
app->fMsgSender->StartMessage(AS_DELETE_APP);
|
||||||
app->fMsgSender->Attach(&app->fMonitorThreadID, sizeof(thread_id));
|
app->fMsgSender->Attach(&app->fMonitorThreadID, sizeof(thread_id));
|
||||||
app->fMsgSender->Flush();
|
app->fMsgSender->Flush();
|
||||||
|
|||||||
Reference in New Issue
Block a user