Angus Leeming <[EMAIL PROTECTED]> wrote:
(B
(B> As an aside, I also believe that this could be made to work with
(Bcghan's
(B> stuff because every composed char has a unique keysym. (Am I right
(Bhere?)
(B> That means fl_XLookupString could be modified to work with far eastern
(B
(B> languages and everything else will continue to work. Note that this
(Bthought
(B> is pure speculation ;-)
(B
(BOK. Here are some observations:
(B
(B> (a snippet of my modified XWorkArea.C):
(B>
(B> case FL_KEYPRESS:
(B> {
(B> if (!ev)
(B> break;
(B> XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
(B>
(B> lyxerr[Debug::KEY] << "Workarea: key event time diff: "
(B> << xke->time - time_key_released
(B> << endl;
(B>
(B> if (xke->time - time_key_released < 25 // Should be tunable?
(B> && xke->keycode == last_key_pressed
(B> && xke->state == last_state_pressed) {
(B>
(B> lyxerr[Debug::KEY]
(B> << "Workarea: Purging X events." << endl;
(B>
(B> if (XEventsQueued(fl_get_display(), QueuedAlready) > 0)
(B> waitForX(true);
(B> // This purge make f.ex. scrolling stop immediately when
(B> // releasing the PageDown button. The question is if
(B> // this purging of XEvents can cause any harm...
(B> // after some testing I can see no problems, but
(B> // I'd like other reports too. (Lgb)
(B> break;
(B> }
(B
(BAs I said the 19th February this year, you must not purge the event
(Bif there is no difference in timestamp. Below, you see in the original
(Bcode of do_keyboard() in xforms,
(B
(B> - for (ch = keybuf; ch < (keybuf + kbuflen) && keyform; ch++)
(B> - fl_handle_form(keyform, formevent, *ch, xev);
(B
(Bthat is, Input Method server might send an event with multibyte string
(Bin keybuf and kbuflen > 1 to xforms, and xforms divides it into pieces
(Bof 1 byte keysym events and send them one by one to LyX. Naturally,
(Btheir timestamps are all the same. Your patch to xforms
(B
(B> + /* Dispatch the key event */
(B> + fl_handle_form(keyform, formevent, keysym, xev);
(B
(Bis of course wrong! since keysym can contain only 1 byte.
(BNow xforms has a bug related to this. fl_XLookupString() just returns
(Berror when XBufferOverflow occurs. Since this function is called with
(Bonly 227 bytes buffer in do_keyboard(), XBufferOverflow should happen
(Bquite often. The correct way to handle XBufferOverflow status is, as I
(Bexplained to T.C.Zhao 2 years ago, to reallocate the buf to the length
(Bequal to what Xlib returns in buflen and to call XmbLookupString() once
(Bagain.
(B
(BAs I already said, XIMPreeditNothing|XIMStatusNothing style xforms set
(Bfor Input Context is extremely inconvenient for Japanese input and I
(Bwish xforms at least tries to
(BXSetICValues(fl_context->xic, XNInputStyle,
(BXIMPreeditPosition|XIMStatusNothing, NULL);
(Bon the created Input Context. I'm not sure but I guess this call
(Bgracefully fails with non-CJK input method without affecting the
(Bbehaviour.
(B
(BRegards,
(B SMiyata