GTK IM KeyRelease Event problem.


   I am trying to develope an input method on X, and it need
key release event. It works fine with KDE applications, star office
6.0 and mozilla. However, it didn't works well with gtk application.
After examine, I think this is a gtk problem.

   According to the XIM, clients should get XNFilterEvents and
transfer all events request by IM to its event filter. In gtk
1.2.x, the Entry and Text did get the event mask and or
with its event mask. But after test, the IM will not get the
release event if the cursor is outside the Entry.

   The problem is in X-Window focus management. The X window
focus is in the top level window, and the top level window
didn't turn on KeyReleaseMask. According to X window key
event propagate rule, when cursor is in the Entry, it will
use the event mask of the client window, then the IM will
get key release event. If the cursor is outside the entry,
it will use the event mask of the focus window, then the IM
won't get key release event. In fact, GtkClist also have the
same problem. It respond different when cursor is in a Clist
and when the it is outside of a Clist.

   I think we can fix this by:
     1. Add KeyReleaseMask to top-level window when create
        GtkEntry/GtkText/GtkClist widget.
     2. Change the focus to Entry or Text when calling
   I'm not sure which one is better. Would you give us some
advice about this?

  P.S. I haven't test this in gtk 1.3.x, however, after examine
the code, I found new ICContext only support key press event for
IM. I don't know why, and I can't find discussion about this in
mailing-list archive. Any pointers about this?

Best Regards,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]