[openi18n-im:01459] Re: key release issue with iiimxcf
AShiZaWa KaZuNoRi <[email protected]> Fri, 08 Jul 2005 15:01:45 +0900
| Newsgroups | gmane.comp.internationalization.input-methods |
|---|---|
| Message-ID | <[email protected]> |
Date: Fri, 08 Jul 2005 14:06:44 +0800 From: Federic Zhang <[email protected]>: > > Thanks for your commit. Can you post it in patch format? It would be > easier for me to take a look at it. This mail includes diffs for r2748. Thanks, -- kasha ------------------------------------------------------------------------ r2748 | kasha | 2005-07-08 14:12:33 +0900 (Fri, 08 Jul 2005) | 3 lines fix LE.cpp - AUX events fix libiiimp.so compatibility issue - KEYEVENT ------------------------------------------------------------------------ Index: iiimsf/src/LE.cpp =================================================================== --- iiimsf/src/LE.cpp (revision 2747) +++ iiimsf/src/LE.cpp (revision 2748) @@ -459,14 +459,16 @@ IMInputEvent* pimevent ) { - IMKeyEventStruct *pkey; +// IMKeyEventStruct *pkey; bind_imlexec(pimlex); IMLock lock(get_leif_sync_object(), need_thread_lock_p()); /* Assume that only one event will be sent at a time */ - pkey = ((IMKeyListEvent *)pimevent)->keylist; +// pkey = ((IMKeyListEvent *)pimevent)->keylist; /* if KeyRelease is interested, send the release event. Otherwise, send only the press event */ - if ((pkey && pkey->keyType == IM_KEY_PRESS) || pbase->iml_if->need_keyrelease) +// if ((pkey && pkey->keyType == IM_KEY_PRESS) || pbase->iml_if->need_keyrelease) + if ((IM_EventKeyList != pimevent->type) || + (0 == (IM_KEY_RELEASE_MASK & pimevent->keylist.keylist->modifier))) if_SendEvent(s, pimevent); return true; Index: iiimsf/src/IIIMP_ICState.cpp =================================================================== --- iiimsf/src/IIIMP_ICState.cpp (revision 2747) +++ iiimsf/src/IIIMP_ICState.cpp (revision 2748) @@ -615,7 +615,6 @@ kev.keyChar = piiimpkey->keychar; kev.modifier = piiimpkey->modifier; kev.time_stamp = piiimpkey->time_stamp; - kev.keyType = piiimpkey->keytype; keyvec.push_back(kev); } @@ -710,7 +709,6 @@ ikev.keychar = pkeyevent->keyChar; ikev.modifier = pkeyevent->modifier; ikev.time_stamp = pkeyevent->time_stamp; - ikev.keytype = pkeyevent->keyType; IIIMP_keyevent_list *pikl = iiimp_keyevent_list_new(get_iiimptrans()->get_data_s(), 1, &ikev); Index: iiimsf/src/IMKeyUtils.cpp =================================================================== --- iiimsf/src/IMKeyUtils.cpp (revision 2747) +++ iiimsf/src/IMKeyUtils.cpp (revision 2748) @@ -55,22 +55,8 @@ keychar = x_keychar; modifier = x_modifier; timestamp = x_timestamp; - keytype = 1; /* set IM_KEY_PRESS by default */ } -IMKeySpec::IMKeySpec(int x_keycode, - int x_keychar, - int x_modifier, - int x_timestamp, - int x_keytype) -{ - keycode = x_keycode; - keychar = x_keychar; - modifier = x_modifier; - timestamp = x_timestamp; - keytype = x_keytype; -} - /******************************************************************************* IMKeyParser (helper object to parse key symbols *******************************************************************************/ Index: iiimsf/src/ChangeLog =================================================================== --- iiimsf/src/ChangeLog (revision 2747) +++ iiimsf/src/ChangeLog (revision 2748) @@ -1,3 +1,19 @@ +2005-07-08 AShiZaWa KaZuNoRi <[email protected]> + + * IIIMP_hotkey_profile.cpp (get_super_hotkeys): remove keytype for key release + * IIIMP_IMState.cpp (send_trigger_keys): remove keytype for key release + (set_data_to_client): add capability + * IIIMP_hotkey.cpp: IIIMP_hotkey::forward_hotkey_to_LE() + remove keytype for key release + * IMKeyUtils.hh (class IMKeySpec): remove keytype for key release + * IMKeyUtils.cpp (IMKeySpec): remove keytype for key release + * IIIMP_ICState.cpp: remove keytype for key release + * LE.cpp: LEContext::send_event() + pkey = ((IMKeyListEvent *)pimevent)->keylist; + if ((pkey && pkey->keyType == IM_KEY_PRESS) || pbase->iml_if->need_keyrelease) + The code processes only key events, and ignores other events such + as aux events. Breaks AUX. + 2005-07-07 AShiZaWa KaZuNoRi <[email protected]> * IIIMP_IMState.cpp (create_input_method_descriptors): call Index: iiimsf/src/IMKeyUtils.hh =================================================================== --- iiimsf/src/IMKeyUtils.hh (revision 2747) +++ iiimsf/src/IMKeyUtils.hh (revision 2748) @@ -51,7 +51,6 @@ int keychar; int modifier; int timestamp; - int keytype; public: int get_keycode() const { return keycode; } @@ -61,21 +60,12 @@ { return modifier; } int get_timestamp() const { return timestamp; } - int get_keytype() const - { return keytype; } IMKeySpec( int keycode, int keychar, int modifier, int timestamp ); - IMKeySpec( - int keycode, - int keychar, - int modifier, - int timestamp, - int keytype - ); }; typedef std::list<IMKeySpec> IMKeySpecList; Index: iiimsf/src/IIIMP_hotkey.cpp =================================================================== --- iiimsf/src/IIIMP_hotkey.cpp (revision 2747) +++ iiimsf/src/IIIMP_hotkey.cpp (revision 2748) @@ -110,7 +110,6 @@ kev.keyChar = it3->get_keychar(); kev.modifier = it3->get_modifier(); kev.time_stamp = it3->get_timestamp(); - kev.keyType = it3->get_keytype(); keyvec.push_back(kev); IMKeyListEvent *pimkey = &ev.keylist; Index: iiimsf/src/IIIMP_IMState.cpp =================================================================== --- iiimsf/src/IIIMP_IMState.cpp (revision 2747) +++ iiimsf/src/IIIMP_IMState.cpp (revision 2748) @@ -114,7 +114,6 @@ keys[i].keychar = it->get_keychar(); keys[i].modifier = it->get_modifier(); keys[i].time_stamp = it->get_timestamp(); - keys[i].keytype = it->get_keytype(); } pion = iiimp_keyevent_list_new(pdata_s, i, keys); pioff = iiimp_keyevent_list_new(pdata_s, i, keys); @@ -614,7 +613,9 @@ IIIMP_IMState_Identified:: set_data_to_client() { - IIIMP_imattribute *pima, *pima_objdesc, *pima_imdesc; + IIIMP_imattribute *pima, *pima_objdesc, *pima_imdesc, *pima_capability; + IIIMP_card32_list * capability; + IIIMP_card32 ca[1]; pima_objdesc = create_object_descriptors(); @@ -631,6 +632,20 @@ pima = pima_imdesc; } + ca[0] = 0; + ca[0] |= IIIMP_CAPABILITY_FILE_OPERATION; + ca[0] |= IIIMP_CAPABILITY_KEY_RELEASE; + capability = iiimp_card32_list_new(get_iiimptrans()->get_data_s(), 1, ca); + pima_capability = + iiimp_imattribute_capability_new( + get_iiimptrans()->get_data_s(), IIIMP_IMATTRIBUTE_CAPABILITY, + 0, capability); + if (NULL == pima) { + pima = pima_capability; + } else { + pima->next = pima_capability; + } + if (!send(iiimp_setimvalues_new(get_iiimptrans()->get_data_s(), get_im_id(), pima), true)) return false; Index: iiimsf/src/IIIMP_hotkey_profile.cpp =================================================================== --- iiimsf/src/IIIMP_hotkey_profile.cpp (revision 2747) +++ iiimsf/src/IIIMP_hotkey_profile.cpp (revision 2748) @@ -79,13 +79,11 @@ kev[n_keys].keyChar = 0; kev[n_keys].modifier = IM_CTRL_MASK|IM_ALT_MASK; kev[n_keys].time_stamp = 0; - kev[n_keys].keyType = IM_KEY_PRESS; n_keys++; kev[n_keys].keyCode = IM_VK_SPACE; kev[n_keys].keyChar = 0; kev[n_keys].modifier = IM_CTRL_MASK|IM_SHIFT_MASK; kev[n_keys].time_stamp = 0; - kev[n_keys].keyType = IM_KEY_PRESS; n_keys++; hks[n_hotkeys].label = strdup("LE SWITCH"); @@ -103,7 +101,6 @@ kev[n_keys].keyChar = it->get_keychar(); kev[n_keys].modifier = it->get_modifier(); kev[n_keys].time_stamp = it->get_timestamp(); - kev[n_keys].keyType = it->get_keytype(); } hks[n_hotkeys].label = strdup("TRIGGER KEYS"); @@ -120,7 +117,6 @@ kev[n_keys].keyChar = 0; kev[n_keys].modifier = IM_SHIFT_MASK|IM_CTRL_MASK; kev[n_keys].time_stamp = 0; - kev[n_keys].keyType = IM_KEY_PRESS; n_keys++; hks[n_hotkeys].label = strdup("CYCLE LE SWITCH"); @@ -137,7 +133,6 @@ kev[n_keys].keyChar = 0; kev[n_keys].modifier = IM_SHIFT_MASK|IM_CTRL_MASK; kev[n_keys].time_stamp = 0; - kev[n_keys].keyType = IM_KEY_PRESS; n_keys++; hks[n_hotkeys].label = strdup("CYCLE LE SWITCH(reverse)"); @@ -356,7 +351,6 @@ keys[j].keychar = it3->get_keychar(); keys[j].modifier = it3->get_modifier(); keys[j].time_stamp = it3->get_timestamp(); - keys[j].keytype = it3->get_keytype(); } hk[i].hotkeylist = iiimp_keyevent_list_new(pdata_s, keylist->size(), keys); delete[] keys; Index: include/IMProtocolStruct.h =================================================================== --- include/IMProtocolStruct.h (revision 2747) +++ include/IMProtocolStruct.h (revision 2748) @@ -197,12 +197,13 @@ #define IM_KEY_PRESS 1 #define IM_KEY_RELEASE 0 +#define IM_KEY_RELEASE_MASK (0x80000000) + typedef struct _IMKeyEventStruct { int keyCode; int keyChar; int modifier; int time_stamp; - int keyType; /* For Key Release Event Support */ } IMKeyEventStruct, *IMKeyList; /* Index: include/iiimcf.h =================================================================== --- include/iiimcf.h (revision 2747) +++ include/iiimcf.h (revision 2748) @@ -188,7 +188,6 @@ IIIMP_int32 keychar; IIIMP_int32 modifier; IIIMP_int32 time_stamp; - IIIMP_int32 keytype; /* For Key Release Event Support */ }; /* Hotkeys */ Index: include/ChangeLog =================================================================== --- include/ChangeLog (revision 2747) +++ include/ChangeLog (revision 2748) @@ -1,3 +1,17 @@ +2005-07-08 AShiZaWa KaZuNoRi <[email protected]> + + * iiimp/iiimp-data.h (IIIMP_imattribute_value): remove keytype for key release + (IIIMP_keyevent): remove keytype for key release + (iiimp_imattribute_capability_new()): new + (IIIMP_IMATTRIBUTE_CAPABILITY): new + (IIIMP_CAPABILITY_ERROR): new + (IIIMP_CAPABILITY_FILE_OPERATION): new + (IIIMP_CAPABILITY_KEY_RELEASE): new + + * iiimcf.h (IIIMCF_keyevent): remove keytype for key release + * IMProtocolStruct.h (IM_KEY_RELEASE_MASK): new + (IMKeyEventStruct): remove keytype for key release + 2005-07-07 AShiZaWa KaZuNoRi <[email protected]> * iiimp/iiimp-data.h: IIIMP_imeinfo - editorial change Index: include/iiimp/iiimp-data.h =================================================================== --- include/iiimp/iiimp-data.h (revision 2747) +++ include/iiimp/iiimp-data.h (revision 2748) @@ -216,6 +216,7 @@ IIIMP_ccdef * ccdef; IIIMP_jarfile_object * jarfile_object; IIIMP_binaryfile_object * binaryfile_object; + IIIMP_card32_list * capability; } IIIMP_imattribute_value; struct iiimp_imattribute { @@ -250,7 +251,6 @@ IIIMP_int32 keychar; IIIMP_int32 modifier; IIIMP_int32 time_stamp; - IIIMP_int32 keytype; /* For Key Release Event Support */ } IIIMP_keyevent; typedef struct { @@ -1754,6 +1754,13 @@ IIIMP_card16 id_dyn, IIIMP_binaryfile_object * value); +extern IIIMP_imattribute * +iiimp_imattribute_capability_new( + IIIMP_data_s * data_s, + IIIMP_card16 id, + IIIMP_card16 id_dyn, + IIIMP_card32_list * value); + extern IIIMP_icattribute * iiimp_icattribute_input_language_new( IIIMP_data_s * data_s, @@ -2871,8 +2878,16 @@ #define IIIMP_IMATTRIBUTE_BINARY_LIGHT_WEIGHT_ENGINE_OBJECT (0x1034) #define IIIMP_IMATTRIBUTE_SCRIPT_GUI_OBJECT (0x1035) #define IIIMP_IMATTRIBUTE_SCRIPT_LIGHT_WEIGHT_ENGINE_OBJECT (0x1036) +#define IIIMP_IMATTRIBUTE_CAPABILITY (0x1051) +/* IIIMP capability */ + +#define IIIMP_CAPABILITY_ERROR (0x00000001) +#define IIIMP_CAPABILITY_FILE_OPERATION (0x00000002) +#define IIIMP_CAPABILITY_KEY_RELEASE (0x00000004) + + /* IIIMP IM_LOOKUP_CHOICE_START */ /* lookup choice master */ Index: lib/iiimcf/iiimcf.c =================================================================== --- lib/iiimcf/iiimcf.c (revision 2747) +++ lib/iiimcf/iiimcf.c (revision 2748) @@ -235,7 +235,6 @@ pkev->keychar = pimk->keychar; pkev->modifier = pimk->modifier; pkev->time_stamp = pimk->time_stamp; - pkev->keytype = pimk->keytype; } ph->num_on_keys = i; @@ -259,7 +258,6 @@ pkev->keychar = pimk->keychar; pkev->modifier = pimk->modifier; pkev->time_stamp = pimk->time_stamp; - pkev->keytype = pimk->keytype; } ph->num_off_keys = i; Index: lib/iiimcf/ChangeLog =================================================================== --- lib/iiimcf/ChangeLog (revision 2747) +++ lib/iiimcf/ChangeLog (revision 2748) @@ -1,3 +1,9 @@ +2005-07-08 AShiZaWa KaZuNoRi <[email protected]> + + * event.c (forward_keyevent()): remove keytype for key release + (iiimcf_receive_forwarded_event()): remove keytype for key release + * iiimcf.c (iiimcf_register_trigger_keys()): remove keytype for key release + 2005-06-30 Federic Zhang <[email protected]> Enable Input Method Engine (IME) switching and display IME list in the language submenu of GIMLET Index: lib/iiimcf/event.c =================================================================== --- lib/iiimcf/event.c (revision 2747) +++ lib/iiimcf/event.c (revision 2748) @@ -405,7 +405,6 @@ ikev.keychar = pk->keychar; ikev.modifier = pk->modifier; ikev.time_stamp = pk->time_stamp; - ikev.keytype = pk->keytype; pikl = iiimp_keyevent_list_new(pds, 1, &ikev); if (!pikl) return IIIMF_STATUS_MALLOC; @@ -567,7 +566,6 @@ kev.keychar = pimkev->keychar; kev.modifier = pimkev->modifier; kev.time_stamp = pimkev->time_stamp; - kev.keytype = pimkev->keytype; st = iiimcf_create_keyevent(&kev, (IIIMCF_event*) &pev); if (st != IIIMF_STATUS_SUCCESS) return st; st = iiimcf_store_event(pc, pev); Index: lib/iiimp/ChangeLog =================================================================== --- lib/iiimp/ChangeLog (revision 2747) +++ lib/iiimp/ChangeLog (revision 2748) @@ -1,3 +1,17 @@ +2005-07-08 AShiZaWa KaZuNoRi <[email protected]> + + * data/comp-keyevent.c (iiimp_keyevent_list_new): revert keytype + (iiimp_keyevent_list_pack): remove keytype for key release + (iiimp_keyevent_list_unpack): remove keytype for key release + * data/comp-imattribute.c (iiimp_imattribute_new): add capability + (iiimp_imattribute_delete): add capability + (iiimp_imattribute_capability_new): new + (iiimp_imattribute_pack): add capability + (iiimp_imattribute_unpack): add capability + (iiimp_imattribute_print): add capability + * data/iiimp-dataP.h (KEY_EVENT_OBJECT_SIZE): revert + editorial change + 2005-07-07 AShiZaWa KaZuNoRi <[email protected]> * data/comp-inputmethod-descriptor.c Index: lib/iiimp/data/iiimp-dataP.h =================================================================== --- lib/iiimp/data/iiimp-dataP.h (revision 2747) +++ lib/iiimp/data/iiimp-dataP.h (revision 2748) @@ -367,7 +367,7 @@ } while(0) -#define KEY_EVENT_OBJECT_SIZE (4 * 5) /* Additional one for the new keytype member */ +#define KEY_EVENT_OBJECT_SIZE (4 * 4) typedef struct iiimp_attribute_id { @@ -376,6 +376,7 @@ struct iiimp_attribute_id * next; } IIIMP_attribute_id; + struct iiimp_data_s { int byte_swap; IIIMP_attribute_id * attribute_id; Index: lib/iiimp/data/comp-imattribute.c =================================================================== --- lib/iiimp/data/comp-imattribute.c (revision 2747) +++ lib/iiimp/data/comp-imattribute.c (revision 2748) @@ -73,6 +73,9 @@ case IIIMP_IMATTRIBUTE_SCRIPT_LIGHT_WEIGHT_ENGINE_OBJECT: attr->value_nbyte = attr->value.binaryfile_object->nbyte; break; + case IIIMP_IMATTRIBUTE_CAPABILITY: + attr->value_nbyte = attr->value.capability->nbyte; + break; } attr->nbyte += (attr->value_nbyte + PAD(attr->value_nbyte)); @@ -109,6 +112,9 @@ case IIIMP_IMATTRIBUTE_SCRIPT_LIGHT_WEIGHT_ENGINE_OBJECT: iiimp_binaryfile_object_delete(data_s, attr->value.binaryfile_object); break; + case IIIMP_IMATTRIBUTE_CAPABILITY: + iiimp_card32_list_delete(data_s, attr->value.capability); + break; } free(attr); @@ -258,6 +264,19 @@ } +IIIMP_imattribute * +iiimp_imattribute_capability_new( + IIIMP_data_s * data_s, + IIIMP_card16 id, + IIIMP_card16 id_dyn, + IIIMP_card32_list * value) +{ + return iiimp_imattribute_new(data_s, id, + IIIMP_IMATTRIBUTE_CAPABILITY, + id_dyn, (void *)value); +} + + void iiimp_imattribute_pack( IIIMP_data_s * data_s, @@ -304,6 +323,9 @@ iiimp_binaryfile_object_pack(data_s, m->value.binaryfile_object, &rest, &p); break; + case IIIMP_IMATTRIBUTE_CAPABILITY: + iiimp_card32_list_pack(data_s, m->value.capability, &rest, &p); + break; } *nbyte = rest; @@ -423,6 +445,10 @@ attr->value.binaryfile_object = iiimp_binaryfile_object_unpack(data_s, &rest2, &p, rest2); break; + case IIIMP_IMATTRIBUTE_CAPABILITY: + attr->value.capability = iiimp_card32_list_unpack(data_s, &rest2, + &p, rest2); + break; default: attr->value.any = NULL; data_s->status = IIIMP_DATA_INVALID; @@ -541,6 +567,10 @@ "\tSCRIPT Light Weight Engine Object:\n"); iiimp_binaryfile_object_print(data_s, m->value.binaryfile_object); break; + case IIIMP_IMATTRIBUTE_CAPABILITY: + (void)fprintf(data_s->print_fp, "\tCapability:\n"); + iiimp_card32_list_print(data_s, m->value.capability); + break; } } Index: lib/iiimp/data/comp-keyevent.c =================================================================== --- lib/iiimp/data/comp-keyevent.c (revision 2747) +++ lib/iiimp/data/comp-keyevent.c (revision 2748) @@ -26,7 +26,7 @@ return NULL; } - nbyte = ((4 + 4 + 4 + 4 + 4) * count); /* keytype is expected */ + nbyte = ((4 + 4 + 4 + 4) * count); data->nbyte = nbyte; data->count = count; @@ -81,7 +81,6 @@ PUT32((m->keyevent + i)->keychar, rest, p, data_s->byte_swap); PUT32((m->keyevent + i)->modifier, rest, p, data_s->byte_swap); PUT32((m->keyevent + i)->time_stamp, rest, p, data_s->byte_swap); - PUT32((m->keyevent + i)->keytype, rest, p, data_s->byte_swap); } *nbyte = rest; @@ -143,7 +142,6 @@ GET32((l->keyevent + i)->keychar, rest, p, data_s->byte_swap); GET32((l->keyevent + i)->modifier, rest, p, data_s->byte_swap); GET32((l->keyevent + i)->time_stamp, rest, p, data_s->byte_swap); - GET32((l->keyevent + i)->keytype, rest, p, data_s->byte_swap); } /* This failed for the scenario of having multiple HOTKEYS and each Index: iiimgcf/ChangeLog =================================================================== --- iiimgcf/ChangeLog (revision 2747) +++ iiimgcf/ChangeLog (revision 2748) @@ -1,3 +1,8 @@ +2005-07-08 AShiZaWa KaZuNoRi <[email protected]> + + * IIIMGdkEventKey.c (convert_GdkEventKey_to_IIIMCF_keyevent): + remove keytype for key release + 2005-06-30 Federic Zhang <[email protected]> Enable Input Method Engine (IME) switching and display IME list in the language submenu of GIMLET. Index: iiimgcf/IIIMGdkEventKey.c =================================================================== --- iiimgcf/IIIMGdkEventKey.c (revision 2747) +++ iiimgcf/IIIMGdkEventKey.c (revision 2748) @@ -817,8 +817,9 @@ { int c; guint keyval; + int key_release; - pkev->keytype = e->type == GDK_KEY_PRESS; + key_release = ((e->type == GDK_KEY_PRESS) ? 0 : 0x80000000); #if USE_KANA_TABLE gint kanaflag; @@ -844,7 +845,7 @@ pkev->keychar = kana_shift_keymapTable[i].iiimf_keychar; if (pkev->keycode) { - pkev->modifier = modifier (e->state); + pkev->modifier = (modifier (e->state) | key_release); pkev->time_stamp = e->time; return IIIMF_STATUS_SUCCESS; } @@ -861,7 +862,7 @@ pkev->keychar = kana_normal_keymapTable[i].iiimf_keychar; if (pkev->keycode) { - pkev->modifier = modifier (e->state); + pkev->modifier = (modifier (e->state) | key_release); pkev->time_stamp = e->time; return IIIMF_STATUS_SUCCESS; } @@ -877,7 +878,7 @@ pkev->keychar = kana_shift_keymapTable[i].iiimf_keychar; if (pkev->keycode) { - pkev->modifier = modifier (e->state); + pkev->modifier = (modifier (e->state) | key_release); pkev->time_stamp = e->time; return IIIMF_STATUS_SUCCESS; } @@ -895,7 +896,7 @@ pkev->keychar = kana_normal_keymapTable[i].iiimf_keychar; if (pkev->keycode) { - pkev->modifier = modifier (e->state); + pkev->modifier = (modifier (e->state) | key_release); pkev->time_stamp = e->time; return IIIMF_STATUS_SUCCESS; } @@ -911,7 +912,7 @@ pkev->keychar = kana_normal_keymapTable[i].iiimf_keychar; if (pkev->keycode) { - pkev->modifier = modifier (e->state); + pkev->modifier = (modifier (e->state) | key_release); pkev->time_stamp = e->time; return IIIMF_STATUS_SUCCESS; } @@ -958,7 +959,7 @@ pkev->keychar = gdk_keyval_to_unicode (e->keyval); pkev->keycode = c; } - pkev->modifier = modifier (e->state); + pkev->modifier = (modifier (e->state) | key_release); pkev->time_stamp = e->time;