[EMAIL PROTECTED] wrote:

> Hello, Angus;
> 
> I have found that internally fl_context->xic is always set to zero
> corresponding to each input from the keyboard, which is bad for
> XmbLookupString because it gives segfaults when fl_context->xic=0.
> 
> I think the reason why this is so is that the "XCreateIC" in
> lib/flresource.c has too few  arguments. That is, we have to provide
> at least PreeditAttributes and StatusAttributes in addition to the
> input style for XCreateIC. Over the weekend, I have tried several
> attempts to
> get the appropriate attributes, but none  has succeeded. During
> these attempts, however, I have found that with a few example
> attributes I could input CJK characters from the keyboard to xforms
> box such as Edit->Search
> & Replace box in CJK-LyX through my local input method!  So the
> remaining task for i18n of xforms-library is really to find the
> appropriate attributes for XCreateIC. Do you have any idea ?

None at all. I know nothing at all about this stuff.

> One of my previous attempts was to import the attributes from
> lyxim.C in CJK-LyX into xforms. In lyxim.C we used the "x" and "y"
> position as well as width and height of the work_area of the current
> BufferView to get the position and the size of the preedit area and
> the cursor position. Since this "work_area" is FL_OBJECT in
> XWorkArea.h, there must be corresponding "work_area" in xforms but I
> could not find the one. Can you or any other expert in lyx as well
> as xforms give me any clues ?

I'm a little confused by what you mean. I view our XWorkArea class as 
an xforms widget that 'uses' a number of simpler widgets. Several of 
xforms' own widgets are 'complex' in this manner. Eg, the browser 
widget which is made up internally of a textbox, a horizontal and a 
vertical slide bar. See private/pbrowser.h.

We could probably re-write XWorkArea as a native xforms widget. Ie, 
it would be of type FL_OBJECT and the 
        void * spec;
member variable would be initialised in some fl_create_lyxworkarea 
function and point to some private FL_LYXWORKAREA_SPEC struct 
containing the same two 'simple' FL_OBJECTs, work_area and scrollbar.

Basically, TC Zhao is doing his best to create derived classes using 
the machinery that C has available. This would, of course, be far 
more transparent if written in C++ with proper support for such a 
concept.

If you understand XWorkArea like this, then FL_OBJECT * work_area is 
just a detail of the implementation. The xforms native input widget 
has its own SPEC struct (see input.c). You'll see that this struct 
has 4 FL_OBJECT * members:

    FL_OBJECT *dummy;           /* only for the size of composite */
    FL_OBJECT *hscroll;
    FL_OBJECT *vscroll;
    FL_OBJECT *input;

Thus
        FL_OBJECT * ob = fl_create_input(...);
        ((SPEC *)ob->spec)->input == ob;

and hscroll, vscroll, dummy are details of the implementation.

If you want 'the "x" and "y" position as well as width and height of 
the work_area of the current BufferView to get the position and the 
size of the preedit area and the cursor position.', then does not 
        FL_OBJECT * ob = fl_create_input(...);
        int x, y, w, h;
        x=ob->x;
        y=ob->y;
        w=ob->w;
        h=ob->h;
give you what you want? Ie, each input widget will have its own 
preedit area. I thought that that was what your screenshots showed?

Has this essay helped or are we still confusing each other?

> Because of this lingering problem, I could not have tested your
> xforms patch. Sorry.

You have nothing to apologise for ;-)

-- 
Angus

Reply via email to