[interfacekit] BApplication, ...

  • From: "Ingo Weinhold" <bonefish@xxxxxxxxxxxxxxx>
  • To: "Interface Kit List" <interfacekit@xxxxxxxxxxxxx>
  • Date: Fri, 28 Jun 2002 23:16:32 CEST (+0200)

Hi,

I've finally looked through the other registrar related classes and 
made some notes similar to the ones about BRoster. Since these classes 
have a lot of functionality that has nothing to do with the registrar, 
I annotated only the interesting functions.

Regarding the TokenSpace stuff I wrote in one of my last mails, about 
fixed tokens for applications. Nonsense. I obviously didn't realize, 
that, when the preferred handler is targeted by a message, the token is 
ignored. I had a look at the current BLooper/BHandler/TokenSpace 
implementation and that looks good to me.

Another thing I'm not certain about: D&D is handled by the app server, 
isn't it?

So, what next?
I believe, now I have a pretty good overview over all the things 
involved with the registrar business and hope my mails where helpful 
concerning this for you too. I had already written a mail with a rough 
design idea and it still looks OK to me. So I think, I will meditate 
one or two days about the matter -- which gives you some time to reply, 
if you feel like that -- and then come up with a road map for the 
implementation.

How does that sound to you?

CU, Ingo


=======================================================================
BApplication
-----------------------------------------------------------------------

BMessageRunner  *fPulseRunner;

* That does finally answer the question where the B_PULSE messages come 
from. :-)

-----------------------------------------------------------------------

BApplication(const char *signature);
BApplication(const char *signature, status_t *error);

* InitData()

-----------------------------------------------------------------------

virtual ~BApplication();

* Unregisters from the roster, if necessary: BRoster::RemovePreRegApp()
* Does some cleanup, e.g. deleting be_app_messenger, be_roster... and 
setting those variables to NULL.

-----------------------------------------------------------------------

BApplication(BMessage *data);
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;

* BeBook: "The archive constructor is an implementation detail...". Oh, 
that's good. I was afraid, it could be complicated. ;-)
* I guess, Archive() archives all windows (loopers?) and adds the app's 
signature (and entry_ref?). Thus unarchiving means to init the app as 
usual (with the signature from the archive) and instantiate the windows 
thereafter.

-----------------------------------------------------------------------

virtual thread_id               Run();
virtual void                    Quit();
virtual bool                    QuitRequested();
virtual void                    ArgvReceived(int32 argc, char **argv);
virtual void                    RefsReceived(BMessage *a_message);
virtual void                    ReadyToRun();

* Run() has to complete the registration with the registrar and it then 
enters the message loop.
* The first messages the app servers sends are B_ARGV_RECEIVED, 
B_REFS_RECEIVED and finally B_READY_TO_RUN. They cause the respective 
hooks to be called.
* Quit() unregisters the application from the roster: 
BRoster::RemoveApp()
* QuitRequested() should work straight forward as described in the 
BeBook.

-----------------------------------------------------------------------

bool                    IsLaunching() const;

* !fReadyToRunCalled

-----------------------------------------------------------------------

status_t                GetAppInfo(app_info *info) const;

* As written in the BeBook:
  be_roster>GetRunningAppInfo(be_app->Team(), info);

-----------------------------------------------------------------------

void                    run_task();

* Just runs into the message loop?

-----------------------------------------------------------------------

void                    InitData(const char *signature, status_t *error);

* Does the work for the constructors: calls _init_roster_ (and other 
_init_*s, like _init_message_()?), does the registration with the 
roster (BRoster::AddApplication()) and the initialization of the global 
variables be_app, be_app_messenger, be_roster.

-----------------------------------------------------------------------

void                    do_argv(BMessage *msg);

* Puts argv into a message? Does anyone know, where to get them from? 
Is there a global variable or a function?

-----------------------------------------------------------------------

static  int32                   async_quit_entry(void *);

* ???
* Mmh, has the signature of a thread entry function. Perhaps a new 
thread is spawned to quit the application???

-----------------------------------------------------------------------


=======================================================================
BClipboard
-----------------------------------------------------------------------

BClipboard(const char *name, bool transient = false);

* Initializes (among other things) fClipHandler:
  send:
  - to:                 roster (BRoster::fMess)
  - message:    REG_GET_CLIPBOARD_MESSENGER
  - reply:              B_SIMPLE_DATA, "messenger": B_MESSENGER_TYPE
* DownloadFromSystem()

-----------------------------------------------------------------------

uint32          SystemCount() const;

* send:
  - to:                 fClipHandler
  - message:    REG_GET_CLIPBOARD_COUNT
  - reply:              B_SIMPLE_DATA, "count": B_UINT32_TYPE

