[Uim] Reorganization of helper API

TOKUNAGA Hiroyuki tkng at xem.jp
Tue Aug 2 19:44:00 EEST 2005


Now I'm concidering improvement of helper API of uim.

At fisrt, now helper API has three problems:

1. The word 'helper' is not intuitive.
2. Apply of uim-pref is quite heavy.
3. Each input mode switch cuases some amout of inter process
   communication for each process.

To solve 1, I propose new name for API, 'message API'. In addition,
this means we don't change helper API, so maybe we can keep backward
compatibility completely.

In the new message API, instead of helper-server, message-bus is used.
message bus is a process to relay inter process communications.

I concidered use of dbus, but I concluded that dbus seems not suitable
for our purpose.


Following is a new message API proposal.

uim_mbus *uim_mbus_new(char *path);

  returns a new message bus object. If message bus is not exist, then
  automatically execute that. Argument is a path for socket.


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.

Now I'm assuming these four message types.

   * status:messages related on input status. Toolbar should receive this
     type.

   * input:Input from other processes. The process which have focused
     context (or lastly focused context) should receive this type.

   * setting:Change of settings. All processes except preference tool itself
     should receive this type.

   * focus: Focus related message. The process which have focused
     context (or lastly focused context) should receive this type.


char *uim_mbus_get_message(uim_mbus *mbus, int *type);

   If message is already received, return 1 message. If no message
   arrived, then return NULL. type is a pointer to message type.

void uim_mbus_send_message(uim_mbus *mbus, int type, char *message):

   send a message.


uim_mbus_set_callback(uim_mbus *mbus, callback_func)

   set callback function. callback function will be called if message was
   received. i.e. in callback function, messages sould be processed.



Any comments are welcome. I hope we can implement this API in uim 0.5
series.


Regards,

--
TOKUNAGA Hiroyuki
tkng at xem jp



More information about the uim mailing list