On Tue, 28 Jan 2003, Angus Leeming wrote:

> One further, tiny point. If this works,


Not yet! In fact, as I dig into the problem further, I get more confused 
and discouraged. Here's why.

1. If I set the input style to be "over the spot" as in lib/flresource,


     ..............
     if (fl_context->xim) {
        int style = XIMPreeditPosition|XIMStatusNothing;
        fl_context->xic = XCreateIC(fl_context->xim,
                                 XNInputStyle, style, 0);
     }
   .................

  
  I get CJK-LyX working with this xforms. That is, I can input CJK 
   characters onto the main lyx window. However I cannot input 
   CJK-characters on the xforms box.



Now, with this setting I add your code in input.c:

   ................
    /* toggle input method for CJK users */
     if (key == XK_space) {
        if (shiftkey_down(kmask) && ! sp->CJK_local_input) {
       XPoint location;
       int x, y, w, h;
       XVaNestedList preedit_list;

         location.x = ob->x;
         location.y = ob->y;

        preedit_list = XVaCreateNestedList( 0,XNSpotLocation, 
                                           &location,NULL);
        XSetICValues(fl_context->xic,XNPreeditAttributes,preedit_list,0);
        XFree(preedit_list);
     }

  .....................

  Then, the library compiles well. However with the compiled library, 
   CJK-LyX dies with segfaults when I toggle(shift-space) to input 
   CJK-character onto "Edit->Find & Replace" box. The debug indicates 
   there's something wrong with "XSetICValues". 



2. I guess the reason why I get segfaults on "XSetICValues" is that no 
   input contexts are created except the input style in fl_initialize in 
   flresource. So I tried a simple input context as follows:
   
   ..........................
     if (fl_context->xim) { 
      int style = XIMPreeditPosition|XIMStatusNothing;
      char  **missing_list;
     int  missing_count;
     char *def_string;
     
     XFontSet fontset = XCreateFontSet(fl_display, DUMMY_FONT_NAME, 
                                       &missing_list,&missing_count, &def_string);
      XPoint location;
       location.x = 0;
       location.y = 0;
      XVaNestedList preedit_list;
       XVaNestedList status_list;
 
       preedit_list = XVaCreateNestedList( 0,
                                           XNSpotLocation, &location,
                                           XNFontSet, fontset,
                                           NULL);
       status_list = XVaCreateNestedList( 0,
                                          XNFontSet, fontset,
                                          NULL);
       fl_context->xic = XCreateIC(fl_context->xim,
                                 XNInputStyle, style,
                                  XNPreeditAttributes, preedit_list,
                                  NULL);
       XFree(preedit_list);
       XFree(status_list);

    ........................................


  The problem is that with this xforms library (without your 
   change in input.c), I cannot input CJK-characters on the main lyx 
   window anymore. I guess this happens because this XIC settings conflict 
    with those in lyxim.C. If I toggle to input CJK-characters on the 
    "Edit->Find &..." box, however, it connects with my local input mehtod 
   and composing of characters occur at the position (0,0) as expected 
   (location.x = 0, ...) and the "space" puts the composed characters on 
   the box!  Now I add your code in input.c as in "1" above. This time I 
   do not get segfaults as expected, but adding your code seems do 
   nothing!--- I still cannot input CJK-characters on the main lyx window 
   and the pre-composition of CJK-characters occurs at the position (0,0).


I'm really at a loss, now. How about you?  I'm ccing this email to 
  Miyata. Maybe he has answers.


Regards,            
                          

cghan

Reply via email to