haiku/headers/private/app/MessagePrivate.h
Axel Dörfler 4ceb1e519c * reverted Adi's premature changes to BWindow and restored _DetermineTarget() and
task_looper() again.
* removed BMessenger::fPreferred - whenever you had to specify "usePreferred" separately,
  you don't have to do that anymore - use B_PREFERRED_TOKEN instead.
* fixed BTokenSpace::GetToken() semantics: it will no longer touch the "object" argument
  in case of failure.
* Introduced a BWindow::_DistributeMessage() that will be part of the event dispatcher
  counterpart to the app_server (the other will be _DetermineTarget()).
* Made it easier to use Michael's Message4 implementation: just add the following line
  to your UserBuildConfig:
	AppendToConfigVar DEFINES : HAIKU_TOP src : USING_MESSAGE4 : global ;
* Introduced ServerWindow::HandlerMessenger() and FocusMessenger() - the first will
  target the client handler, while the other will target the preferred handler of the
  client looper (usually the view having focus).
* Fixed dano message unflattening in the Message4 code.
* Changed BMessage::PrintToStream() to no longer use macros in the Message4 implementation.
* I hope that's all - it's a huge change, but it's all connected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15046 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-20 16:24:23 +00:00

76 lines
1.6 KiB
C++

//------------------------------------------------------------------------------
// MessagePrivate.h
//
//------------------------------------------------------------------------------
#ifdef USING_MESSAGE4
# include <MessagePrivate4.h>
#else
#ifndef MESSAGEPRIVATE_H
#define MESSAGEPRIVATE_H
#include <Message.h>
#include <Messenger.h>
#include <MessengerPrivate.h>
#include <TokenSpace.h>
class BMessage::Private {
public:
Private(BMessage* msg) : fMessage(msg) {;}
Private(BMessage& msg) : fMessage(&msg) {;}
inline void SetTarget(int32 token)
{
fMessage->fTarget = token;
fMessage->fPreferred = token == B_PREFERRED_TOKEN;
}
inline void SetReply(BMessenger messenger)
{
BMessenger::Private mp(messenger);
fMessage->fReplyTo.port = mp.Port();
fMessage->fReplyTo.target = mp.Token();
fMessage->fReplyTo.team = mp.Team();
fMessage->fReplyTo.preferred = mp.IsPreferredTarget();
}
inline int32 GetTarget()
{
return fMessage->fTarget;
}
inline bool UsePreferredTarget()
{
return fMessage->fPreferred;
}
static inline status_t SendFlattenedMessage(void *data, int32 size,
port_id port, int32 token, bigtime_t timeout)
{
return BMessage::_SendFlattenedMessage(data, size, port, token,
timeout);
}
static inline void StaticInit()
{
BMessage::_StaticInit();
}
static inline void StaticCleanup()
{
BMessage::_StaticCleanup();
}
static inline void StaticCacheCleanup()
{
BMessage::_StaticCacheCleanup();
}
private:
BMessage* fMessage;
};
#endif // MESSAGEPRIVATE_H
#endif // USING_MESSAGE4