Hello,

I have a problem about the implementation of "XIM server termination"
and would like to hear about your comments.

We know that in X11R6, it added a mechanism to terminate the XIM server
without affect the still running XIM client. More explicitly, when the
XIM server stops running, the Xlib will call a "xim destroy callback"
function of the XIM clients to tell them that the XIM server is not
available. So that the XIM clients will not access the XIM server any
more, and everything runs happy.

However, the real situation is much more complicated. Suppose that a
XIM server and a XIM client is under connection with the OverTheSpot
input method style. We know that under this style, essentially the
XIM client has to report its current cursor location (which, I call
it the "spot_location") to the XIM server everytime when its cursor
moves. In fact, I found many XIM clients implement this in the way
that: everytime when the XIM client processed a X event or need to
redraw its window, it will report its spot_location. The method to
report its spot_location is via calling the XSetICValues() function.
This function will send a synchronized XIM request to the XIM server
and will always wait for the reply from the server. If the XIM server
does not reply, the XIM client will just hang.

Now consider the following situation. Both XIM server/client are
operating with the OverTheSpot style. If we want to terminate the
XIM server, one way is moving our mouse and click the "kill" buttom
of the XIM server window (this buttom is, of course, provided by the
Window manager). Before clicking the foreground window is the XIM
client window. At the moment of clicking the foreground window changes
to the XIM server window. Finally after the XIM server being killed
by the window manager, the foreground window comes back to be the
XIM client window. The point is that when the XIM client window becomes
foreground again, it receives X events and will send its spot_location.
However, at the moment it may not know that the XIM server is being
killing, or has been killed, because the Xlib may not call its "xim
destroy callback" function in time to tell it. In fact, due to the
X event queue of Xlib, usually the XIM client will send the spot_location
first, wait for the reply of XIM server, and finally its "xim destroy
callback" function will be called. However, the reply of the XIM server
will never come, because it is already killed.

This is the major problem I encountered. In theory, when XIM server is
going to be killed, it should wait for a while to ensure that every
XIM client has been informed (i.e., their "xim destroy callback" functions
have been called by Xlib), and then it actually exit. But I don't know
how to do that. I have tried that let XIM server send a XIM_SYNC event
to the XIM client and wait for its reply. If it replys, then "assume"
that the XIM client has been informed that the server is being killing,
so the server can exit. But this is still not save, because we can not
expect that the Xlib will always inform the XIM client first, and then
transfer the XIM_SYNC reply back to the XIM server.

So, is there any comment or good ideas to resolve this problem? :-))


Thanks very much for your reply in advance. :-))


T.H.Hsieh


ps. A typical example of the above situation is:
    XIM server:  xcin:  http://xcin.linux.org.tw
                (I am working hard on it to resolve this problem)
    XIM client:  rxvt:  http://www.rxvt.org

    And, you can imagine, if the user wants to logout from their desktop
    environment, say, kde or gnome, all the XIM server/clients will be
    killed immediately, then the situation will become worse.
_______________________________________________
I18n mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/i18n

Reply via email to