[openi18n-im:01488] double key event issue

Federic Zhang <[email protected]> Fri, 22 Jul 2005 14:30:02 +0800
Newsgroups gmane.comp.internationalization.input-methods
Message-ID <[email protected]>
Hi,

The double key event issue
http://www.openi18n.org/cgi-bin/bugzilla/show_bug.cgi?id=99 with hot
language selection window got fixed with the patch, which i check-in
today.

-federic
iiim-dup-lang-selection.diff (text/x-patch, 969 B)
Index: iiimsf/src/IIIMP_hotkey.cpp
===================================================================
--- iiimsf/src/IIIMP_hotkey.cpp	(revision 2772)
+++ iiimsf/src/IIIMP_hotkey.cpp	(working copy)
@@ -337,10 +337,15 @@
     IIIMP_contents *pc = pmes->v.forward_event.contents;
     IIIMP_keyevent *piiimpkey = pc->value.keyevent_list->keyevent;
     int keycode = piiimpkey->keycode;
+    /* For Key Release Event */
+    bool is_key_release = piiimpkey->modifier & 0x80000000;
     int index = 0;
     IIIMP_message *p;
     int hotkey_id = 0;
 
+    /* just ignore key release event */
+    if (is_key_release) goto HOTKEY_MESSAGE_REPLY;
+
     hotkey_id = check_for_hotkey(hics, piiimpkey);
 
     if (hotkey_id) process_hotkey(hics, hotkey_id, 0);
@@ -382,6 +387,8 @@
        } 
        break;
     }
+
+HOTKEY_MESSAGE_REPLY:
     p = iiimp_forward_event_reply_new(hics->get_iiimptrans()->get_data_s(),
 				      hics->get_im_id(),
 				      hics->get_ic_id());