* 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
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
* Erik Jaesler ([email protected])
|
||||
* DarkWyrm <[email protected]>
|
||||
*/
|
||||
#ifdef USING_MESSAGE4
|
||||
# include <Message4.h>
|
||||
#else
|
||||
|
||||
#ifndef _MESSAGE_H
|
||||
#define _MESSAGE_H
|
||||
|
||||
@@ -309,20 +313,17 @@ virtual void _ReservedMessage3();
|
||||
|
||||
status_t _send_(port_id port,
|
||||
int32 token,
|
||||
bool preferred,
|
||||
bigtime_t timeout,
|
||||
bool reply_required,
|
||||
BMessenger &reply_to) const;
|
||||
status_t send_message(port_id port,
|
||||
team_id port_owner,
|
||||
int32 token,
|
||||
bool preferred,
|
||||
BMessage *reply,
|
||||
bigtime_t send_timeout,
|
||||
bigtime_t reply_timeout) const;
|
||||
static status_t _SendFlattenedMessage(void *data, int32 size,
|
||||
port_id port, int32 token, bool preferred,
|
||||
bigtime_t timeout);
|
||||
port_id port, int32 token, bigtime_t timeout);
|
||||
|
||||
static void _StaticInit();
|
||||
static void _StaticCleanup();
|
||||
@@ -429,3 +430,5 @@ static BBlockCache *sMsgCache;
|
||||
};
|
||||
|
||||
#endif // _MESSAGE_H
|
||||
#endif // USING_MESSAGE4
|
||||
|
||||
|
||||
+10
-10
@@ -9,7 +9,10 @@
|
||||
#ifndef _MESSAGE_H
|
||||
#define _MESSAGE_H
|
||||
|
||||
#define USING_MESSAGE4 1
|
||||
// this should be defined in your UserBuildConfig only
|
||||
#ifndef USING_MESSAGE4
|
||||
# define USING_MESSAGE4 1
|
||||
#endif
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <DataIO.h>
|
||||
@@ -39,8 +42,7 @@ extern "C" int _delete_message_();
|
||||
#define B_FIELD_NAME_LENGTH 255
|
||||
#define B_PROPERTY_NAME_LENGTH 255
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
B_NO_SPECIFIER = 0,
|
||||
B_DIRECT_SPECIFIER = 1,
|
||||
B_INDEX_SPECIFIER,
|
||||
@@ -304,15 +306,13 @@ virtual void _ReservedMessage1();
|
||||
virtual void _ReservedMessage2();
|
||||
virtual void _ReservedMessage3();
|
||||
|
||||
status_t _SendMessage(port_id port, int32 token, bool preferred,
|
||||
bigtime_t timeout, bool replyRequired,
|
||||
BMessenger &replyTo) const;
|
||||
status_t _SendMessage(port_id port, int32 token, bigtime_t timeout,
|
||||
bool replyRequired, BMessenger &replyTo) const;
|
||||
status_t _SendMessage(port_id port, team_id portOwner,
|
||||
int32 token, bool preferred, BMessage *reply,
|
||||
bigtime_t sendTimeout, bigtime_t replyTimeout) const;
|
||||
int32 token, BMessage *reply, bigtime_t sendTimeout,
|
||||
bigtime_t replyTimeout) const;
|
||||
static status_t _SendFlattenedMessage(void *data, int32 size,
|
||||
port_id port, int32 token, bool preferred,
|
||||
bigtime_t timeout);
|
||||
port_id port, int32 token, bigtime_t timeout);
|
||||
|
||||
static void _StaticInit();
|
||||
static void _StaticCleanup();
|
||||
|
||||
+12
-46
@@ -1,52 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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: Messenger.h
|
||||
// Author: Ingo Weinhold ([email protected])
|
||||
// Description: BMessenger delivers messages to local or remote targets.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Ingo Weinhold ([email protected])
|
||||
*/
|
||||
#ifndef _MESSENGER_H
|
||||
#define _MESSENGER_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <OS.h>
|
||||
#include <ByteOrder.h>
|
||||
#include <Message.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BHandler;
|
||||
class BLooper;
|
||||
|
||||
// BMessenger class ------------------------------------------------------------
|
||||
|
||||
class BMessenger {
|
||||
public:
|
||||
BMessenger();
|
||||
@@ -90,21 +61,16 @@ public:
|
||||
|
||||
private:
|
||||
friend class Private;
|
||||
|
||||
void SetTo(team_id team, port_id port, int32 token, bool preferred);
|
||||
|
||||
void InitData(const char *signature, team_id team, status_t *result);
|
||||
void _SetTo(team_id team, port_id port, int32 token);
|
||||
void _InitData(const char *signature, team_id team, status_t *result);
|
||||
|
||||
private:
|
||||
port_id fPort;
|
||||
int32 fHandlerToken;
|
||||
team_id fTeam;
|
||||
int32 extra0;
|
||||
int32 extra1;
|
||||
bool fPreferredTarget;
|
||||
bool extra2;
|
||||
bool extra3;
|
||||
bool extra4;
|
||||
|
||||
int32 _reserved[3];
|
||||
};
|
||||
|
||||
_IMPEXP_BE bool operator<(const BMessenger &a, const BMessenger &b);
|
||||
|
||||
@@ -294,53 +294,23 @@ private:
|
||||
int32 bitmapToken = -1);
|
||||
status_t ArchiveChildren(BMessage* data, bool deep) const;
|
||||
status_t UnarchiveChildren(BMessage* data);
|
||||
void BitmapClose(); // to be implemented
|
||||
virtual void task_looper(); // thread function - it's here where app_server messages are received
|
||||
/* void start_drag( BMessage* msg,
|
||||
int32 token,
|
||||
BPoint offset,
|
||||
BRect track_rect,
|
||||
BHandler* reply_to);
|
||||
void start_drag( BMessage* msg,
|
||||
int32 token,
|
||||
BPoint offset,
|
||||
int32 bitmap_token,
|
||||
drawing_mode dragMode,
|
||||
BHandler* reply_to);
|
||||
*/
|
||||
void BitmapClose(); // to be implemented
|
||||
virtual void task_looper();
|
||||
void prepareView(BView* aView);
|
||||
void attachView(BView* aView);
|
||||
void detachView(BView* aView);
|
||||
//int32 get_server_token() const;
|
||||
BMessage *extract_drop(BMessage* an_event, BHandler* *target);
|
||||
//void movesize(uint32 opcode, float h, float v);
|
||||
|
||||
//int32 MessagesWaiting();
|
||||
|
||||
void handle_activate(BMessage* an_event);
|
||||
//void do_view_frame(BMessage* an_event);
|
||||
//void do_value_change(BMessage* an_event, BHandler* handler);
|
||||
//void do_mouse_down(BMessage* an_event, BView* target);
|
||||
//void do_mouse_moved(BMessage* an_event, BView* target);
|
||||
//void do_key_down(BMessage* an_event, BHandler* handler);
|
||||
//void do_key_up(BMessage* an_event, BHandler* handler);
|
||||
void do_menu_event(BMessage* an_event);
|
||||
//void do_draw_views();
|
||||
virtual BMessage *ConvertToMessage(void* raw, int32 code);
|
||||
//_cmd_key_ *allocShortcut(uint32 key, uint32 modifiers);
|
||||
//_cmd_key_ *FindShortcut(uint32 key, uint32 modifiers);
|
||||
void AddShortcut(uint32 key, // !!! - and menu shortcuts to list when a menu is added
|
||||
uint32 modifiers,
|
||||
BMenuItem* item);
|
||||
//void post_message(BMessage* message);
|
||||
//void SetLocalTitle(const char* new_title);
|
||||
//void enable_pulsing(bool enable);
|
||||
//void kb_navigate();
|
||||
//void navigate_to_next(int32 direction, bool group = false);
|
||||
//void set_focus(BView* focus, bool notify_input_server); // what does notify_input_server mean??? why???
|
||||
|
||||
void AddShortcut(uint32 key, uint32 modifiers,
|
||||
BMenuItem* item);
|
||||
BHandler* _DetermineTarget(BMessage* message, BHandler* target);
|
||||
bool _DistributeMessage(BMessage* message);
|
||||
|
||||
bool InUpdate();
|
||||
void DequeueAll();
|
||||
//bool find_token_and_handler(BMessage* msg, int32* token, BHandler* *handler);
|
||||
window_type _ComposeType(window_look look,
|
||||
window_feel feel) const;
|
||||
void _DecomposeType(window_type type,
|
||||
@@ -354,11 +324,9 @@ private:
|
||||
void setFocus(BView *focusView, bool notifyIputServer = false);
|
||||
|
||||
Shortcut* _FindShortcut(uint32 key, uint32 modifiers);
|
||||
bool findHandler(BView* start, BHandler* handler);
|
||||
BView* findView(BView* aView, const char* viewName) const;
|
||||
BView* findView(BView* aView, BPoint point) const;
|
||||
BView* findView(BView* aView, int32 token);
|
||||
BView* findLastChild(BView *parent);
|
||||
BView* _FindView(BView* view, BPoint point) const;
|
||||
BView* _FindView(int32 token);
|
||||
BView* _LastViewChild(BView *parent);
|
||||
|
||||
BView* _FindNextNavigable(BView *focus, uint32 flags);
|
||||
BView* _FindPreviousNavigable(BView *focus, uint32 flags);
|
||||
|
||||
Reference in New Issue
Block a user