-----------------------------------------------------------------------

status_t        StartWatching(BMessenger target);
status_t        StopWatching(BMessenger target);

* use BRoster::_Start/_StopWatching()???
* send:
  - to:                 fClipHandler
  - message:    REG_CLIPBOARD_START/STOP_WATCHING,
                                "target": B_MESSENGER_TYPE
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE

-----------------------------------------------------------------------

status_t        Commit();
status_t        Revert();

* UploadToSystem()/DownloadFromSystem()

-----------------------------------------------------------------------

status_t        DownloadFromSystem(bool force = false);

* What does force mean?
* send:
  - to:                 fClipHandler
  - message:    REG_DOWNLOAD_CLIPBOARD, "name": B_STRING_TYPE
  - reply:              B_SIMPLE_DATA, "data": B_MESSAGE_TYPE,
                                "data source": B_MESSENGER_TYPE,
                                "result": B_INT32_TYPE

-----------------------------------------------------------------------

status_t        UploadToSystem();

* send:
  - to:                 fClipHandler
  - message:    REG_UPLOAD_CLIPBOARD, "name": B_STRING_TYPE,
                                "data": B_MESSAGE_TYPE,
                                "data source": B_MESSENGER_TYPE
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE

-----------------------------------------------------------------------


=======================================================================
BMessageRunner
-----------------------------------------------------------------------

BMessageRunner(BMessenger target, const BMessage *msg,
                                bigtime_t interval, int32 count = -1);  
BMessageRunner(BMessenger target, const BMessage *msg,
                                bigtime_t interval, int32 count, BMessenger 
reply_to);  

* InitData()

-----------------------------------------------------------------------

virtual                         ~BMessageRunner();

* send:
  - to:                 roster (BRoster::fMess)
  - message:    REG_REMOVE_MSG_RUNNER, "token": B_INT32_TYPE
  - no reply

-----------------------------------------------------------------------

status_t        SetInterval(bigtime_t interval);
status_t        SetCount(int32 count);

* SetParams()

-----------------------------------------------------------------------

status_t        GetInfo(bigtime_t *interval, int32 *count) const;

* send:
  - to:                 roster (BRoster::fMess)
  - message:    REG_GET_MSG_RUNNER_PARAMS, "token": B_INT32_TYPE
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE,
                                "interval": B_INT64_TYPE, "count": B_INT32_TYPE

-----------------------------------------------------------------------

void            InitData(BMessenger target, const BMessage *msg,
                                bigtime_t interval, int32 count, BMessenger 
reply_to);  

* send:
  - to:                 roster (BRoster::fMess)
  - message:    REG_ADD_MSG_RUNNER, "target": B_MESSENGER_TYPE,
                                "message": B_MESSAGE_TYPE,
                                "interval": B_INT64_TYPE, "count": B_INT32_TYPE,
                                [ "reply to": B_MESSENGER_TYPE ]
  - reply:              B_SIMPLE_DATA, "token": B_INT32_TYPE

-----------------------------------------------------------------------

status_t        SetParams(bool reset_i, bigtime_t interval,
                                bool reset_c, int32 count);

* send:
  - to:                 roster (BRoster::fMess)
  - message:    REG_SET_MSG_RUNNER_PARAMS, "token": B_INT32_TYPE,
                                [ "interval": B_INT64_TYPE ], ["count": 
B_INT32_TYPE ]
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE

-----------------------------------------------------------------------


=======================================================================
BMessenger
-----------------------------------------------------------------------

BMessenger(const char *mime_sig, 
                        team_id team = -1,
                        status_t *perr = NULL);

* InitData()

-----------------------------------------------------------------------

void            InitData(const char *mime_sig,
                                        team_id team,
                                        status_t *perr);

* BRoster::TeamFor() (if team < 0)
* BRoster::GetRunningAppInfo()

-----------------------------------------------------------------------


=======================================================================
BMimeType
-----------------------------------------------------------------------

status_t        Install();
status_t        Delete();

* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_MIME_INSTALL/DELETE, "type": B_STRING_TYPE
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE

-----------------------------------------------------------------------

status_t        GetSupportingApps(BMessage *signatures) const;

* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_MIME_GET_SUPPORTING_APPS, "type": B_STRING_TYPE
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE,
                                "signatures": B_STRING_TYPE[]

-----------------------------------------------------------------------

status_t        SetIcon(const BBitmap *icon, icon_size);
status_t        SetPreferredApp(const char *signature,
                                                        app_verb verb = B_OPEN);
