2005-06-23 21:40:35 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2005, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
* Adrian Oanca <adioanca@cotty.iren.ro>
|
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
* Stefano Ceccherini (burton666@libero.it)
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
2003-01-24 17:36:15 +03:00
|
|
|
#ifndef _SERVERAPP_H_
|
|
|
|
#define _SERVERAPP_H_
|
|
|
|
|
2005-06-23 21:40:35 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
#include "MessageLooper.h"
|
2005-06-17 20:34:22 +04:00
|
|
|
#include "SubWindowList.h"
|
2005-06-24 08:01:16 +04:00
|
|
|
#include "BGet++.h"
|
2003-08-31 21:38:34 +04:00
|
|
|
|
2005-11-14 15:08:21 +03:00
|
|
|
#include <ObjectList.h>
|
2005-07-23 22:30:48 +04:00
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
|
2005-05-07 19:56:15 +04:00
|
|
|
class AreaPool;
|
2003-01-24 17:36:15 +03:00
|
|
|
class BMessage;
|
|
|
|
class BList;
|
2005-11-14 15:08:21 +03:00
|
|
|
class Desktop;
|
2005-11-04 18:23:54 +03:00
|
|
|
class DrawingEngine;
|
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;
|
2005-11-14 15:08:21 +03:00
|
|
|
class ServerWindow;
|
2003-01-24 17:36:15 +03:00
|
|
|
|
2005-06-15 01:28:56 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
class PortLink;
|
|
|
|
};
|
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
class ServerApp : public MessageLooper {
|
|
|
|
public:
|
2005-07-26 01:08:34 +04:00
|
|
|
ServerApp(Desktop* desktop, port_id clientAppPort,
|
|
|
|
port_id clientLooperPort, team_id clientTeamID,
|
|
|
|
int32 handlerID, const char* signature);
|
2005-07-23 22:30:48 +04:00
|
|
|
virtual ~ServerApp();
|
2005-06-23 21:40:35 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
status_t InitCheck();
|
|
|
|
void Quit(sem_id shutdownSemaphore = -1);
|
2005-06-23 21:40:35 +04:00
|
|
|
|
2005-07-26 01:08:34 +04:00
|
|
|
virtual bool Run();
|
|
|
|
virtual port_id MessagePort() const { return fMessagePort; }
|
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
/*!
|
|
|
|
\brief Determines whether the application is the active one
|
|
|
|
\return true if active, false if not.
|
|
|
|
*/
|
|
|
|
bool IsActive(void) const { return fIsActive; }
|
|
|
|
void Activate(bool value);
|
2005-06-23 21:40:35 +04:00
|
|
|
|
* the new input event dispatcher is now actually used, although it doesn't
distribute any messages to the clients yet.
* removed the working thread from RootLayer - for now, its event handlers are
still called using input filters in the new event dispatcher, though (to
get things started).
* ServerApp is now using a BMessenger to identify its client, and no longer
stores the port/token separately.
* the input_server handshake is a bit simpler now, as it can now just reply
to the app_server message, removed unused code from ServerProtocol.h
* calmed down the MultiLocker (it always printed thread statistics on startup,
because it's compiled in debug mode).
* removed the cursor thread stuff from AppServer.cpp
* the new event dispatcher now uses a cursor thread when supported (only in
native mode, not in the test environment), although it improves cursor
movement under Qemu, the effect is not as good as expected - this might
need some more investigations (might just be a thread priority problem).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15012 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-18 14:30:06 +03:00
|
|
|
void SendMessageToClient(BMessage* msg) const;
|
2005-06-23 22:48:10 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
void SetAppCursor(void);
|
2005-06-23 22:48:10 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
team_id ClientTeam() const;
|
|
|
|
const char *Signature() const { return fSignature.String(); }
|
2005-05-07 19:56:15 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
void RemoveWindow(ServerWindow* window);
|
2005-06-23 22:48:10 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
int32 CountBitmaps() const;
|
|
|
|
ServerBitmap *FindBitmap(int32 token) const;
|
2005-06-23 22:48:10 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
int32 CountPictures() const;
|
|
|
|
ServerPicture *FindPicture(int32 token) const;
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
AreaPool *AppAreaPool() { return &fSharedMem; }
|
2005-06-23 21:40:35 +04:00
|
|
|
|
2005-10-31 14:05:52 +03:00
|
|
|
Desktop* GetDesktop() const { return fDesktop; }
|
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
// ToDo: public?
|
|
|
|
SubWindowList fAppSubWindowList;
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
private:
|
|
|
|
virtual void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
|
|
|
virtual void _MessageLooper();
|
|
|
|
virtual void _GetLooperName(char* name, size_t size);
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
port_id fMessagePort;
|
|
|
|
port_id fClientReplyPort;
|
|
|
|
// our BApplication's event port
|
2005-06-08 08:01:59 +04:00
|
|
|
|
* the new input event dispatcher is now actually used, although it doesn't
distribute any messages to the clients yet.
* removed the working thread from RootLayer - for now, its event handlers are
still called using input filters in the new event dispatcher, though (to
get things started).
* ServerApp is now using a BMessenger to identify its client, and no longer
stores the port/token separately.
* the input_server handshake is a bit simpler now, as it can now just reply
to the app_server message, removed unused code from ServerProtocol.h
* calmed down the MultiLocker (it always printed thread statistics on startup,
because it's compiled in debug mode).
* removed the cursor thread stuff from AppServer.cpp
* the new event dispatcher now uses a cursor thread when supported (only in
native mode, not in the test environment), although it improves cursor
movement under Qemu, the effect is not as good as expected - this might
need some more investigations (might just be a thread priority problem).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15012 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-18 14:30:06 +03:00
|
|
|
BMessenger fClientMessenger;
|
2005-07-23 22:30:48 +04:00
|
|
|
port_id fClientLooperPort;
|
|
|
|
int32 fClientToken;
|
|
|
|
// To send a BMessage to the client (port + token)
|
2005-06-08 08:01:59 +04:00
|
|
|
|
2005-07-26 01:08:34 +04:00
|
|
|
Desktop* fDesktop;
|
2005-07-23 22:30:48 +04:00
|
|
|
BString fSignature;
|
|
|
|
team_id fClientTeam;
|
2005-06-23 22:48:10 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
BLocker fWindowListLock;
|
2005-11-14 15:08:21 +03:00
|
|
|
BObjectList<ServerWindow> fWindowList;
|
2005-06-23 21:40:35 +04:00
|
|
|
|
2005-07-23 22:30:48 +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 ?
|
|
|
|
BList fBitmapList;
|
|
|
|
BList fPictureList;
|
2005-06-23 21:40:35 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
ServerCursor *fAppCursor;
|
|
|
|
bool fCursorHidden;
|
2005-06-24 08:01:16 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
bool fIsActive;
|
2005-06-24 08:01:16 +04:00
|
|
|
|
2005-07-23 22:30:48 +04:00
|
|
|
AreaPool fSharedMem;
|
2003-01-24 17:36:15 +03:00
|
|
|
};
|
|
|
|
|
2005-06-15 01:28:56 +04:00
|
|
|
#endif // _SERVERAPP_H_
|