[openi18n-im:01489] iiimx patch to enable key release event
Federic Zhang <[email protected]> Mon, 25 Jul 2005 17:00:08 +0800
| Newsgroups | gmane.comp.internationalization.input-methods |
|---|---|
| Message-ID | <[email protected]> |
Hi, Attached is the patch to enable key release event in IIIMXCF side, please review and give feedback, i will commit if nobody objects. Note that i don't change IIIMCF_keyevent_To_XKeyEvent in KeyMap.c because only key press event will be sent back from server with iml_make_keypress_inst if the key isn't consumed by LE. To verify whether release event is sent via iiimx to server or not, the client should be able to send both press and release event, for Gtk+ app, please use the attached gtk patch which forces filter_key_release, which is just used for verification, rebuild im-xim.so and copy to /usr/lib/gtk-2.0/<version>/immodules. -federic
iiim-xim-key-release.diff
(text/x-patch, 1.7 KB)
Index: iiimxcf/xiiimp.so/iiimp/iiimpIC.c
===================================================================
--- iiimxcf/xiiimp.so/iiimp/iiimpIC.c (revision 2781)
+++ iiimxcf/xiiimp.so/iiimp/iiimpIC.c (working copy)
@@ -247,7 +247,11 @@
return False;
}
- if (KeyRelease == ev->xkey.type) {
+ /*
+ * Comment the codes below - FIXME
+ * Key release event should be forwarded with IMForwardEvent to server
+ */
+ if (0 && KeyRelease == ev->xkey.type) {
XIMCallback *cb = &ic->forward_event_callback;
if (NULL != cb->callback) {
(*cb->callback)((XIC)ic, cb->client_data, (XPointer)ev);
Index: iiimxcf/xiiimp.so/iiimp/KeyMap.c
===================================================================
--- iiimxcf/xiiimp.so/iiimp/KeyMap.c (revision 2781)
+++ iiimxcf/xiiimp.so/iiimp/KeyMap.c (working copy)
@@ -1171,6 +1171,9 @@
}
pkev->modifier = state;
+ /* Set mask with 0x80000000 to indicate the event is key release event */
+ if (ev->type == KeyRelease)
+ pkev->modifier |= 0x80000000;
len = XLookupString(ev, buf, len - 1, &keysym, NULL);
Index: iiimxcf/htt_xbe/lib/IMdkit/r6im/R6IMProtocol.cpp
===================================================================
--- iiimxcf/htt_xbe/lib/IMdkit/r6im/R6IMProtocol.cpp (revision 2781)
+++ iiimxcf/htt_xbe/lib/IMdkit/r6im/R6IMProtocol.cpp (working copy)
@@ -208,8 +208,7 @@
styles.supported_styles = &my_styles2[0];
}
- unsigned long filter_events = KeyPressMask;
- // unsigned long filter_events = KeyPressMask | KeyReleaseMask;
+ unsigned long filter_events = KeyPressMask | KeyReleaseMask;
int n = 0;
args[n].name = (char*)IMServerName; args[n].value = im_name; n++;
gtk-key-release.diff
(text/x-patch, 609 B)
diff -urN gtk+-2.4.14.orig/modules/input/gtkimcontextxim.c gtk+-2.4.14/modules/input/gtkimcontextxim.c --- gtk+-2.4.14.orig/modules/input/gtkimcontextxim.c 2005-07-25 16:52:26.782613064 +0800 +++ gtk+-2.4.14/modules/input/gtkimcontextxim.c 2005-07-25 16:53:08.080334856 +0800 @@ -1435,7 +1435,8 @@ XGetICValues (xic, XNFilterEvents, &mask, NULL); - context_xim->filter_key_release = (mask & KeyReleaseMask) != 0; + // context_xim->filter_key_release = (mask & KeyReleaseMask) != 0; + context_xim->filter_key_release = True; set_string_conversion_callback (context_xim, xic); }