* cleaned up ServerApp header a bit

* added support for nested cursor showing/hiding


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15926 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2006-01-12 11:59:24 +00:00
parent cf6fe303d6
commit df19082398
2 changed files with 80 additions and 72 deletions
+9 -9
View File
@@ -91,7 +91,7 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
fClientTeam(clientTeam), fClientTeam(clientTeam),
fWindowListLock("window list"), fWindowListLock("window list"),
fAppCursor(NULL), fAppCursor(NULL),
fCursorHidden(false), fCursorHideLevel(0),
fIsActive(false), fIsActive(false),
fSharedMem("shared memory", 32768) fSharedMem("shared memory", 32768)
{ {
@@ -303,7 +303,7 @@ ServerApp::SetAppCursor()
// if (fAppCursor) // if (fAppCursor)
// fDesktop->HWInterface()->SetCursor(fAppCursor); // fDesktop->HWInterface()->SetCursor(fAppCursor);
fDesktop->HWInterface()->SetCursorVisible(!fCursorHidden); fDesktop->HWInterface()->SetCursorVisible(fCursorHideLevel == 0);
} }
@@ -861,17 +861,17 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_SHOW_CURSOR: case AS_SHOW_CURSOR:
{ {
STRACE(("ServerApp %s: Show Cursor\n", Signature())); STRACE(("ServerApp %s: Show Cursor\n", Signature()));
// TODO: support nested showing/hiding fCursorHideLevel--;
fDesktop->HWInterface()->SetCursorVisible(true); if (fCursorHideLevel < 0)
fCursorHidden = false; fCursorHideLevel = 0;
fDesktop->HWInterface()->SetCursorVisible(fCursorHideLevel == 0);
break; break;
} }
case AS_HIDE_CURSOR: case AS_HIDE_CURSOR:
{ {
STRACE(("ServerApp %s: Hide Cursor\n", Signature())); STRACE(("ServerApp %s: Hide Cursor\n", Signature()));
// TODO: support nested showing/hiding fCursorHideLevel++;
fDesktop->HWInterface()->SetCursorVisible(false); fDesktop->HWInterface()->SetCursorVisible(fCursorHideLevel == 0);
fCursorHidden = true;
break; break;
} }
case AS_OBSCURE_CURSOR: case AS_OBSCURE_CURSOR:
@@ -883,7 +883,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_QUERY_CURSOR_HIDDEN: case AS_QUERY_CURSOR_HIDDEN:
{ {
STRACE(("ServerApp %s: Received IsCursorHidden request\n", Signature())); STRACE(("ServerApp %s: Received IsCursorHidden request\n", Signature()));
fLink.StartMessage(fCursorHidden ? B_OK : B_ERROR); fLink.StartMessage(fCursorHideLevel > 0 ? B_OK : B_ERROR);
fLink.Flush(); fLink.Flush();
break; break;
} }
+18 -10
View File
@@ -38,9 +38,12 @@ namespace BPrivate {
class ServerApp : public MessageLooper { class ServerApp : public MessageLooper {
public: public:
ServerApp(Desktop* desktop, port_id clientAppPort, ServerApp(Desktop* desktop,
port_id clientLooperPort, team_id clientTeamID, port_id clientAppPort,
int32 handlerID, const char* signature); port_id clientLooperPort,
team_id clientTeamID,
int32 handlerID,
const char* signature);
virtual ~ServerApp(); virtual ~ServerApp();
status_t InitCheck(); status_t InitCheck();
@@ -56,9 +59,9 @@ class ServerApp : public MessageLooper {
bool IsActive(void) const { return fIsActive; } bool IsActive(void) const { return fIsActive; }
void Activate(bool value); void Activate(bool value);
void SendMessageToClient(BMessage* msg) const; void SendMessageToClient(BMessage* message) const;
void SetAppCursor(void); void SetAppCursor();
team_id ClientTeam() const; team_id ClientTeam() const;
const char* Signature() const { return fSignature.String(); } const char* Signature() const { return fSignature.String(); }
@@ -83,10 +86,12 @@ class ServerApp : public MessageLooper {
BPrivate::BTokenSpace& ViewTokens() { return fViewTokens; } BPrivate::BTokenSpace& ViewTokens() { return fViewTokens; }
private: private:
virtual void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link); virtual void _DispatchMessage(int32 code,
BPrivate::LinkReceiver& link);
virtual void _MessageLooper(); virtual void _MessageLooper();
virtual void _GetLooperName(char* name, size_t size); virtual void _GetLooperName(char* name, size_t size);
status_t _CreateWindow(int32 code, BPrivate::LinkReceiver& link, status_t _CreateWindow(int32 code,
BPrivate::LinkReceiver& link,
port_id& clientReplyPort); port_id& clientReplyPort);
port_id fMessagePort; port_id fMessagePort;
@@ -96,7 +101,8 @@ class ServerApp : public MessageLooper {
BMessenger fHandlerMessenger; BMessenger fHandlerMessenger;
port_id fClientLooperPort; port_id fClientLooperPort;
int32 fClientToken; int32 fClientToken;
// To send a BMessage to the client (port + token) // To send a BMessage to the client
// (port + token)
Desktop* fDesktop; Desktop* fDesktop;
BString fSignature; BString fSignature;
@@ -108,14 +114,16 @@ class ServerApp : public MessageLooper {
int32 fInitialWorkspace; int32 fInitialWorkspace;
// NOTE: Bitmaps and Pictures are stored globally, but ServerApps remember
// which ones they own so that they can destroy them when they quit.
// TODO: // 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 ? // - As we reference these stuff by token, what about putting them in hash tables ?
BList fBitmapList; BList fBitmapList;
BList fPictureList; BList fPictureList;
ServerCursor* fAppCursor; ServerCursor* fAppCursor;
bool fCursorHidden; int32 fCursorHideLevel;
// 0 = cursor visible
bool fIsActive; bool fIsActive;