[Uim] Reorganization of helper API

TOKUNAGA Hiroyuki tkng at xem.jp
Sun Aug 7 13:33:56 EEST 2005


On Fri, 05 Aug 2005 19:26:14 +0900
YamaKen <yamaken at bp.iij4u.or.jp> wrote:

> At Wed, 3 Aug 2005 01:44:00 +0900,
> tkng at xem.jp wrote:
> > Following is a new message API proposal.
> 
> > int  uim_mbus_get_message_type(uim_mbus *mbus);
> > void uim_mbus_set_message_type(uim_mbus *mbus, int type);
> > void uim_mbus_add_message_type(uim_mbus *mbus, int type);
> > void uim_mbus_remove_message_type(uim_mbus *mbus, int type);
> > 
> >   There are several message types. Message bus dispatches messages
> >   according to the message type.
> 
> I guess that it is designed for filtering messages by type at
> the server process, instead of reflecting all messages to all
> processes as helper-server does. Is it correct?

Yes.


> If my recognition is correct, uim_mbus_add_message_type() and
> uim_mbus_remove_message_type() can naturally be understood in
> the filtering model. It configures that which types of messages
> are delivered to the client process. But I can't guess role of
> the rest two.
> 
> uim_mbus_get_message_type() seems strange since it can return
> only one type. It conflicts with the multiple type capability
> that the model implied by the add() and remove().

Get/set are fundamental, add/remove are utility. Here is an example of
rest get/set function.

  unsigned int type;
  type = uim_mbus_get_message_type(mbus);
  type |= UIM_MBUS_MESSAGE_TYPE_FOCUS;
  uim_mbus_set_message_type(mbus, type);

And, this code could be replaced with one line, 

  uim_mbus_add_message_type(mbus, UIM_MBUS_MESSAGE_TYPE_FOCUS);

Following is a definition of message types.

enum uim_mbus_message_type
{
  UIM_MBUS_MESSAGE_TYPE_STATUS  = (1 << 0),
  UIM_MBUS_MESSAGE_TYPE_INPUT   = (1 << 1),
  UIM_MBUS_MESSAGE_TYPE_SETTING = (1 << 2),
  UIM_MBUS_MESSAGE_TYPE_FOCUS   = (1 << 3)
}


> Ah, I've acquired a new guess by my words. The add() and
> remove() is not intended to configure filtering state for each
> connection, but to manage the set of type definition itself as
> like define() and undefine(). Is it the truth?

No.


Regards,

-- 
TOKUNAGA Hiroyuki
tkng at xem jp



More information about the uim mailing list