On Mon, 3 Feb 2003, Angus Leeming wrote: > > Print statements, CG, print statements! >
Sorry, I cannot catch you. What do you mean by "Print statements"? > Looking at struct SPEC: > int xoffset; > int yoffset; > int position; /* cursor position (in chars) */ > int xpos, ypos; /* current cursor position in char,line */ > Besides these, there are some more: sp->input->x, sp->input-y. I have tried to find a correct combination of these parameters without any success. > Which of these is important? Hmmm. > > Ahhh. Look at routine make_cursor_visible. It looks to me like you want > sp->xoffset and perhaps sp->yoffset. This should give you the cursor position > in PIXELs relative to the top left corner of the widget. > > Presumably you want position relative to the top left corner of the window: > int xpos = ob->x + sp->xoffset; > > Of course, I'm just guessing here. Use print statements!!!! > > static void > make_cursor_visible(FL_OBJECT * ob, SPEC *sp, int startpos, int prev) > { > int tt = get_substring_width(ob, startpos, sp->position); > > if (prev == -1) > { > if (tt - sp->xoffset >= sp->w) > sp->xoffset = tt - sp->w; > else if (tt < sp->xoffset) > sp->xoffset = tt; > else if (tt == 0) > sp->xoffset = 0; > } > else > { > if (tt - sp->xoffset > sp->w) > sp->xoffset = tt - sp->w; > } > } > Hm... This looks interesting. > > > Why do you need XIM to modify the XIC? You create the XIC when the form is > made visible in forms.c. All you need is to access this XIC from XWorkArea.C > to set the procomposition area as the current position of the cursor in the > XWorkArea widget. (Just as you are trying to do in input.c.) > But how can I get "form->xic" from outside of xforms ? "fl_context->xim" is global in xforms and thus exporting this param looks easier, no? > Note if you do this (and get the stuff in input.c working too) then you'll be > able to enter CJK characters in the minibuffer for free! Not sure what use > that is, but it'll be fun ;-) > > Anyway, if you _really_ need xim, then add an accessor function: > XIM fl_get_xim() { return fl_context->xim; } > to forms.[ch] > This easy, Huh? Thanks! cghan