status_t        SetAttrInfo(const BMessage *info);
status_t        SetFileExtensions(const BMessage *extensions);
status_t        SetShortDescription(const char *description);
status_t        SetLongDescription(const char *description);
status_t        SetAppHint(const entry_ref *ref);
status_t        SetIconForType(const char *type,
                                                const BBitmap *icon,
                                                icon_size which);
status_t        SetSnifferRule(const char *);
status_t        SetSupportedTypes(const BMessage *types);

* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_MIME_SET_PARAM, "which": B_INT32_TYPE,
                                "type": B_STRING_TYPE,...
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE

  - additional message fields depending on "which":
        REG_MIME_ICON:                          "icon": B_RAW_TYPE,
                                                                "size": 
B_INT32_TYPE
        REG_MIME_PREFERRED_APP:         "signature": B_STRING_TYPE,
                                                                "app verb": 
B_INT32_TYPE
        REG_MIME_ATTR_INFO:                     "attr info": B_MESSAGE_TYPE
        REG_MIME_FILE_EXTENSIONS:       "extensions": B_STRING_TYPE[]
        REG_MIME_DESCRIPTION:           "long": B_BOOL_TYPE,
                                                                "description": 
B_STRING_TYPE
        REG_MIME_SNIFFER_RULE:          "sniffer rule": B_STRING_TYPE
        REG_MIME_APP_HINT:                      "app hint": B_REF_TYPE
        REG_MIME_ICON_FOR_TYPE          "file type": B_STRING_TYPE,
                                                                "icon": 
B_RAW_TYPE,
                                                                "size": 
B_INT32_TYPE
        REG_MIME_SUPPORTED_TYPES:       "types": B_STRING_TYPE[]

-----------------------------------------------------------------------

static  status_t        GetInstalledSupertypes(BMessage *super_types);

* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_MIME_GET_INSTALLED_SUPERTYPES
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE,
                                "types": B_STRING_TYPE[]

-----------------------------------------------------------------------

static  status_t        GetInstalledTypes(BMessage *types);
static  status_t        GetInstalledTypes(const char *super_type,
                                                        BMessage *subtypes);

* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_MIME_GET_INSTALLED_TYPES,
                                [ "super type": B_STRING_TYPE ]
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE,
                                "types": B_STRING_TYPE[]

-----------------------------------------------------------------------

static  status_t        GetWildcardApps(BMessage *wild_ones);

* GetSupportingApps()

-----------------------------------------------------------------------

static  status_t        GuessMimeType(const entry_ref *file, BMimeType *
result);
static  status_t        GuessMimeType(const void *buffer, int32 length, 
BMimeType *result);
static  status_t        GuessMimeType(const char *filename, BMimeType *
result);

* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_MIME_SNIFF,
                                "ref": B_REF_TYPE | "data": B_RAW_TYPE
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE,
                                "type": B_STRING_TYPE

-----------------------------------------------------------------------

static  status_t        StartWatching(BMessenger target);
static  status_t        StopWatching(BMessenger target);

* use BRoster::_Start/_StopWatching()
* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_MIME_START/STOP_WATCHING,
                                "target": B_MESSENGER_TYPE
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE

-----------------------------------------------------------------------

static  void            _set_local_dispatch_target_(BMessenger *, void (*
)(BMessage *));

* ???

-----------------------------------------------------------------------

void        _touch_(); 

* ???

-----------------------------------------------------------------------

void            MimeChanged(int32 w, const char *type = NULL,
                                bool large = true) const;

* I suppose, that this is a helper function for BAppFileInfo. When a 
parameter is changed in the app file's attributes/resources, then this 
method is called to notify the registrar.

* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_MIME_CHANGED, "which": B_INT32_TYPE,
                                [ "type": B_STRING_TYPE ], [ "large": 
B_BOOL_TYPE ]
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE

-----------------------------------------------------------------------

int     update_mime_info(const char *path,
                                        int recursive,
                                        int synchronous,
                                        int force);

* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_UPDATE_MIME_INFO, "path": B_STRING_TYPE,
                                "recursive": B_BOOL_TYPE,
                                "force": B_BOOL_TYPE
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE

-----------------------------------------------------------------------

status_t create_app_meta_mime(const char *path,
                                                        int recursive,
                                                        int synchronous,
                                                        int force);

* send:
  - to:                 main mime (BRoster::fMimeMess)
  - message:    REG_CREATE_APP_META_MIME, "path": B_STRING_TYPE,
                                "recursive": B_BOOL_TYPE,
                                "force": B_BOOL_TYPE
  - reply:              B_SIMPLE_DATA, "result": B_INT32_TYPE

-----------------------------------------------------------------------




Other related posts: