2003-01-24 17:36:15 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2005-05-08 10:06:55 +04:00
|
|
|
// Copyright (c) 2001-2005, Haiku, Inc.
|
2003-01-24 17:36:15 +03:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
//
|
|
|
|
// File Name: ServerApp.h
|
|
|
|
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
2004-01-20 01:18:37 +03:00
|
|
|
// Adi Oanca <adioanca@myrealbox.com>
|
2003-01-24 17:36:15 +03:00
|
|
|
// Description: Server-side BApplication counterpart
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
#ifndef _SERVERAPP_H_
|
|
|
|
#define _SERVERAPP_H_
|
|
|
|
|
|
|
|
#include <OS.h>
|
|
|
|
#include <String.h>
|
2005-06-08 08:01:59 +04:00
|
|
|
#include <PortLink.h>
|
2005-05-07 19:56:15 +04:00
|
|
|
|
2005-06-17 20:34:22 +04:00
|
|
|
#include "SubWindowList.h"
|
2003-08-31 21:38:34 +04:00
|
|
|
|
2005-05-07 19:56:15 +04:00
|
|
|
class AreaPool;
|
2003-01-24 17:36:15 +03:00
|
|
|
class BMessage;
|
|
|
|
class BList;
|
|
|
|
class DisplayDriver;
|
2005-05-14 17:22:26 +04:00
|
|
|
class ServerPicture;
|
2003-01-27 22:43:15 +03:00
|
|
|
class ServerCursor;
|
2004-02-24 14:58:25 +03:00
|
|
|
class ServerBitmap;
|
2003-01-24 17:36:15 +03:00
|
|
|
|
2005-06-15 01:28:56 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
class PortLink;
|
|
|
|
};
|
|
|
|
|
2003-01-24 17:36:15 +03:00
|
|
|
/*!
|
|
|
|
\class ServerApp ServerApp.h
|
|
|
|
\brief Counterpart to BApplication within the app_server
|
|
|
|
*/
|
2005-05-07 19:56:15 +04:00
|
|
|
class ServerApp {
|
2003-01-24 17:36:15 +03:00
|
|
|
public:
|
2004-01-20 01:18:37 +03:00
|
|
|
ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort,
|
2005-05-12 14:31:48 +04:00
|
|
|
team_id clientTeamID, int32 handlerID, const char* signature);
|
2005-05-08 10:06:55 +04:00
|
|
|
virtual ~ServerApp(void);
|
2004-01-20 01:18:37 +03:00
|
|
|
|
|
|
|
bool Run(void);
|
2005-05-08 10:06:55 +04:00
|
|
|
/*
|
|
|
|
TODO: These aren't even implemented...
|
2004-01-20 01:18:37 +03:00
|
|
|
void Lock(void);
|
|
|
|
void Unlock(void);
|
|
|
|
bool IsLocked(void);
|
2005-05-08 10:06:55 +04:00
|
|
|
*/
|
2003-01-24 17:36:15 +03:00
|
|
|
/*!
|
|
|
|
\brief Determines whether the application is the active one
|
|
|
|
\return true if active, false if not.
|
|
|
|
*/
|
2004-01-20 01:18:37 +03:00
|
|
|
bool IsActive(void) const { return fIsActive; }
|
|
|
|
void Activate(bool value);
|
2005-05-08 10:06:55 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
bool PingTarget(void);
|
|
|
|
|
2004-08-23 02:33:57 +04:00
|
|
|
void PostMessage(int32 code);
|
2004-01-20 01:18:37 +03:00
|
|
|
void SendMessageToClient( const BMessage* msg ) const;
|
2005-05-08 10:06:55 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
void SetAppCursor(void);
|
2005-05-08 10:06:55 +04:00
|
|
|
|
2005-05-07 19:56:15 +04:00
|
|
|
team_id ClientTeamID() const;
|
|
|
|
thread_id MonitorThreadID() const;
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2005-05-07 19:56:15 +04:00
|
|
|
const char *Title() const { return fSignature.String(); }
|
2005-05-14 17:22:26 +04:00
|
|
|
|
|
|
|
int32 CountBitmaps() const;
|
|
|
|
ServerBitmap *FindBitmap(int32 token) const;
|
|
|
|
|
|
|
|
int32 CountPictures() const;
|
|
|
|
ServerPicture *FindPicture(int32 token) const;
|
2005-05-07 19:56:15 +04:00
|
|
|
|
2005-05-14 17:22:26 +04:00
|
|
|
AreaPool *AppAreaPool() { return fSharedMem; }
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2005-06-17 20:34:22 +04:00
|
|
|
SubWindowList fAppSubWindowList;
|
2005-05-14 17:22:26 +04:00
|
|
|
|
|
|
|
private:
|
2005-06-15 01:28:56 +04:00
|
|
|
void DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2005-05-07 19:56:15 +04:00
|
|
|
static int32 MonitorApp(void *data);
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2005-05-08 10:06:55 +04:00
|
|
|
// our BApplication's event port
|
|
|
|
port_id fClientAppPort;
|
|
|
|
// port we receive messages from our BApplication
|
|
|
|
port_id fMessagePort;
|
2004-08-09 02:34:36 +04:00
|
|
|
// TODO: find out why there is both the app port and the looper port. Do
|
2005-05-28 17:20:05 +04:00
|
|
|
// we really need both? Actually, we aren't using any of these ports,
|
|
|
|
// as BAppServerLink/BPortlink's messages always contain the reply port
|
2005-05-08 10:06:55 +04:00
|
|
|
// To send a message to the client, write a BMessage to this port
|
|
|
|
port_id fClientLooperPort;
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
BString fSignature;
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2005-05-08 10:06:55 +04:00
|
|
|
thread_id fMonitorThreadID;
|
2004-01-20 01:18:37 +03:00
|
|
|
team_id fClientTeamID;
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2005-06-15 01:28:56 +04:00
|
|
|
BPrivate::PortLink fLink;
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2005-05-14 17:22:26 +04:00
|
|
|
// 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 ?
|
2004-01-20 01:18:37 +03:00
|
|
|
BList *fSWindowList,
|
|
|
|
*fBitmapList,
|
|
|
|
*fPictureList;
|
2005-05-08 10:06:55 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
ServerCursor *fAppCursor;
|
2005-05-08 10:06:55 +04:00
|
|
|
|
2005-05-28 17:20:05 +04:00
|
|
|
// TODO: Not used.
|
2004-01-20 01:18:37 +03:00
|
|
|
sem_id fLockSem;
|
2005-05-08 10:06:55 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
bool fCursorHidden;
|
|
|
|
bool fIsActive;
|
2005-05-08 10:06:55 +04:00
|
|
|
|
|
|
|
// token ID of the BApplication's BHandler object.
|
|
|
|
// Used for BMessage target specification
|
|
|
|
// TODO: Is it still needed ? We aren't using it.
|
|
|
|
//int32 fHandlerToken;
|
|
|
|
|
2004-10-14 05:23:00 +04:00
|
|
|
AreaPool *fSharedMem;
|
2005-05-07 02:38:04 +04:00
|
|
|
|
|
|
|
bool fQuitting;
|
2003-01-24 17:36:15 +03:00
|
|
|
};
|
|
|
|
|
2005-06-15 01:28:56 +04:00
|
|
|
#endif // _SERVERAPP_H_
|